GUI button appears in another position within the room

wilmer

Member
Greetings, the problem is that I have a room that measures 1700 x 1000 and the view measures 1280 x 720, I use objects to use them as buttons and in the room editor I place them in a corner, so those buttons should appear there but That is not the case, they appear below where you place them.
These are the only lines of code that I use, and I don't think I should compensate for the position of each button by subtracting X / Y from a create or Step event. What am I doing wrong ?

Create Event
GML:
display_set_gui_size(camera_get_view_width(view_camera[0]),camera_get_view_height(view_camera[0]))
Draw Event
GML:
///Here I do not put any code, as it should be
Draw GUI Event
GML:
draw_self()
This is what my room looks like and the view, which is positioned in the center of the room and glued down with the edge of the room:
Room.png
 

samspade

Member
When you place them in a room try taking a view you aren't using, setting it to the size of your GUI, enabling it temporarily, and then using that as a guide to placing your objects. Then disable it agian.
 

wilmer

Member
When you place them in a room try taking a view you aren't using, setting it to the size of your GUI, enabling it temporarily, and then using that as a guide to placing your objects. Then disable it agian.
samspade Ok, but there won't be a more precise solution (without having to move them), is that these buttons are virtual / tactile, if I use virtual_key_show, I will have to configure another position for them.
 

samspade

Member
samspade Ok, but there won't be a more precise solution (without having to move them), is that these buttons are virtual / tactile, if I use virtual_key_show, I will have to configure another position for them.
I don't understand your answer which probably means I missed something. What do you mean by "There won't be a more precise solution" and "If I use virtual_key_show, I will have to configure another position for them"?

The whole point of using the GUI layer is that buttons don't move with the room. You do sometimes move buttons even of the GUI layer, but that can be handled much like regular movement.

Normally, the issue with putting things on a GUI layer is correctly positioning them (which from your first post is what I thought the issue was) given that the GUI layer uses its own coordinate system. This is why I suggested using a view as a proxy. You could also open up photoshop or an image editor and manually position your sprites how you like and then note their positions and assign them directly to that position in GameMaker, but I think that is generally more work than necessary.
 
Top