KINGTUT10101 wrote: ↑25 Jun 2020, 08:35
The building info box isn't what I need, unfortunately. Thanks for the help though.
You probably use fixed values such as
Code: Select all
Drawing.drawText("Hello Lua!", 20, 70)
This won't accommodate for resolution changes. Now, first we have to understand that
x = 0 is the left edge of the screen and
y = 0 is the top edge making
x, y = 0, 0 the top left corner of your phone. So the x value is relative to the left edge and the y value is relative to the top edge so if we change the resolution the text would go up. Let's say you had a screen resolution of 500x500px and put your y value as 100 now, you increase the resolution to 1000x1000px your text would still be 100px from the top edge but now there's 500 more pixels below making it look like it shifted upwards. So what's the solution?
To make the y value relative to the bottom of the screen!
Lua:
Code: Select all
local _, height = Drawing.getSize()
Drawing.drawText("Hello Lua!", 20, height - 70)
This will make the text always 70px above the bottom edge so resolution changes wont affect the text anymore. Think of it as TheoTown pulling the bottom screen downwards and you attached a helium balloon to the bottom of the screen. No matter how hard you pull the screen up or down the balloon will always float to the length of the string (in this case 70).
I hope this helped!
bear out!