• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Pixel-perfect GUI in multiple resolutions

Hey all, got a potentially easy or very hard one here, depending on one's feelings on resolutions and scaling (I find it hard to figure out, hence why I'm here). Recently, we got pixel-perfect resolutions to work in our game, without using the scaling method most people recommend. However, we're now running into a problem where our GUI...well, here's a portion of our GUI at 1920x1080:
1613491889255.png
Pixel perfection. Well, maybe my icons aren't perfect in an aesthetic sense :p

Same portion at, say, 1440x900:
1613491945728.png
...yikes.
I've tried a couple things thus far:
- most of the solutions found at this blog post. they seem to have the same issue, or resize my GUI in odd ways, like being in the middle 1/3rd of the screen
-
GML:
display_set_gui_maximise(window_get_width()/base_width, window_get_height()/base_height)
this makes the GUI fit the screen, but leads to the degradation seen above. base_width is 480, base_height is 270 (base resolution as our game)
- the same method we used for our resolution scaling, simply applied to the gui layer. Either makes the GUI layer so large it can't display, or resizes it with each resolution, meaning it never fits.

also, this chunka code:
GML:
base_width = 480
base_height = 270
gui_x_scale = ceil(window_get_width() / base_width)
gui_y_scale = ceil(window_get_height() / base_height)

gui_scale = max(gui_x_scale, gui_y_scale)

display_set_gui_maximise((window_get_width()/base_width)*gui_scale, (window_get_height()/base_width)*gui_scale)
No dice there, GUI got so stretched and contorted, you could call it an Amigara Fault.

With all that in mind, I figure my options are:
-there's some pixel-perfect scaling trick I'm missing
-rewriting the GUI to use the gui width and height methods i just found (works fine for the resizing, but fonts may still be borked)
-finding a different font, along with a combo of the previous option (the smallest this font can go without being garbled is 6, all of the text in the screenshots that doesn't say "Lv. 1" is being transformed to a 0.5 scale)

Any suggestions or easy stuff I'm missing? Apologies for the wall of text, any help is appreciated!
 
Last edited:

Sirham

Member
Now, before we go any further, I ask everyone this for display problems, are you interpolating between pixels?
 
Top