I already downloaded and will use @XeduR’s code
But i would like to share with you a few information that might help in understanding some of the complexity in here
The first thing that you should know is whatever scale
you chose in config.lua
will affect everything else
Personally I always use letterBox
for my apps (I make apps more than I make games)
If you set your app to letterBox
with #### width and #### height you are telling the compiler or interpreter or phone or whatever is doing the job that whatever screen or phone being used that it must be considered as the width or height you set, no matter what the actual resolution of the phone was
and now it gets tricky.
let’s say you set the width and height to be 1080X1920
and you use a phone that is actually 1080X1920 then this is your lucky day
specially if the phone has all zero values returned by display.getSafeAreaInsets()
In this case the app or game will look exactly on the phone as the simulator
and now most phones don’t return zeros those days
And what are those values?
virtual back buttons at the bottom, camera lens in the middle of the screen … and don’t forget the setStatusBar
… you name it!
so what happens if you run your app on iPhoneX … width will be as whatever you set, but height will be much larger … and all of this because you used letterBox
How to fix it?
don’t say:
object.y = display.contentHeight-object.height*0.5 -50
But say whatever is in Xedure’s code which will add the values of those parameters which will vary based on phone being used
but don’t expect the app to look exactly the same on all phones … because for example a scrollview object will be larger in height, and will show more icons without scrolling as soon as the app starts … but the button beneath it will always be as far from the scrollview on all phones if you know how to position it
So NEVER HARD CODE ANYTHING
Why would anyone then use letterBox?
What happens if we don’t use letterbox?
All images that you worked hard for will be stretched and the app or game will look funny … UNLESS by accident the phone being used matched the resolution you set in config.lua
I hope i’m not complicating things … but it is indeed complicated by nature
You cannot just fit an image dimensioned as 500X1000 in a frame dimensioned as 600X1000 in real life and actual life
But you can easily fit it in 1000X2000 or 250X500 without having to change how it looks