Scaling gui for different resolutions

I’m trying to rewrite the gui so that it’ll scale appropriately and look as intended on multiple devices with different resolutions. I changed the way the gui objects are created and positioned using relative values of ScreenWidth() and ScreenHeight() rather than absolute coordinates.

Here’s what I have so far:


It sort of works, but it’s a little buggy and I can’t figure out why. I don’t know if there’s a simple error I’m not seeing because I’ve been staring at it too long, or a fundamental concept I’m missing.

Here is the way the events behave:

Everything looks okay at normal resolution:

Then why I try to resize, the background doesn’t seem to want to fill out the screen.


I mentioned it on the discord, but I’ve submitted a feature request proposal with this idea.

It has an example project you can play around with that avoids the background issues as it uses camera zooming and resizing the objects.

1 Like

The example was very helpful, giving me some new ideas I haven’t tried before.

My effort isn’t “perfect” but it’s a big improvement over what it was.

You can see how it’s now able to handle different resolutions much better than before:

I also noticed that the pseudo-3d does much better in windowed mode with a smaller screen… I can easily run 40-60fps this way.