Jump to content

Image Mouse Gui on Leadwerks?


Yue
 Share

Go to solution Solved by reepblue,

Recommended Posts

---Draw Mouse Pointer
    window:HideMouse()
    context:SetColor(1,1,1,1)
    local mousepos = window:GetMousePosition()
    context:DrawImage(img_mouse, mousepos.x, mousepos.y, 40,40 )

 

 

Top secret code ! no sharing !  :) 

  • Like 1
  • Haha 1

I'm only happy when I'm coding, I'm only coding when I'm happy.

Link to comment
Share on other sites

3 minutes ago, Alienhead said:

---Draw Mouse Pointer
    window:HideMouse()
    context:SetColor(1,1,1,1)
    local mousepos = window:GetMousePosition()
    context:DrawImage(img_mouse, mousepos.x, mousepos.y, 40,40 )

Top secret code ! no sharing !  :) 

What happens is that for some reason if I do that the image is behind the GUI buttons and panels:

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

54 minutes ago, Yue said:

What happens is that for some reason if I do that the image is behind the GUI buttons and panels:

You need to place the the Mouse Draw commands at the very end.  2D is drawn in order you send the draw commands at it. So draw the mouse image LAST and it will overwrite your panels.  As matter of fact, draw the mouse image right before you context:Sync()

I'm only happy when I'm coding, I'm only coding when I'm happy.

Link to comment
Share on other sites

1 hour ago, Alienhead said:

You need to place the the Mouse Draw commands at the very end.  2D is drawn in order you send the draw commands at it. So draw the mouse image LAST and it will overwrite your panels.  As matter of fact, draw the mouse image right before you context:Sync()

Not Working. 

image.thumb.png.bd839a01b30a181db2d089ee7801d3f4.png

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

The GUI gets drawn ON TOP of all post rendering calls within the context layer. This was actually really convenient when I was trying to figure out what should be a HUD element and should be a UI element. You should draw all HUD icons and text to PostRender functions as it'll always get drawn below the UI.

For your mouse issue, I guess you can try creating a panel and poll the mouse position from the event stack and apply it to the panel. 

  • Like 1

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

6 minutes ago, reepblue said:

The GUI gets drawn ON TOP of all post rendering calls within the context layer. This was actually really convenient when I was trying to figure out what should be a HUD element and should be a UI element. You should draw all HUD icons and text to PostRender functions as it'll always get drawn below the UI.

For your mouse issue, I guess you can try creating a panel and poll the mouse position from the event stack and apply it to the panel. 

I appreciate the answer, unfortunately the translator does not help much, and I do not understand very well what you recommend me to do. Surely I would have to draw on top of UI, however with the DrawImage command I am doing it behind the UI and not on top of it, at that point I should draw the image with the UI, but I have no idea how.

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

  • Solution

Oh yeah, I think that's broken. I wouldn't count on it being fixed unfortunately.

TBH, I wouldn't worry about it. I wanted to do a lot of things for my game, but I ended up not pursuing it because I couldn't figure it out. Don't let a minor detail get in the way of things.

  • Like 1

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...