Display brightness manipulation.

dareek

  • Posts: 91
Is there a way in Stencyl to manipulate display brightness on mobile OS's (android/iOS)?

dareek

  • Posts: 91
Bump.

I know this question is more of a "how to tap into a OS functions" general nature, but could any experienced programmer give me an answer if it is possible from Stencyl or probably haxe code, or not at all, please?

dripple

  • Posts: 748
I know this question is more of a "how to tap into a OS functions" general nature,
You answered your self your question :)
You need a native extension for Android or iOS that calls either "...Settings.System.SCREEN_BRIGHTNESS, 20"  (Android) or "[[UIScreen mainScreen] setBrightness:1.0];" (on iOS)
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

dareek

  • Posts: 91
Thank you very much dripple.
It looks like it is a time to invest a little bit into embracing that cryptic 'writing programs' thing we all non-programmers read about on the Internet :)

dripple

  • Posts: 748
Well, on the other hand: you could simply accept the user's choice on the brightness and do not to try to dry down his battery :)

If the brightness is important for your game, display a screen of (lets say 10) gray boxes (10% to 100%)  and ask the user to adjust the screen to see all gray boxes. So the user has a choice.

I would simply delete your game if it changes some of my system settings without my permission. ;)
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

dareek

  • Posts: 91
Well, the idea of the 'game' is to let it change the display brightness, so the user would expect it when running the 'game'.
No worry. I am not a 'let me control your phone and I will call the World for ya' type of guy.
Your previous answer seriously pushed my into right direction:
http://www.compiletimeerror.com/2014/02/adjust-screen-brightness-in-android.html#.U6Hoef55Mks

I mean it looks a little intimidating at first, but I can be patient.

Thx again.

dripple

  • Posts: 748
You could also design your elements in bright colors and then use black png's with different transparencies to emulate changing brightness. This is the same way you would simulate light effects.
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper