Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Arcanor on November 15, 2013, 03:16:14 PM

Title: darken the Android screen
Post by: Arcanor on November 15, 2013, 03:16:14 PM
I'm working on an Android app and I need an easy and intuitive way to get the screen to lighten/darken.  On Android, I can't manipulate the screen brightness directly while using Unity, so I figure the best way to do this is to have a full-screen black sprite over top of everything and set the alpha based on a swipe.  If the user swipes upward, I want to decrease the alpha on my black overlay, making it appear brighter.  If the user swipes downward, I want the alpha to increase, making the screen appear darker.

I just need to detect the swipe, then send the touch's Y-position to my black sprite.  Can I use UISlider somehow, or Scrollbar?  How should I go about this?

Or is there some other way I should be doing such a thing?

Thanks in advance for your thoughts and advice.
Title: Re: darken the Android screen
Post by: ArenMook on November 15, 2013, 09:48:53 PM
For swipes and gesture recognition, FingerGestures was used with NGUI successfully many times in the past as reported by users. Slider wouldn't be appropriate here, but I suppose you could just add a slider to options instead, no?

Btw, drawing a full screen quad on top of your screen will potentially double your fillrate, which will likely reduce the performance a fair bit.
Title: Re: darken the Android screen
Post by: Arcanor on November 16, 2013, 02:17:12 PM
For swipes and gesture recognition, FingerGestures was used with NGUI successfully many times in the past as reported by users. Slider wouldn't be appropriate here, but I suppose you could just add a slider to options instead, no?

Btw, drawing a full screen quad on top of your screen will potentially double your fillrate, which will likely reduce the performance a fair bit.

Thanks for the idea Michael.  I will look into FingerGestures as you suggest.  I'd prefer to keep it as simple as possible as this is for a digital clock app.  I don't think performance should be a problem.