Landscape-only mode app - easy way of translating event.x and event.y variables?

Hello,

I’m working on an App which will only support the iPad, and only in landscape-left mode. It’s only my second day of working with Corona and I’ve already made huge progress! Amazing!

My question is: Is is possible to tell Corona, “Hey, I’m always going to be in landscape-left mode, so please adjust event.x and event.y, and all other coordinate stuff so that they make sense in that orientation.”

Thanks!

  • Bret [import]uid: 168791 topic_id: 29493 reply_id: 329493[/import]

im a newb aswell so dont bite my head off if im wrong but

edit build.settings file

it should already say something like

settings = {
orientation =
{
default = “landscapeRight”,
}
}

just change it to LEFT [import]uid: 167959 topic_id: 29493 reply_id: 118392[/import]

Hi uncaamri,

Thanks for the response! I super appreciate your helping out a fellow newbie. My config.lua is:

settings =  
{  
 orientation =  
 {  
 default = "landscapeLeft",  
 content = "landscapeLeft",  
 supported =  
 {  
 "landscapeLeft"  
 }  
 }  
}  

… but I can’t say that I see any changes. When I start the simulator, it’s still in portrait mode. The event.x and event.y from an onScreenTouch(event) call still seem like they’re assuming I’m in portrait mode, even if I rotate to landscape mode from within the simulator’s View menu.

Wait! Ah ha! I figured it out. I noticed that there was a sample app: \Sample Code\Interface\NativeOrientation

In that app, there’s the following clue:

-- Display current orientation using "system.orientation"  
-- (default orientation is determined in build.settings file)  

Putting my orientation settings in the config.lua file didn’t work, but putting them in my build.settings file did. Here’s what my final build.settings file looks like:

settings = {  
 orientation = {  
 default = "landscapeLeft",   
 supported = { "landscapeLeft" }  
 },  
  
 iphone =  
 {  
 plist =  
 {  
 CFBundleIconFile = "Icon.png",  
 CFBundleIconFiles = {  
 "Icon.png",   
 "Icon@2x.png",   
 "Icon-72.png"   
 }  
 }  
 }  
}  

I’m not sure if I need the iphone part in there or not, but the orientation solved all my problems! Woo hoo!

Thanks again uncaamri,

  • Bret [import]uid: 168791 topic_id: 29493 reply_id: 118398[/import]