Trying to force Landscape mode in Simulator

build.settings:

settings =  
{  
 orientation =  
 {  
 default = "landscapeRight",  
 supported =  
 {  
 "landscapeLeft", "landscapeRight",  
 },  
 },  
  
 iphone =  
 {  
 plist =  
 {  
 UIInterfaceOrientation = "landscapeRight",  
  
 UISupportedInterfaceOrientations =  
 {  
 "landscapeRight",  
 "landscapeLeft",  
 },  
 CFBundleIconFile = "Icon.png",  
 CFBundleIconFiles = {  
 "Icon.png" ,  
 "Icon@2x.png" ,  
 "Icon-72.png" ,  
 "Icon-Small-50.png" ,  
 "Icon-Small.png" ,  
 "Icon-Small@2x.png"  
 },  
 CFBundleDisplayName = "SVG Test",  
 UIPrerenderedIcon = true,  
 UIStatusBarHidden = true,  
 UIApplicationExitsOnSuspend = true,  
  
 },  
  
 },  
  
}  
if system.getInfo("platformName") == "Android" then  
 application =  
 {  
 content =  
 {  
 --zoom  
 width = 480,  
 height = 320,  
 scale = "letterbox"  
 },  
 }  
elseif system.getInfo("model") ~= "iPad" then   
   
 application =  
 {  
 content =  
 {  
 --zoom  
 width = 480,  
 height = 320,  
 scale = "zoomEven"  
 },  
 }   
settings.iphone.plist["UIInterfaceOrientation~ipad"] = "UIInterfaceOrientationlandscapeRight"  
settings.iphone.plist["UISupportedInterfaceOrientations~ipad"] =  
{  
 "UIInterfaceOrientationlandscapeRight",  
 "UIInterfaceOrientationlandscapeLeft"  
}  
end  

I probably only need one of those orientation settings but I’ve found them all around the forum and none seem to force the simulator into Landscape mode. Any clues?

config.lua

[code]
application =
{
content =
{
width = 480,
height = 320,
scale = “Letterbox”,
fps = 60,
antialias = false,

imageSuffix =
{
["@2x"] = 2,
},
},
}
[/code] [import]uid: 10389 topic_id: 14935 reply_id: 314935[/import]

If you remove everything from “if system.getInfo” and beyond it forces landscape in the simulator, although I’m guessing you want a way to leave it all in and still for landscape, yes? [import]uid: 52491 topic_id: 14935 reply_id: 55175[/import]

I’d like the Simulator to go landscape and the iphone and ipad if possible :slight_smile: [import]uid: 10389 topic_id: 14935 reply_id: 55180[/import]

I commented out

--[[ elseif system.getInfo("model") ~= "iPad" then  
...  
--]]  
end  

still same portrait in Simulator. [import]uid: 10389 topic_id: 14935 reply_id: 55181[/import]

This will force landscape in simulator, just this part of your code;

[lua]settings =
{
orientation =
{
default = “landscapeRight”,
supported =
{
“landscapeLeft”, “landscapeRight”,
},
},

iphone =
{
plist =
{
UIInterfaceOrientation = “landscapeRight”,

UISupportedInterfaceOrientations =
{
“landscapeRight”,
“landscapeLeft”,
},
CFBundleIconFile = “Icon.png”,
CFBundleIconFiles = {
“Icon.png” ,
“Icon@2x.png” ,
“Icon-72.png” ,
“Icon-Small-50.png” ,
“Icon-Small.png” ,
“Icon-Small@2x.png”
},
CFBundleDisplayName = “SVG Test”,
UIPrerenderedIcon = true,
UIStatusBarHidden = true,
UIApplicationExitsOnSuspend = true,

},

},

}[/lua]

Does that help? Obviously final build you’ll need your Android specific stuff and whatnot but that above code should work for forcing landscape in all the simulated devices. [import]uid: 52491 topic_id: 14935 reply_id: 55292[/import]

So I have to remove device stuff to get the Simulator to work? [import]uid: 10389 topic_id: 14935 reply_id: 55298[/import]

Thanks!
That seems to have worked. [import]uid: 10389 topic_id: 14935 reply_id: 55420[/import]

I used to different builds (2011.243 & 2011.715)

just a word of warning - i used the above mentioned code(by PEACH)
to force my SIMULATOR to FORCE into LANDSCAPE mode. it works

BUT…

when I place the game in DEBUG mode (physics.setDrawMode( “debug” ))
my display objects lines respect my FORCED LANDSCAPE mode

HOWEVER when I use the NORMAL mode (physics.setDrawMode( “normal” ))
my display objects lines use the PORTRAIT Mode. Even though it is forced “turned”
to landscape mode in the settings.lua file.

Just wondering if there is a BLOG entry that someone has has demystified the settings.lua
and config.lua files.

How could one go about “seeing” what is exposed in these files(settings & config) ?

Is there a magic global LUA table that we could access for this ?

And I am not trying to knock anyone’s CODE, just mentioning what Ive experienced.
[import]uid: 11094 topic_id: 14935 reply_id: 77786[/import]

Troy can you provide a sample?

That code should not cause any issues - it’s standard - if it is it means there is likely a bug we need to squash.

We do have some docs on build.settings and config.lua however they reflect the above.

Peach [import]uid: 52491 topic_id: 14935 reply_id: 77982[/import]

it seems that i used the display.contentwidth and display.contentheight as two global variables _G & _H

then when i used the above build.settings file it displayed the simulator in landscape.

but when i used the debug display mode it reflects “portrait” settings.

but then when i use the normal display mode it reflects “landscape” settings.

as soon as i get home, i will post the exact code.

[import]uid: 11094 topic_id: 14935 reply_id: 78090[/import]

here is the main code -

\_H = display.contentHeight  
\_W = display.contentWidth  
letSize = 32  
letRadius = 3  
frameOffset = 100  
  
display.setStatusBar( display.HiddenStatusBar ) -- hide the status bar  
  
local physics = require( "physics" )  
physics.start( true ) -- prevent all bodies from sleeping  
--physics.start( false ) -- default behavior; bodies may sleep  
physics.setDrawMode( "debug" ) -- shows collision engine outlines only  
--physics.setDrawMode( "hybrid" ) -- overlays collision outlines on normal Corona objects  
--physics.setDrawMode( "normal" ) -- the default Corona renderer, with no collision outline  
  
local bottom = display.newLine( 2, \_H, \_W, \_H )  
bottom.width = 5  
bottom.myName = "bottom"  
bottom:setColor( 255, 102, 102, 255 )  
physics.addBody( bottom, "static", { friction=0.5, bounce=0.3 } )  
  
local line = display.newLine( 150, \_H - 50, \_W - 150, \_H - 50)  
line.width = 5  
line.myName = "line"  
line:setColor( 255, 102, 102, 255 )  
physics.addBody( line, "static", { friction=0.5, bounce=0.3 } )  
   
local letA = display.newText("", 30, 30, native.systemFont, 0)  
letA:setTextColor(170, 170, 170)  
letA.text = "A"  
letA.myName = "A"  
letA.size = letSize  
physics.addBody( letA, "dynamic", { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius } )  
  
local letB = display.newText("", 70, 30, native.systemFont, 0)  
letB:setTextColor(170, 170, 170)  
letB.text = "B"  
letB.myName = "B"  
letB.size = letSize  
physics.addBody( letB, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )  
  
local letC = display.newText("", 110, 30, native.systemFont, 0)  
letC:setTextColor(170, 170, 170)  
letC.text = "C"  
letC.myName = "C"  
letC.size = letSize  
physics.addBody( letC, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )  
  
local letD = display.newText("", 150, 30, native.systemFont, 0)  
letD:setTextColor(170, 170, 170)  
letD.text = "D"  
letD.myName = "D"  
letD.size = letSize   
physics.addBody( letD, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )  
  
local letE = display.newText("", 190, 30, native.systemFont, 0)  
letE:setTextColor(170, 170, 170)  
letE.text = "E"  
letE.myName = "E"  
letE.size = letSize  
physics.addBody( letE, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )  
  
local letF = display.newText("", 230, 30, native.systemFont, 0)  
letF:setTextColor(170, 170, 170)  
letF.text = "F"  
letF.myName = "F"  
letF.size = letSize  
physics.addBody( letF, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )  
   
local function onLocalCollision( self, event )  
 if ( event.phase == "began" ) then  
-- print( self.myName .. ": collision began with " .. event.other.myName )  
 elseif ( event.phase == "ended" ) then  
-- print( self.myName .. ": collision ended with " .. event.other.myName )  
 end  
end   

here is the build.settings code -

settings =  
{  
 orientation =  
 {  
 default = "landscapeRight",  
 supported =  
 {  
 "landscapeLeft", "landscapeRight",  
 },  
 },  
   
 iphone =  
 {  
 plist =  
 {  
 UIInterfaceOrientation = "landscapeRight",  
   
 UISupportedInterfaceOrientations =  
 {  
 "landscapeRight",  
 "landscapeLeft",  
 },  
 CFBundleIconFile = "Icon.png",  
 CFBundleIconFiles = {  
 "Icon.png" ,  
 "Icon@2x.png" ,  
 "Icon-72.png" ,  
 "Icon-Small-50.png" ,  
 "Icon-Small.png" ,  
 "Icon-Small@2x.png"  
 },  
 CFBundleDisplayName = "SVG Test",  
 UIPrerenderedIcon = true,  
 UIStatusBarHidden = true,  
 UIApplicationExitsOnSuspend = true,  
   
 },  
   
 },  
   
}  

now take turns commenting out the debug drawmode and then normal drawmode.

example,

first
physics.setDrawMode( “debug” )
–physics.setDrawMode( “normal” )

second
–physics.setDrawMode( “debug” )
physics.setDrawMode( “normal” )
You will notice that in DEBUG draw mode the lines extend to left side of screen.

Where as,

you will notice that in normal draw mode the lines adhere to the coordinates in the display.newline code.

I think the debug mode is ignoring my global _W & _H variables that I have setup
to determine content width & height(see top two lines of code).
[import]uid: 11094 topic_id: 14935 reply_id: 78127[/import]

Can you file this please Troy? :slight_smile: [import]uid: 52491 topic_id: 14935 reply_id: 78238[/import]