If your app is not locked into either Portrait or Horizontal position I would think that display.contentWidth and display.contentHeight would change based on orientation. I’ve not tested it, but this would seem to be rational behavior.
Then you could do:
[lua]
if display.contentWidth > display.contentHeight then
I have also stuck a runTime event listener is each scene checking for orientation.
Pity you can’t have global listener functions (or maybe you can and I don’t know it). At the moment if there is something I want to change when the orientation changes, I have to go into every scene and change the listener.
I am using something simular at the moment. What I was saying though is I have that function in every scene, be great if I only needed to stick it in one place though. That is the only downside to Storyboard, before Storyboard where my whole game was in main.lua I could have just put that function in once. Dave
Just so you know, if you want to do this on Android tablets running Android 4.0+, you will have problems when the device orientation changes as the navbar at the bottom of the screen causes the screen to be incorrectly sized:
If your app is not locked into either Portrait or Horizontal position I would think that display.contentWidth and display.contentHeight would change based on orientation. I’ve not tested it, but this would seem to be rational behavior.
Then you could do:
[lua]
if display.contentWidth > display.contentHeight then
I have also stuck a runTime event listener is each scene checking for orientation.
Pity you can’t have global listener functions (or maybe you can and I don’t know it). At the moment if there is something I want to change when the orientation changes, I have to go into every scene and change the listener.
I am using something simular at the moment. What I was saying though is I have that function in every scene, be great if I only needed to stick it in one place though. That is the only downside to Storyboard, before Storyboard where my whole game was in main.lua I could have just put that function in once. Dave
Just so you know, if you want to do this on Android tablets running Android 4.0+, you will have problems when the device orientation changes as the navbar at the bottom of the screen causes the screen to be incorrectly sized: