hello! i have some gui in my game that i would like to be placed in the bottom-center of the screen, and in-game at my monitor’s resolution (1600x900), it looks fine -
but at 640x480 it looks like this -
at other resolutions it’s position is obviously wrong, but i chose 640x480 for some reason.
the code i’m using to draw both the text and the textbox -
When making relative UI, you need t make every argument relative. Right now you only have the position relative, but your size is constant.
Make your size relative as well and that will fix your problem.
Also, a nice tip with positioning is to use re-readablel positions. /1.85 is just a random constant, however if you wrote /37*20, which means splitting the sreen into 37 rows and going down 20. That will also make positioning other elements easier as well as making the code more readable.
Another good tip, is that currently you are doing integer division. That means you will have rounding issues and in some cases quite bad inaccuracies. I suggest (for ease), you make a temporaty float type variable to represent width and height, so that your calculations will me more accurate.