Yue Posted August 21, 2022 Share Posted August 21, 2022 I want to set a custom image for the mouse pointer with the GUI system in Leadwerks. Any suggestions? Quote Link to comment Share on other sites More sharing options...
Alienhead Posted August 21, 2022 Share Posted August 21, 2022 ---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 ! 1 1 Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Yue Posted August 21, 2022 Author Share Posted August 21, 2022 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: Quote Link to comment Share on other sites More sharing options...
Alienhead Posted August 22, 2022 Share Posted August 22, 2022 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() Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Yue Posted August 22, 2022 Author Share Posted August 22, 2022 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. Quote Link to comment Share on other sites More sharing options...
reepblue Posted August 22, 2022 Share Posted August 22, 2022 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. 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Yue Posted August 22, 2022 Author Share Posted August 22, 2022 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. Quote Link to comment Share on other sites More sharing options...
reepblue Posted August 22, 2022 Share Posted August 22, 2022 Make a panel like you did for your menu box and update its position with the mouse position ether every frame or in your event queue. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Yue Posted August 22, 2022 Author Share Posted August 22, 2022 It does not work, the panel does not update its position with the mouse coordinates. Quote Link to comment Share on other sites More sharing options...
Solution reepblue Posted August 22, 2022 Solution Share Posted August 22, 2022 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. 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
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.