Have you tried this mathematical formula to change the range of a number?
And also instead of storing this:
x, y, width, height
433, 343, 1257, 959
331, 823, 1257, 959
You could store it normalized between 0
and 1
so it works for any width/height
(calculated by dividing each x
by its width
and each y
by its height
):
x, y
0.344, 0.357
0.263, 0.858
Then you don’t need to know the width/height
you used when you stored them, and when you want to translate them to the size of the current screen you just multiply each one by the current width/height