Modernizing the config.lua - Rob Miracle article

In that case, you may wish to add another suffix and calculate the “range” that it should cover. Maybe name it “-legacy” or something: “myImage-legacy.png”, “background-legacy.png”, etc.

@piotrz55, I think most people would rationally want to support the widest range of devices possible, but there comes a time when  you have to cut the cord on older technology to move forward.  For example in the web development world, many people felt they had to support IE 6 (there are some holdouts today…) but after a few brave folks decided to drop support, more and more followed suit when the found that it really didn’t impact them and by loosing support for something old, they were able to move their website’s forward… a lot…  Today even  IE7 is rarely supported and many shops are dropping support for IE8.   It seems when you get to the 1%-5% market,  it’s time to sever the old technology.

If you think about it in terms purely of content area and you want to hold on to the 320x480 grid, that means that on a retina iPhone when you move something by one point you’re actually moving it 2 pixels.   In otherwords with a content area of 320x480 and player.x = 10, it’s really 20 pixels to the right of the left edge.  When you do player.x = player.x + 1, Corona has to compute that and make it a 2 pixel move.  Now scale this to a retina iPad.  It becomes x = x + 4.  That player.x = 10 is really at pixel 40.  That 60 fps smooth animation you want is held back because everything moves by 4 pixels at a time on retina iPads and other HD devices. 

But the beauty of this is it’s  your choice.  You can stick with 320x480 and 3 different sized graphics if you want.  It’s not wrong by any stretch of the imagination.

Dear Corona Labs,

can you tell me, if content area do not map 1:1 to physical pixels then what to do with vector objects?!.

If I draw newLine, then if Corona will determine that scaling < 1 then line do not appear on screen at all (if width is 1) or is thinier!!!

Hi @piotrz55,

Yes, this would probably occur if you use a config like 800x1200 and then run on a device like iPhone3GS and try to display a newLine that’s 1 pixel thick. I guess the “workaround” would be to display a line 2 or more pixels thick. :slight_smile:  Or, use the low-to-high method, if that’s preferable to you (smaller content area, and let Corona work up).

Best regards,

Brent

Or, use the low-to-high method, if that’s preferable to you (smaller content area, and let Corona work up)

How to set it up?

Yes, this would probably occur if you use a config like 800x1200 and then run on a device like iPhone3GS and try to display a newLine that’s 1 pixel thick.

Not only devices but simulator too

 I guess the “workaround” would be to display a line 2 or more pixels thick.

It won’t help. I wanted to display grid. I made both vertiacal and horizontal ones 3px width. Effect is one are thicker other one thiner.

If there is no other way then for vectors this config is bad way unfortunately :frowning:

Hi @piotrz55,

I see your point, and I think it may be an inherent issue with laying out a grid, even if you use the low-to-high method. For example, if you start with 320x480 (the old suggested size) and do 1 pixel lines, the grid will probably look odd on some devices that don’t scale up at an even 2x or 4x factor (and that would happen frequently, since there are so many devices of so many sizes). The thin lines may become “2.5” pixels, or “4.5” or whatever.

I suppose you could gather the actual screen size of the device and show different size lines on each, but that may still not work as expected.

Brent

I suppose you could gather the actual screen size of the device and show different size lines on each, but that may still not work as expected.

But there is difference for vertical and horizontal ones. Let’s say both are 3px. Then fvertiacal appears as 2px and horizontal as 1px wide.

For example, if you start with 320x480 (the old suggested size) and do 1 pixel lines, the grid will probably look odd on some devices

I was using such config before and all lines were the same width, but now vertical and horizontal ones differ

Hmmm, that’s odd. And you’re not using “zoomStretch” scale mode or something? What is your content width and height, and what device is this occurring on?

If you still need to support a lower resolution screen, it may be best to keep your core content area close the base size you intend to support.

Haven’t checked for lower resolution - found this issue today. I use Galaxy S3 and have problem with thin lines. My config file is as in article, 800x1200 option

Hi @piotrz55,

Just to bump my previous question, are you by chance using “zoomStretch” for the scale mode?

Nope, just copy paste from Rob’s tutorial

@Rob, if  the config.lua is presented in “Portrait” mode… then what should  the config file look like in “Landscape” mode. Would you switch the width and height like this:

application = { &nbsp;&nbsp; content = { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --width = aspectRatio \> 1.5 and 800 or math.ceil( 1200 / aspectRatio ), --POTRIAT MODE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --height = aspectRatio \< 1.5 and 1200 or math.ceil( 800 \* aspectRatio ),--POTRIAT 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; }, &nbsp; }

I’ve been using the modernizing config file in my “Landscape” mode app I didn’t realize it was “Portrait” mode. So my question, how do you make the modernizing config file “Landscape” mode??

As far as config.lua is concerned, there is no such thing as landscape.  The width is always the shortest dimension, height is the longest. 

Rob

@Rob, Yea I got confused by your above post

“Keep in mind, the config.lua is presented in “Portrait” mode.”

So - panicked and thought I’m using" Landscape" mode! Lolz.

fwiw, i would suggest replacing the calls to math.ceil() with math.floor() instead, if you want to preserve the specified dimension exactly as the “fit” axis, and force the other (calculated) axis to be the letterboxed one.  (rIght now, it actually does the opposite, except in those cases where no fractional coordinates would occur at all, like 4:3 aspect, where choice of floor/ceil makes no difference)

That is, say on a 16:9 aspect device (say 1920x1080), if you set width to a fixed 800, then calculate height using math.ceil() you’ll get that 1423 value.  But that’s a fraction of a pixel too much to actually fit that height into the display’s aspect ratio at the same scale as 800 would fit width.  So scale will be slightly reduced so as to fit the larger height instead, and your width will end up a tiny bit letterboxed.  (about 800-and-a-half pixels) if you check display.actualContentWidth afterwards.

Which seems like the opposite result you were going for.  (you didn’t preserve your specified 800 width)

If you use math.floor(), then you’ll instead request a height of 1422, which will be just a tad too short, (which is what you’d want, in order to guarantee which axis fits, and which axis letterboxes),  so letterboxing will fit width instead (which is what you apparently desired, using that fixed 800 value).  Then upon reading display.actualContentHeight later you’ll find your 1422.2222 fractional height as “proof” that all went according to plan. (and actualContentWidth will be your specified 800.0)

These are good suggesting Dave.  I’ve updated the tutorial to reflect them.  How to fix the 4 zillion config.lua’s out there :slight_smile:

Rob

@Rob, if  the config.lua is presented in “Portrait” mode… then what should  the config file look like in “Landscape” mode. Would you switch the width and height like this:

application = { &nbsp;&nbsp; content = { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --width = aspectRatio \> 1.5 and 800 or math.ceil( 1200 / aspectRatio ), --POTRIAT MODE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --height = aspectRatio \< 1.5 and 1200 or math.ceil( 800 \* aspectRatio ),--POTRIAT 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; }, &nbsp; }

I’ve been using the modernizing config file in my “Landscape” mode app I didn’t realize it was “Portrait” mode. So my question, how do you make the modernizing config file “Landscape” mode??

As far as config.lua is concerned, there is no such thing as landscape.  The width is always the shortest dimension, height is the longest. 

Rob