GUI Text Size Remaining The Same On Multiple Resolutions

C

Cole

Guest
Hello everybody! I'll get right to the problem I am having, that the internet cannot fix as far as I can find.


This problem is that from the switch from 720p to 1080p, the text size remains the same size in pixels, instead of maintaining it's initial ratio to the screen. I considered just changing the text's size depending on the resolution, but it would be impossible to account for all screen resolutions. Any and all help is much appreciated, thanks!
 
S

seanm

Guest
I don't think you can actually just scale the gui layer. Maybe there is a way, but I haven't gotten it to work.

You might just have to draw the gui layer to a surface and then scale the surface.
 
C

Cole

Guest
I don't think you can actually just scale the gui layer. Maybe there is a way, but I haven't gotten it to work.

You might just have to draw the gui layer to a surface and then scale the surface.
I can certainly scale my GUI sprites, my question pertains only to text.
 
S

seanm

Guest
You can just scale the whole gui layer, and only the sprites scale?
 
C

Cole

Guest
You can just scale the whole gui layer, and only the sprites scale?
Yes. In the screen caps I uploaded, you see the text box maintained it's look and position on the screen. However, the text, which is in the same GUI code, did not.
 
S

seanm

Guest
Hmm interesting, That does actually scale both sprites and font for me.

though the correct function is window_get_width/height.

Is that your issue?
 

kupo15

Member
I think you need to just keep set the gui sizes to the native resolution regardless of your adjusted resolution
 
C

Cole

Guest
Hmm interesting, That does actually scale both sprites and font for me.

though the correct function is window_get_width/height.

Is that your issue?
Try changing the resolution before launching. If i change it after the text has loaded it works but that's now how it SHOULD work.
 

RangerX

Member
Or you go oldschool and ditch the GUI layer all together. You know we didn't have that layer before with GM8 and down. We had to learn how to do it ourselves and I still find it easier to do my HUD / GUI myself even to this day.
 
I

icuurd12b42

Guest
>>window_set_gui_size(window_width(),window_height())

That is essentially wrong.

you are supposed to call this function to set a virtual size for the gui, say set the size you designed your gui at.

If you designed your gui at 1080p then you should call
window_set_gui_size(1080,1920);

so you dont need to scale your gui images and fonts and positions, the system will scale those for you.
 
C

Cole

Guest
>>window_set_gui_size(window_width(),window_height())

That is essentially wrong.

you are supposed to call this function to set a virtual size for the gui, say set the size you designed your gui at.

If you designed your gui at 1080p then you should call
window_set_gui_size(1080,1920);

so you dont need to scale your gui images and fonts and positions, the system will scale those for you.
Thank you very much!!!!
 
Top