Draw GUI and object depth...

J

Jack55555

Guest
So I noticed that draw GUI always draws over objects. Makes sense to me. I even checked the manual, and it is described there. But this gives me the following problem:

I want to draw a window in my game, where the player stats are shown. The game uses views, so I do it with the draw GUI function. It all works well, until I also create buttons to add and remove skill points. Those are objects so I create them with the instance_create inside the window. But the window is drawn over it, so they are invisible.

What is the best solution for this? I know I can draw the window old fashioned with, giving the step event of the window the function to always go to the x and y of the player view, but that is not really efficient, is it. What is the most efficient way to solve this problem?
 

johnwo

Member
In the button object, use the GUI draw event and draw the sprites there. Or simply use draw_self in the GUI draw event of said object.
Set the depth of the button objects lower than the window depth (i.e. window depth 0, button depth -1) to ensure that they are drawn after the window in the GUI draw queue.

Cheers!
 
J

Jack55555

Guest
In the button object, use the GUI draw event and draw the sprites there. Or simply use draw_self in the GUI draw event of said object.
Set the depth of the button objects lower than the window depth (i.e. window depth 0, button depth -1) to ensure that they are drawn after the window in the GUI draw queue.

Cheers!
You sir, are a champ, it works!
 
Top