• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code GUI layer drawing incorrectly

deepfry3

Member
A few days ago I posed on the Programming forum about an issue with the draw_rectangle function. I didn't manage to resolve that, but trying to understand the GUI layer in general since then has just added to my confusion.

I went back to this blog post and did the exact same thing as described, but the sprite scales with the game window for me, as though I was using the Draw event rather than Draw GUI. Using draw_text with display_get_gui_width(), I can see that the GUI layer's size is changing, as I presume is expected. I also tried setting the GUI size manually in the Create event, which then keeps it static when the game window is resized as well, but the sprite continues to cover 100% of the game window in either scenario.

Is there something I'm misunderstanding?

Example.png
 
I think I got the same results as you. Following the blog, the sprite continues to cover the whole screen, even though the blog shows different in its first example.

I found this in the release notes for 2.1.5:

1586343000448.png

I found that if I put that recommended code at the start of the game:
Code:
var pos = application_get_position();
display_set_gui_maximise(1, 1, pos[0], pos[1]);
Then the first few steps of the tutorial matched what I saw when I ran the test. The white grid drawn on the GUI Layer stayed the same size in the upper left corner when I made the window bigger.

I haven't fully tested the rest of the blog out yet, like what resolution the GUI layer gets set to when resizing the window when trying out the various examples that were listed. I recommend you do some more tests while drawing the size of the application surface and GUI Layer to the screen while you resize the window to see what effect the various options have.
 
Top