Dynamic Content Scaling limbo

Sheesh, dynamic content scaling, fresh on my to-do list, looks like a can of worms.

Is there a simple way of doing the following:

Do a check on startup - or have Corona do this automatically - to see wether the canvas of the device is closest to 320 x 480 or 400 x 800, and based on that to use different code and assets - and thus skip a lot of the trouble involved?

Sort of like putting 2 size in the configs (320 x 480 and 640 x 960) as possible virtual screen sizes, having Corona pick the closest match and scaling, and then having something like this in main.lua:

if content.width == 320 then
SmallSizeGameStart()
elseif content.width == 640 then
BigSizeGameStart()
end

That would make things a lot easier for me to start…

Thanks!
Thomas [import]uid: 70134 topic_id: 15385 reply_id: 315385[/import]

read this:
http://blog.anscamobile.com/2011/01/dynamic-image-resolution-made-easy/ [import]uid: 13632 topic_id: 15385 reply_id: 56850[/import]

That is one resolution to the issue, that will take care of the images, but as I see from Thomas’s message, he is trying to have a small game and big game start,

I have had faced that issue with an iPad and iPhone apps, I need to place the elements according to the device, which cannot be resolved by dynamic resolution alone.

That unfortunately will have to be done with a flag at the start which will identify the device and the screen resolution it is running at.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15385 reply_id: 56860[/import]

Exactly, JayantV,

What I would want to do, specifically, is the following two things:

  1. I want to be able to choose the size of the OpenGL canvas, e.g. to work on a 600 x 800 canvas, even though this will be displayed on an iPad. I understand that this is possible through scaling methods, but there are limitations. The reasons for working on a smaller canvas size and uprezzing is 1) speed, since filling less pixels is always faster, 2) using lower size assets and 3) for the look: uprezzing can look nicer for some styles of graphics.

  2. Choose my gamecode based on the screen size, so I can do less processor-intensive code on smaller phones than on bigger tablets (e.g. use a lower amount or no particles).

JayantV, maybe that flagging at the start can be done with clever use of the display.viewableContentWidth value? At least for iPhone or iPad this should be pollable, which could allow running two versions of code. The big drawback here is of course that you have to use ‘fake’ coordinate spaces… And this won’t work to distinguish between iPhone 3 or 4s… Isn’t there a code that gives you the native resolution of the device?

Cheers,
thomas [import]uid: 70134 topic_id: 15385 reply_id: 56862[/import]

Thomas,

try to see if this article helps you resolve some of your issues with dynamic resolution and graphic sizes.

As for the issue of specifying co-ordinates for the iPad and the iPhone, it is a bit of a struggle.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15385 reply_id: 56864[/import]

Hmmm… Upon further research of the docs, it seems (I still need to test this) that it should be possible to use the display.contentXscale and display.viewableContentWidth values to detect what the original screen resolution is, and based on that pick a version of code. And based on that dynamic image resolution that works with spritesheets.

Hmmm… I feel the urge to test coming on, but I should finish my first game before that!

Cheers,
Thomas [import]uid: 70134 topic_id: 15385 reply_id: 56867[/import]