Author Topic: UIRoot: Why target Height?  (Read 2429 times)

Oakshiro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
UIRoot: Why target Height?
« on: May 15, 2013, 02:54:20 AM »
Hi there,

I know you can adjust the  size of the panels to match a target height, but when creating mobile applications they are mostly in portrait mode. Wouldn't it be more adequate to set a target width and position  the elements on the screen via UIAnchors?

Is there an easy way to modify UIRoot to use target Width instead of Height?
Thanks!

Rampa

  • Guest
Re: UIRoot: Why target Height?
« Reply #1 on: May 15, 2013, 08:14:57 AM »
I'm also working on a game in portait mode and it would great to have an UIRoot that target width instead of height.
Is there a way to change that easily?

Best regards
Rampa

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile

Oakshiro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: UIRoot: Why target Height?
« Reply #3 on: May 17, 2013, 03:01:04 AM »
I saw that post previously, but it uses the "targetHeight" to calculate the size, therefore I supposed it was not Width based.
Is it that the targetHeight is being "hacked" to be used as Width ?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UIRoot: Why target Height?
« Reply #4 on: May 17, 2013, 03:21:42 AM »
Whether you use height or width is arbitrary. It's used to set up a size for Virtual Pixels that split the screen into that many parts. If the virtual pixel height (UIRoot's activeheight) is the same as Screen.height, then Screen.width will also correspond to the coordinate system made by UIRoot (localPositions).

If you mess around with the manualHeight, then you need to calculate the corresponding width based on the aspect between height/width.

Externally in your own script, you can easily do these calculations and feed a manual height into UIRoot if you want to change it at runtime.