positioning objects, and the modernized config.lua

Hi

I’m trying out the new “modernized config.lua” as explained here: 

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

Before, my config.lua had width=768 and height=1024 and everything I placed on screen had absolute position values such as 

bitOfText = display.newText(myGroup, "blah blah ... " , 130,250,232,0, FONT\_NAME, 60 )

Under this system, I was developing on my iPad but If I looked at this in a phone simulator it looked fine and the positioning was all the same.

Now with the new config.lua,  the positioning is completely different depending on the device I view ini the simulator. OK I get that. Would I also be right in assuming that If I use a value such as display.contentHeight - 100 , this will position differently depending on the device in question, because 100 on an iPhone is different from 100 on an iPad?

If so, is it best to express all positions not in numbers but rather completely in terms of display.contentWidth and display.contentHeight? 

thanks,

david

I don’t like to use the “modernized” config.lua exactly because of that problem. If I would have to set all objects position as a function of screen height or width, the advantage of using the config.lua decreases a lot (unless you want to use the dynamic scaling). 

My approach is to use a standard 320 x 480 config.lua and use 4 trick variables to get the correct screen extremities:

\_G.LEFT\_X = display.screenOriginX \_G.RIGHT\_X = display.contentWidth - display.screenOriginX \_G.TOP\_Y = display.screenOriginY + display.topStatusBarContentHeight \_G.BOTTOM\_Y = display.contentHeight - display.screenOriginY

Hi - can you show an example of how you would place say, a text object, using this system?

thanks

As the same way as always, just by specifying the position.

When you use only one screen configuration for the config/lua (let’s say 320x480), Corona will scale your dimensions to fir the device but depending on the device, the scale will not be perfect, so your (0,0) may no be the Top-Left position of your screen. When so, you can the variables above to access these 4 corners.

I don’t like to use the “modernized” config.lua exactly because of that problem. If I would have to set all objects position as a function of screen height or width, the advantage of using the config.lua decreases a lot (unless you want to use the dynamic scaling). 

My approach is to use a standard 320 x 480 config.lua and use 4 trick variables to get the correct screen extremities:

\_G.LEFT\_X = display.screenOriginX \_G.RIGHT\_X = display.contentWidth - display.screenOriginX \_G.TOP\_Y = display.screenOriginY + display.topStatusBarContentHeight \_G.BOTTOM\_Y = display.contentHeight - display.screenOriginY

Hi - can you show an example of how you would place say, a text object, using this system?

thanks

As the same way as always, just by specifying the position.

When you use only one screen configuration for the config/lua (let’s say 320x480), Corona will scale your dimensions to fir the device but depending on the device, the scale will not be perfect, so your (0,0) may no be the Top-Left position of your screen. When so, you can the variables above to access these 4 corners.