• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

Legacy GM [SOLVED] Scale maximised GUI layer?

Using GM:S 1.4.1763

What I want to do:
  1. The game is set to keep aspect ratio. So depending on the screen or window aspect there will be black bars - wich is intended in this case.
  2. The GUI layer is set to maximise so GUI elements can be drawn on the black bars.
  3. All elements on the GUI layer need to be scaled up by a factor to get a pixelated look.
Point 3 is where I struggle.

This is before I change the windowsize and without any GUI manipulation:
The red crosses and the green circle are on the GUI layer and are drawn realtive to the GUI-layers width & height. The Text is not on the GUI layer.
GUI scale - start.jpg

When I use:
display_set_gui_size(surface_get_width(application_surface)/2, surface_get_height(application_surface)/2);
The GUI layer is not covering the black bars, but is scaled properly by factor 2.
GUI scale - scale to appsurf.jpg
(small bug in the screenshot: gui height is actually 240, not 480)

When I use:
The GUI layer is covering the black bars, but is not scaled.
GUI scale - maximise no scale.jpg

When I use:
display_set_gui_maximise(2, 2);
The GUI layer is covering the black bars, is scaled but is only showing the upper-left quadrant of the GUI layer.
GUI scale - maximise with scale 2.jpg

When I use:
display_set_gui_maximise(0.5, 0.5);
The GUI layer is covering the black bars, is scaled but is only covering the upper quadrant of the window.
GUI scale - maximise with scale 0-5.jpg

So how can I make the GUI layer cover the whole window but all elements be scaled by factor 2 (or any other facotr)?
Last edited:
Thanks alot already. I had that tried before. At least in my GM:S version that doesn't work. The result of:

display_set_gui_size(window_w/factor, window_h/factor);

is the same as the result of:


I tested this maximise function on Windows, Windows (YYC) and HTML5 target. always the same result.

And to me it seems it doesn't work in your GM:S version either. When looking at the screenshot you linked I see you set the window size to 900x600 and the gui size to 450x300 and then you maximise the gui. However the info text you generate shows that the gui layer is still the same size as the window: 900x600.

What I'd expect however is the gui being at 450x300 and then scaled up to fit the window. Kinda like GM:S does with the application surface.

I could fix that by drawing on the gui layer with a scale factor as well, but there's no point in haveing a scale factor in the maximise function. To me it looks like a bug but I posted here instead of the bug report because I (still) guess chances are higher that I'm just not getting how it's supposed to work :)

Any idea what I'm getting wrong here? Or is this a bug in your opinion as well?

And hey, if it's not a bug and you think this is interesting enough for your private investigator playlist - here's the gmz file of my test project:
(please don't think you have to though)
@The Reverend So I messed with this for awhile, and I just couldn't come up with a good solution. This script may be broken or just really not very useful in most cases. One thing that you may find interesting is that even without maximizing the GUI you can still draw in the black bars using negative values to draw left, and values wider than the display_get_gui_width() to draw to the right. It should be possible to calculate new "top left" and "bottom right" values for you to use in all of your gui draw calls if you want. Something like taking the size of the window and the size of the gui (taking the scale factor into account) and finding the difference and divide by 2... or something. I'm a little wiped out today so mathing is hard. But hopefully that gets you somewhere closer to where you want to be.

Sorry I couldn't be more help.
Thanks alot. going to negativ didn't occur to me *embarrassed*. That helps alot. And I think getting the negative shouldn't be hard with the function application_get_position(); wich just returns an array holding x1, y1, x2, y2 of the application surface in the window/display.

As for the maximise function. I think I'll report it as possible bug and see what yoyogames thinks about it.

Thanks again.