Hi All,
I’m fairly new to Corona and have been struggling putting together a framework to use one codebase deploying across multiple devices without having to worry about scaling etc.
I’ve read various articles and blog entries on the subject which has got me 99% of the way there but I’ve come across something I’d like some advice on if possible.
At present I have my config.lua setup as follows :-
[code]-- Graphic Asset Sizes (landscape)
– 380 x 570 - (@x1)
– 720 x 1140 - (@x2)
– 1440 x 2280 - (@x4)
application =
{
content =
{
width = 320,
height = 480,
scale = “letterbox”,
xAlign = “center”,
yAlign = “center”,
imageSuffix =
{
– @x1 = iPhone 3GS
["@x2"] = 2, – @x2 = iPhone 4 and iPad
["@x4"] = 4, – @x4 = iPad 3
},
},
}[/code]
As you can see in the comments my actual graphic asset sizes are slightly larger then then content area. That combined when using letterbox scaling allows corona to use a little bleed in the graphics to stop black bands appearing on certain devices which is great. Also, the dynamic resolution feature works great and makes good use of texture memory and so on.
The little problem I have is that this…
From what I can work out my apps should be using the abstracted co-ordinate space of 480 x 320 (based on my config.lua and in landscape) as corona will perform all the required scaling and so on. This is fine if you want to place elements directly onto the screen. The issue come when I want to have image ‘slide’ in from the edge of the screen uniformly across multiple devices. Using the config.lua above on the iPad (for instance) leaves me with a small amount of ‘bleed’ at the top and bottom on the screen (when viewed in landscape). So if I use the abstracted co-ordinate space things will ‘pop’ into view then slide up to where they should be. I found this snippet in another post…
screenWidth = display.contentWidth - (display.screenOriginX\*2)
screenHeight = display.contentHeight - (display.screenOriginY\*2)
screenTop = display.screenOriginY
screenRight = display.contentWidth - display.screenOriginX
screenBottom = display.contentHeight - display.screenOriginY
screenLeft = display.screenOriginX
screenCentreX = display.contentWidth/2
screenCentreY = display.contentHeight/2
…when using the variables above allows me to position relative to the physical screen edge so seems to be a solution. I just wondered how people are tackling this as I would imagine it to be fairly common? Something that will work with other parts of the framework like physics, collisions etc etc in-case I need them at any point as well would be ideal. I’m not sure what other references corona has internally to the abstracted 480 x 320…
Please excuse any ignorance in the above as I’ve absorbed quite a few concepts quickly so might be approaching things completely incorrect!
Many thanks for any help!
Pete [import]uid: 14043 topic_id: 24236 reply_id: 324236[/import]