[half solved] Dynamic resolution wrong on just one device

I’ve created my sprites for an HD resolution of 1080x1920, and I’ve named those with a “@4x” suffix. The half-resolution versions have a “@2x” suffix, and the quarter-resolution versions have no suffix.

Everything works fine in the simulator with all the devices available there–e.g. original iPhone uses the no-suffix sprites, Galaxy S3 uses “@2x”, and retina iPad uses “@4x”. My old 480x800 Samsung Galaxy S uses the correct “@2x”. But my new Galaxy Note 3, with 1080x1920 screen, chooses the crappiest no-suffix sprites.

Here is my config.lua. Any idea what’s going wrong here? Thanks!

application = { content = { width = 1080, height = 1920, scale = "zoomEven", fps = "60", imageSuffix = { ["@2x"] = 0.375, ["@4x"] = 0.75, }, } }

Edit:  Further investigation revealed that any 1080x1920 device in the simulator also chose the crappy no-suffix sprites. Oddly, changing width and height to 1081x1921 in the config.lua fixed the problem. But weird hacks like that are unsatisfying–I’d like to understand why it fixed it and what the correct solution is.

Hi ericdb,

I’m no expert but I believe you may want to take another look at your config.lua.

If my knowledge is correct, any 1080x1920 device chooses the no-suffix sprites because that’s exactly what you are telling it to do. Your config.lua is looking for the screen size, if the screen size is exactly 1080x1920, it will use the no-suffix sprites. After running that code, it checks the @2x and @4x by multiplying the screen sizes by each of the numbers. So in your case, it does (1080 * 0.375 = 405) for the width of the @2x sprites and (1080 * 0.75 = 810) for the width of the @4x sprites.

You may want to read through this http://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/ and this http://docs.coronalabs.com/guide/basics/configSettings/ if you haven’t already. It will save you a lot of headaches and make scaling easier in the future.

Hope this helps!

Eric

Thanks very much for taking the time to reply, Eric!

I have reviewed the pages you linked, and it seems like I’m not understanding them properly. My understanding of the process is that Corona divides the physical screen width by the specified content width to get a scale (which should be 1.0 on my 1080x1920 device, since that’s also the size of my content). It then compares that scale with the values in the imageSuffix list, and chooses the largest one which is smaller than the scale (which should be 0.75 --> @4x here).

Clearly this isn’t exactly right, but I’m not sure which wrong assumption I’m making.

your “backwards” usage (and nothing “wrong” with doing so) just requires that you be aware that the following imageSuffix entry is always *implied*:

[""] = 1.0

so whenever scale is >= 1.0 (as on any natively >= 1080x1920 device) it will use the no-extension version. (and your choice of extensions may be “confusing” the issue, your “@4x” is really what you treat as “@1x”, your “@2x” is really what you treat as “@half”, your “” is really “@quarter”, just as an analogy)

what the docs never mention is that you can override the “” entry ALSO, for instance:

[""] = 0.1875, – use the @1x no-extension files at (just before) 1/4 resolution
["@2x"] = 0.375, – then the @2x at (just before) 1/2 content resolution
["@4x"] = 0.75, – then the @4x at (just before) 1.0 content resolution (and above, since no OTHER entry specifies a higher scale value, now that we’ve overriden “”)

fwiw, hth

Hi ericdb,

I’m no expert but I believe you may want to take another look at your config.lua.

If my knowledge is correct, any 1080x1920 device chooses the no-suffix sprites because that’s exactly what you are telling it to do. Your config.lua is looking for the screen size, if the screen size is exactly 1080x1920, it will use the no-suffix sprites. After running that code, it checks the @2x and @4x by multiplying the screen sizes by each of the numbers. So in your case, it does (1080 * 0.375 = 405) for the width of the @2x sprites and (1080 * 0.75 = 810) for the width of the @4x sprites.

You may want to read through this http://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/ and this http://docs.coronalabs.com/guide/basics/configSettings/ if you haven’t already. It will save you a lot of headaches and make scaling easier in the future.

Hope this helps!

Eric

Thanks very much for taking the time to reply, Eric!

I have reviewed the pages you linked, and it seems like I’m not understanding them properly. My understanding of the process is that Corona divides the physical screen width by the specified content width to get a scale (which should be 1.0 on my 1080x1920 device, since that’s also the size of my content). It then compares that scale with the values in the imageSuffix list, and chooses the largest one which is smaller than the scale (which should be 0.75 --> @4x here).

Clearly this isn’t exactly right, but I’m not sure which wrong assumption I’m making.

your “backwards” usage (and nothing “wrong” with doing so) just requires that you be aware that the following imageSuffix entry is always *implied*:

[""] = 1.0

so whenever scale is >= 1.0 (as on any natively >= 1080x1920 device) it will use the no-extension version. (and your choice of extensions may be “confusing” the issue, your “@4x” is really what you treat as “@1x”, your “@2x” is really what you treat as “@half”, your “” is really “@quarter”, just as an analogy)

what the docs never mention is that you can override the “” entry ALSO, for instance:

[""] = 0.1875, – use the @1x no-extension files at (just before) 1/4 resolution
["@2x"] = 0.375, – then the @2x at (just before) 1/2 content resolution
["@4x"] = 0.75, – then the @4x at (just before) 1.0 content resolution (and above, since no OTHER entry specifies a higher scale value, now that we’ve overriden “”)

fwiw, hth