Modernizing the config file LANDSCAPE MODE

The config file in the article:

https://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

is for “Portrait” Mode

--calculate the aspect ratio of the device local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 800 or math.ceil( 1200 / aspectRatio ), height = aspectRatio \< 1.5 and 1200 or math.ceil( 800 \* aspectRatio ), scale = "letterBox", fps = 30, imageSuffix = { ["@2x"] = 1.3, }, }, }

But what would it look like in “Landscape” mode?  Like below? Would you need to reverse the greater then and less then signs? Would you need to change anything else ?

local aspectRatio = display.pixelHeight / display.pixelWidth application = { &nbsp;&nbsp; content = { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --width = aspectRatio \> 1.5 and 800 or math.ceil( 1200 / aspectRatio ),--PORTRAIT MODE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --height = aspectRatio \< 1.5 and 1200 or math.ceil( 800 \* aspectRatio ),--PORTRAIT MODE &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = aspectRatio \< 1.5 and 1200 or math.ceil( 800 / aspectRatio ),--LANDSCAPE MODE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height = aspectRatio \> 1.5 and 800 or math.ceil( 1200 \* aspectRatio ),--LANDSCAPE MODE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scale = "letterBox", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fps = 60, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; imageSuffix = { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ["@2x"] = 1.3, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }, &nbsp;&nbsp; }, }

Hi @burnsj002,

I think there’s a slight misunderstanding here. The content area is always regarded in the context of “portrait”, even for landscape-oriented apps. In other words, “width” should always be lower than “height” because there are no purely square devices. The orientation of the app is controlled separately via the build settings.

Brent

but I’m kind of confused about this in the Video tutorial about content area

https://www.youtube.com/watch?v=RwVlzJtQWd8

He says width and height values are always defined in respect to the “portrait” orientation – even if your making your game in Landscape mode… so would you really need to change the Modernizing config file at all if your game is landscape orientation??

Thanks Brent, I think if its always defined in respect “portrait” orientation I shouldn’t change anything in the modernizing config file :slight_smile:

This is rather simple.  When working with config.lua completely take orientation out of your mind.  Width is the smallest/shortest value.  Height is the largest/longest value.  There should be no discussion on landscape at all.  Hold your phone/tablet so that it’s in portrait orientation and use those values.

Rob

Hi @burnsj002,

I think there’s a slight misunderstanding here. The content area is always regarded in the context of “portrait”, even for landscape-oriented apps. In other words, “width” should always be lower than “height” because there are no purely square devices. The orientation of the app is controlled separately via the build settings.

Brent

but I’m kind of confused about this in the Video tutorial about content area

https://www.youtube.com/watch?v=RwVlzJtQWd8

He says width and height values are always defined in respect to the “portrait” orientation – even if your making your game in Landscape mode… so would you really need to change the Modernizing config file at all if your game is landscape orientation??

Thanks Brent, I think if its always defined in respect “portrait” orientation I shouldn’t change anything in the modernizing config file :slight_smile:

This is rather simple.  When working with config.lua completely take orientation out of your mind.  Width is the smallest/shortest value.  Height is the largest/longest value.  There should be no discussion on landscape at all.  Hold your phone/tablet so that it’s in portrait orientation and use those values.

Rob