Force Landscape or Portrait mode in game

Hello Corona Community!

I have a unique situation where I would like to force my scene1.lua to be in portrait and force my scene2.lua to be in landscape. Is there a way to do this with Corona?

My build.settings currently looks like this, but I’m guessing I have to do something inside the scene.

[code]
settings = {

orientation = {
default = “landscapeLeft”,
supported =
{
“portrait”, “landscapeLeft”
},
}
}
[/code] [import]uid: 14218 topic_id: 33295 reply_id: 333295[/import]

Hi Daniel,

I’m not aware of any way to do that just by using settings. You’ll have to manage it in the code itself. One idea could be to set up your app settings to run only in landscape, and for your portrait scene, you’ll just have to rotate and place your images properly so that it looks like it’s in portrait. (Of course, the OS will still think it’s running in landscape, so things like native alerts and native input fields would still appear in landscape, but if you’re not using them in your portrait scene, that shouldn’t matter.)

  • Andrew [import]uid: 109711 topic_id: 33295 reply_id: 132292[/import]

Thanks Andrew, I was hoping for an easier solution, but this will work. Thank you! [import]uid: 14218 topic_id: 33295 reply_id: 132312[/import]

Hi Daniel,

I’m not aware of any way to do that just by using settings. You’ll have to manage it in the code itself. One idea could be to set up your app settings to run only in landscape, and for your portrait scene, you’ll just have to rotate and place your images properly so that it looks like it’s in portrait. (Of course, the OS will still think it’s running in landscape, so things like native alerts and native input fields would still appear in landscape, but if you’re not using them in your portrait scene, that shouldn’t matter.)

  • Andrew [import]uid: 109711 topic_id: 33295 reply_id: 132292[/import]

Thanks Andrew, I was hoping for an easier solution, but this will work. Thank you! [import]uid: 14218 topic_id: 33295 reply_id: 132312[/import]