Hey @reefwing thanks for the heads up. The Xcode side is a kicker for me. Too complex. The good news is that the code I wrote in Lua works perfect with even one additional side effect.
So the problem I had was I had hard coded the pixel values in my first engine which meant everything was twice as big on screen on the iPhone and also just bottom left corner visible.
I had hoped that scaling the whole game worked automatically like in flash when you build an animation inside a clip, you can place the clip on the stage and scale it and everything inside scales perfectly including code. But it didn’t and people had excellent suggestions in terms of how to rebuild the engine (or rather the maths part) to work with width and height percentages.
Well in Lua that worked and also when I compiled the Xcode and ran it it worked. I did have one Xcode glitch but that was because I had a number in a sprite name and Xcode thought lua was trying to pass that number with the image. A quick rename in file and code and it worked well.
Now to the interesting side effect of my scaling technique.
So if you recall I’ve created two variables:
scalerX = WIDTH/100
scalerY = HEIGHT/100
This gives me a percentage of the screen width and height that it can use to set object x position and width with scalerX and applying a multiplier like *10 giving me 10 percent of the width to use as either a placement of x or width of objects,
It works really well and I’ve based my game design and math around an iPhone 4 at 320x480 pixels or points. I’m not playing a landscape game but I could work that out easily too using the same code and a rotation.
The advantage if working 320x480 is that it is the middle ratio of size between the iPad (wider by about 10 or 15% and also between the iPhone 5 which is about 10 or 15% taller.
So both screens stretch a little. The iPad is fatter and the iPhone 5 is taller images.
And the iPhone 4 is just right.
The side effect is all my maths is done on the scalerX and ScalerY positions and divisions.
So if my iPhone 5 is taller and I can detect the height as in your code @reefwing I could set the scalerY = height/110 instead of 100 for just iphone 5 displays to make it slightly shorter and all the maths for position scales down with it. For iPad I scale the height to be /90 which makes it a little taller. That way all graphics are set to look as square as they were intended too and I don’t have to recode all my measurements for every little thing.
As my pixel graphics are 1 pixel drawn they scale up lovely.
Make sense?