Dynamic config.lua to fit screen

I’ve seen a number of “ultimate config.lua” files out there and I have a question to which I don’t know the answer because we haven’t launched anything yet. If we want the app to fit every screen and resolution, can’t we just set the config.lua up as follows:

application = { content = { width = display.pixelWidth, height = display.pixelHeight, -- all other options needed } }

It doesn’t create any errors in the simulator, but I can’t imagine I’m the first to think of this. Any reason NOT to do this or why it wouldn’t work in a live app?

You would be lucky if your app still looked good getting stretched and shrunk to accommodate every dimension in the iOS/Android matrix. Most apps will be squashed and pulled to look like silly puddy. If yours is working, you can check that off your development roadmap!

But if you set the scaling to zoomEven and the content width and height to match the device width and height, why would anything get squished or stretched? Aren’t we basically then setting the width, height, and zoom = 1 so that nothing would get stretched or squished?

I’m not seeing any squishing or stretching in the simulator, but again - this is all in the test environment.

Or along those lines, what about just setting the width to 320 and the height to ( 320 * ( display.pixelHeight / display.pixelWidth ) )?

Using the below:

application = { content = { width = display.pixelWidth, height = display.pixelHeight, scale=zoomEven } }

Makes my app go screwy in the simulator. If it works well for you, that is fantastic. Hopefully others will find this to be the best solution for them too, but I can say that, at least for me, it is not a magic bullet.

You may be interested in the discussion on this thread: http://forums.coronalabs.com/topic/37362-improvement-to-the-ultimate-configlua-file/. I use the approach I describe there and it makes it very simple. - Andrew

You would be lucky if your app still looked good getting stretched and shrunk to accommodate every dimension in the iOS/Android matrix. Most apps will be squashed and pulled to look like silly puddy. If yours is working, you can check that off your development roadmap!

But if you set the scaling to zoomEven and the content width and height to match the device width and height, why would anything get squished or stretched? Aren’t we basically then setting the width, height, and zoom = 1 so that nothing would get stretched or squished?

I’m not seeing any squishing or stretching in the simulator, but again - this is all in the test environment.

Or along those lines, what about just setting the width to 320 and the height to ( 320 * ( display.pixelHeight / display.pixelWidth ) )?

Using the below:

application = { content = { width = display.pixelWidth, height = display.pixelHeight, scale=zoomEven } }

Makes my app go screwy in the simulator. If it works well for you, that is fantastic. Hopefully others will find this to be the best solution for them too, but I can say that, at least for me, it is not a magic bullet.

You may be interested in the discussion on this thread: http://forums.coronalabs.com/topic/37362-improvement-to-the-ultimate-configlua-file/. I use the approach I describe there and it makes it very simple. - Andrew