understand scaling and ultimate config

Hello Dave,

Thanks for your contribution!

Your method of zooming into the image to fit it into the screen is what I always wanted to achieve when approaching to content scaling/placing.

So thank you for that. I am very new to programming so I can’t evalue properly the effectiveness of your code but it looks well written to me. The background for my current project must be precisely allined with the objects it contains, so for now I’ll go with my solution since it works good, but I’ll surely keep your snippet to implement into my next project…

Thanks again!

Hi

I am also new to corona sdk and one of my major issues so far is this scaling thing. Is there no tutorial video preferably that just nails this issue out as it appears more questions been asked despite all the explanations. I am stuck with this also in my game and I have a deadline to get it to app stores, for my testing of the game, I end up just using background colors.

Please any help will be appreciated if one can provide a simple video tutorial to show how to scale or best method for portrait games on the different mobile sizes maybe separate for android and iOS.

There are a few tutorials that cover this topic including content scaling, the ultimate config.lua (which really should be replaced by) and the Modernizing the ultimate config.lua tutorials

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

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

http://coronalabs.com/blog/2010/11/20/content-scaling-made-easy/

http://coronalabs.com/blog/2012/12/04/the-ultimate-config-lua-file/

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

This should help you understand all of this.  But basically to sum things up you can either have:

a) a fixed content area (i.e. 320 x 480) knowing that 0, 0 will not likely be the top, left of the screen and display.contentWidth, display.contentHeight will likely not be the bottom, right.  Corona SDK has API’s to get the difference between 0, 0 and the top, left.  But basically on a wide device like an iPad, the left edge will be a negative value like -20.  On a tall device like an iPhone 5, the top will be at -44.  

b) use a content area that changes on a device by device basis that makes sure 0, 0 is top, left and that display.contentWidth,display.contentHeight are bottom, right.  In this case you position things relative to the center or the edge and things can move depending on the devices shape.

In both cases, your background should be big enough that it covers all devices.  If your core content area is based on 320x480, the recommended background is 360x570.  This covers most all devices.  Understanding that depending on the device some of the background will be off screen and the background must be designed around this.

Rob