Author Topic: How to account for TV overscan on UIRoot?  (Read 4204 times)

greggtwep16

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
How to account for TV overscan on UIRoot?
« on: September 08, 2014, 01:09:43 AM »
Hi,

First of all love NGUI I've been using it for awhile in my projects.  Recently I've been looking to port my game to the Fire TV (android platform).  This platform displays to TV's so overscan needs to be accounted for.  I am not sure if there is an easy way to accomplish what I'm after but I figured I'd ask is there a way to adjust the width/height manually by a factor on UIRoot?  The properties width and height are readonly.  I'm looking to do this at runtime since not all TV's are calibrated poorly (but many are).  I've been using flexible scaling so far and its worked great for about any aspect ratio/screen size I've thrown at it so far but not sure if it can handle this.

Preferably, I want to expose a checkbox is my options menu that would state "adjust for overscan" and then it would shrink the UIroot to not use screen realestate within 10% of the borders.  If the user's tv is already calibrated they would never check the box.

Is there already a way to do this?  If not, what class should I look at modifying?  I looked through UIRoot and NGUITools and there are various adjustment methods used internally but not sure which approach would make most sense.

Thanks in advance!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to account for TV overscan on UIRoot?
« Reply #1 on: September 08, 2014, 08:46:07 PM »
Easiest way to account for overscan is to anchor everything to a common widget rather than UIRoot. Only this one widget will be anchored to the UIRoot -- and done so with some padding to compensate for overscan.

greggtwep16

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: How to account for TV overscan on UIRoot?
« Reply #2 on: September 09, 2014, 04:29:42 AM »
Thanks for the reply.

I tried moving a test menu and a test in game HUD over to your suggestion today and while it did account for positioning and I could see that it would work on positioning alone, scaling seems to now be an issue with this approach (unless I'm confused which is very possible).  Basically, anchoring everything to a common widget seems to make all the items not scale nicely like the flexible UIRoot did.  While I could then pad the outlines it seemed to not handle drastic resolution differences (i.e. whatever size I made the widget the other end of the spectrum had issues).  My smallest resolutions tested are 800 x 480 and highest of 1920 x 1080.

I tried both the padding approach and dynamically resizing the widget to UIRoot dimensions but neither accounted for scale.  UIRoot on flexible handles the scale but not padding.

Am I doing something wrong or misinterpreting what to do?

Thanks in advance.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to account for TV overscan on UIRoot?
« Reply #3 on: September 10, 2014, 12:44:31 AM »
Did you use relative or absolute values for the root widget? If you use absolute values (what you see by default) then it's in pixels, and will behave like a Flexible root. If you use Custom anchoring and adjust relative values instead of absolute, then it will behave like a Constrained root.

Since overscan is percent-based, you will want to use the latter -- relative anchoring values (Custom anchoring). Note that this only applies to your root widget.