Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Screen resolutions / dynamic scaling
Started by Rob... Aug 04 2014 06:19 AM

4 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Rob...

[GLOBAL: userInfoPane.html]
Rob...
  • Contributor

  • 329 posts
  • Corona SDK

Now that I need to set the screen resolutions manually on the MainPage file, without using options on the config.lua , how can one go about creating universal screen resolution detection systems? For instance between iPhone and iPad1/2/Retina etc we were able to have options depending on pixelHeight or device/model etc. Sometimes I just put in the config width=content.pixelHeight etc. If I make an app which fits an older device for example 800x480, Is it possible to have that work on a 1080 screen and instead of scaling 800 to 1080, create the assets at 1080?

[TOPIC: post.html]
#2

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

I actually recommend that you do *not* set the pixel width and height on your MainPage.  By default, the WP8 app template that Corona provides (as well as Microsoft's) is set up to "fill" the page without any width/height set.  If your width and height are set in the XML file, then just delete them to set it up to fill the page.

 

You should also set up your WMAppManifest.xml to support all resolutions by checking on "wvga", "wxga", and "720p".  This way those devices will be allowed to download/purchase your app from the store.

 

You should also use a "config.lua" file to set up Corona's content scaling like how you're already used to doing it.  This way you can take advantage of Corona's built-in scaling features... unless of course you're feeling brave and wish to handle it yourself.

 

Microsoft documents the supported Windows Phone resolutions here...

   http://msdn.microsoft.com/en-us/library/windows/apps/jj206974(v=vs.105).aspx

 

Using a Corona content width and height of 320x480 (original iPhone resolution) works fine.  If you don't mind re-laying out your app for WP8, then I suggest setting the content width and height to the minimum supported on WP8, which is 480x800.

 

Does this help?

Or am I misunderstanding what you are trying to do?



[TOPIC: post.html]
#3

Rob...

[GLOBAL: userInfoPane.html]
Rob...
  • Contributor

  • 329 posts
  • Corona SDK

That does help regards to the MainPage. I will leave that alone then. :)

What I have done in the past is created imageRect objects using proportions of the screenWidth/height -not pixels. I always used to set the config width and heigh to just match the devices content width and height. Guess this is just a system I have used for quite some time which worked. It saved me using different assets as I always used the highest resolution assets.

Are you saying that if I set up background image which actual size is 1080pixels, created the imageRect to match whatever the width of content width and then set in config 800x480 , it will render the background image at 1080 on a 1080 device and not render at 800 then scale it to fit which wont be the same? I always assumed what was in config was maximum.
Thinking about it though , as it's only going on phone it's not a big deal really.



Looking at that link for phone resolutions it looks like even if it is 1080, it will scale to 800? Or actually is that how a 7.1 app behaves?

[TOPIC: post.html]
#4

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Corona's content scaling will scale "up" based on the width and height you set in the "config.lua".  You're expected to set it to the minimum that you support, because Corona wasn't designed to scale down.

 

So, if you set the content width/height to WP8's smallest resolution (say 480x800) with letterboxing, then Corona will automatically scale it up by 1.5x on a 720x1280 screen and 2.25x on a 1080x1920 screen.  Those are nice even scales.  This means that you can use the scales documented by Microsoft (ie: @1.5, @1.6, and @2.25) for you different resolutions of your image files to be displayed via Corona's display.newImageRect().  But that said, Corona doesn't support the 1080p @2.25 resolution yet because WP8 currently reports that resolution as 720p to the application on the native side and upscales the app to 1080p instead.  The upscaling works fine, but it'll show 720p images instead.  That is, when you fetch the pixel width/height via Corona, it'll report a 720p resolution on a 1080p device because that's how WP8 provides it in C#.  (We haven't decided how to handle this yet, although it doesn't look bad as-is at the moment.)

 

If you can get the WP8 emulator working on your Windows 8.1 machine, then you get easily test the above in Visual Studio.



[TOPIC: post.html]
#5

Rob...

[GLOBAL: userInfoPane.html]
Rob...
  • Contributor

  • 329 posts
  • Corona SDK

Yeah I just got all that working today so I'll do some tests. Thanks for the info


[topic_controls]
[/topic_controls]