Author Topic: Multi resolution support hell  (Read 10005 times)

ramones

  • Guest
Multi resolution support hell
« on: April 25, 2012, 05:43:48 AM »
Hi,

I have been reading forum from page 1 to 10 searching for this and haven't been able to find something consistent.

My problem is a problem that I think all people should be facing: Different resolutions, change atlas depending on it and calculating relative positioning for the UI to fit into the correct position for this resolution.

I have read about solutions for the atlas selection (I read something about using an atlas that is used as an index, etc...). Has NGUI support for relative positioning deepening on screen size?.

THanks in advance.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multi resolution support hell
« Reply #1 on: April 25, 2012, 11:34:06 AM »
UIRoot, when "automatic" is turned off, will scale the UI making it look exactly the same size regardless of the resolution.

UIAnchor lets you attach things to sides and corners of the screen.

UIStretch lets you stretch the UI or just UI widgets, should you have need, based on the size of the screen. It can do that based on width + height, or just height alone.

UIAtlas has an option for pixel size and reference atlases. Reference atlases are dummy atlases that point to another atlas. You can switch the pointer at run-time, swapping SD for HD easily. As you do that, make sure to set the pixelSize property -- if it's '1' for your SD atlas, set it to '0.5' for your HD atlas (assuming the sprites are double in width/height), and turn off UIRoot's 'automatic' option.

diademlee

  • Guest
Re: Multi resolution support hell
« Reply #2 on: January 03, 2013, 04:25:35 PM »
ArenMook, any chance this could get a tutorial?  All the components are certainly there for supporting multiple resolutions, its just very confusing because the information is spread all over (tutorials and forums).

A sample scene that supports HD, SD, and iPhone5 and iPad would be amazing...

EToreo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 88
    • View Profile
Re: Multi resolution support hell
« Reply #3 on: January 03, 2013, 05:35:23 PM »
I agree, it would be great to see a tutorial on all this. I have been trying to soft though all this information and this is the first time I have seen it all in one place. Adding a tutorial for it would take this to the next level.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multi resolution support hell
« Reply #4 on: January 03, 2013, 06:19:08 PM »
There is a video tutorial covering HD/SD atlases, and another video tutorial covering UIAnchor / UIRoot. Check the documentation page: http://www.tasharen.com/?page_id=197

EToreo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 88
    • View Profile
Re: Multi resolution support hell
« Reply #5 on: January 03, 2013, 06:23:10 PM »
How about fonts (mobile devices), HD fonts (iPad), and Super HD fonts (iPad 3)?  I know there is info out there about getting them to switch properly.  Is there anything we need to do to get that switching to play nice with the Atlas switching.  For example: Buttons - they have a label (font) on them and atlas around them.  Will your instructions about UIRoot and the "automatic" tag play well for this?

diademlee

  • Guest
Re: Multi resolution support hell
« Reply #6 on: January 03, 2013, 09:25:31 PM »
There is a video tutorial covering HD/SD atlases, and another video tutorial covering UIAnchor / UIRoot. Check the documentation page: http://www.tasharen.com/?page_id=197

Yes, I am aware of the tutorials, I have been through them all.  My point (echoed by EToreo) is that pulling everything together for supporting multiple devices with different resolutions is confusing to someone getting started.  I think I have it worked out now, but it took some digging around on the forums and looking at different tutorials to figure out the best practices.   

No where is there a tutorial that says: here is how to set up NGUI for iPhone, iPhone Retina, iPhone 5, iPad, iPad Retina.  And here is a sample of that working.  Pretty much would be my go to tutorial if it existed...

Anyway, like I said I have it working, so its just a suggestion.

lime-green.at

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: Multi resolution support hell
« Reply #7 on: January 04, 2013, 03:02:26 AM »
I faced the exactly same problem some months ago, but im working for desktops. Maybe my RatioFix script can help you:
http://ideone.com/rmgu7t

What does it do: It fixes all Camera-Ratios to the choosen ratio, for me its 16:9 (Ratio of the screendesign). With it you will always get the complete width of the screen without streching anything. If youre running the application in 16:9, you'll get the UI perfectly fill out the screen, if your running it for example at a 4:3 resolution, you're gonna get a small bar above and below your GUI. A camera culling nothing with a solid color which is not going to get ratiofixed will render your depth 0, so u wont have any black bars, instead you can just choose a color for the background.

Hope it helps,
Regards

HitStop

  • Guest
Re: Multi resolution support hell
« Reply #8 on: January 10, 2013, 05:47:49 AM »
Michael, how about releasing the project in the SD/HD atlas switching video as an example? That should reduce the number of your support requests.

In the meantime, the project structure visible in the video should help. For more advanced resolution issues, I have found that manipulating UIRoot settings is a possible solution, though so far my approach is not perfect.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multi resolution support hell
« Reply #9 on: January 10, 2013, 01:12:22 PM »
That example is a part of the test folder I use. It's not very clean, and I just dump stuff in there, which is why I haven't made it public. But if you want it, by all means... :)

http://www.tasharen.com/temp/test.zip