Author Topic: trying to understand different resolutions  (Read 6422 times)

yotes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
trying to understand different resolutions
« on: May 28, 2012, 07:42:27 PM »
First of all, I've downloaded the ngui asset, and it's great! I didn't hesitate on buy it, great work Aren!

Second, sorry my english.. it sucks :(.

Well, here is my doubt. I've been working with ngui the last couple of weeks, with plenty of resolutions in android, and for my surprise, it works great.. I use UIRoot with automatic setted enabled, and the GUI is adapted great from bigger resolutions (i.e asus transformer tablet 1280x800) to pretty small phones (i.e Samsung i7500 320x480). I didn't expect that, but in all of them, just using UIAnchor to specify some positions, of some UIPanes, the proportions are maintained in all my devices (also in galaxy 2 and a defy ). I was quite happy, because I didn't have to do anything else.

But now when I deployed a version to my iphone (3g 320x480), the proportions are not respected, and everything grows in size. I tried 2 things, first i went with the uistrech, I added  a couple of them to keep the aspect ratio, and that solved the problem in part.. because it change the scale of the panes, and the tween positions now are not correct. Also I didn't like the idea of using this, because I read that it shouldn't be used like that.

Then I tried turning off automatic on UIRoot, and then setting the height manually to 320 (my game is in landscape). The result was the same.. everything looks to big, and that is because everything in fact, is on that size. Then I changed the height to 640, and now it looks great.

So, I don't understand, why in android the GUI is resized automatically maintaining the aspect ratio on phones as the samsung i7500 (320x480).. and then on the iphone, with the same resolution, the size relation is not maintained. I also can't understand why should i set manually the resolution to the double of the real size, to make it look ok.. and what will be consecuences on a retina iphone (640x960).

If somebody can give me a clue of what is happening, it will be appreciated a lot.

Again, sorry about my english, and my noobyness :P.

Regards, and thanks a lot!

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: trying to understand different resolutions
« Reply #1 on: May 28, 2012, 08:39:16 PM »
This is exactly the same issue I am running into the moment. Unfortunately the aspect ratio of multiple resolutions is different so adjusting the height will adjust the width with different results depending on the screen resolution of the system. What you might want to do is scale your menu in regards to the width and height of the screen, sometimes however you will get slightly stretched results, ie circular objects looking a bit oval.

Another alternative is not to resize at all but to move objects around in the Window.
Check out "Example 1 -UIAnchor" and this will give you a clue of how to fix buttons against edges of the screen.

yotes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: trying to understand different resolutions
« Reply #2 on: May 28, 2012, 09:07:57 PM »
Yes, at the moment I'm using UIAnchor, but, for example, I have an UIPane in the top right of the screen  - using UIAnchor- that occupies the 25% of the screen height and 15% of the screen width in all my Android devices (from tablets to other smaller as iphone 3g - 320x480). Works great. But the with the same project running on my iphone, now this panes occupies approx the 50% in height and the 60% on width. I can't see why is this happening in iOS and not in android  :o.

I must to say that the proportion is not 100% accurate through the different Android devices. The Pane,on smaller android devices, occupies a little more space.. instead of the h:25% and w:15% of the screen.. maybe is more like 30~35% as much, and w:20~25%.. but is not as much as the 50~55% that occupies in the iphone.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: trying to understand different resolutions
« Reply #3 on: May 28, 2012, 09:16:16 PM »
Even the iPhone3 and iPhone4 have drastically different resolution sizes. The behaviour you are experiencing is frustratingly normal, I am still trying to get my head around this too.
What I suggest you do is try setting all 3 dimensions of the scale of your Menu by the current screen resolution height, that is what I did and at the very least everything fits on the screen.

(Screen.currentResolution.height;)

yotes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: trying to understand different resolutions
« Reply #4 on: May 28, 2012, 09:24:46 PM »
mmm.. you say like harcode 3 different screen heights, and depending the real height, use the nearest one? or I'm not understanding your point?

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: trying to understand different resolutions
« Reply #5 on: May 28, 2012, 09:33:12 PM »
Well before you were just putting in values of 320 and 640 right?
Try doing something like:-

TheMenu.GetComponentInChildren<UIRoot>().automatic = false;
TheMenu.GetComponentInChildren<UIRoot>().manualHeight = (int)Screen.currentResolution.height;

This is what I am doing, this way your menu will resize regardless if what menu will pop up. Unfortunately though the X scale varies slightly between devices so sometimes you might have things missing at the edges or too far in the middle.


yotes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: trying to understand different resolutions
« Reply #6 on: May 28, 2012, 09:45:10 PM »
OK, thanks! I'll try it tomorrow! I'll let you know what happened :P. Again, thanks a lot :)  ;)