Happy Christmas to anyone reading!
I always get concerned when my arithmetic fails me. Often it is my brain not working but sometimes I go over and over the logic but still don’t get the result I want.
Here is my problem.
I have an app which is set in config.lua (based on Rob’s ultimate config) to be 768x1024, but in practice the app is locked to landscape of 1024x768.
The scaling is set to letterbox.
I use a magic background that bleeds beyond the iPad limits to create a more pleasant background than the default black bars in other, wider devices. At present the backrground graphic is set as 1400x900, which works fine for covering all of the devices IOS and Android.
I have been working on adding a nice fly-in Overlay that comes in about half way and still shows the main background and retracts once choices have been made.
On the Ipad/Ipad2 this is all fine, but on wider devices I cannot find the formula for setting the x,y coordinates of the overlay graphic that will fly into the edge of the screen. In most cases the overlay overshoots by some way the width of the screen.
My current logic sets the background at display.contentWidth/2,display.contentHeight/2 this works great for the main graphic.
For the overlay graphic (which is 540 wide by 900 high) I set it to 270 (ie 1/2 the overlay width) as x and display.contentHeight/2 for height. This by my arithmetic should set the overlay on the edge on all machines, but in fact it overshoots by quite a way.
I suspect it is something to do with difference between the screen as seen with Letterbox (which is the 1024x768) and the display.contentWidth that somehow counts the wider area beyond the letterbox.
Any ideas?
Martin