Author Topic: Battery status display  (Read 2180 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10666
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Battery status display
« on: 2010-Jul-23 »
Make a font that has the first 4 characters:
Code: GLBasic [Select]
[.] [0] [1] [2] [3] [.] [.]
[.] [.] [.] [.] [.]
...
 
(character chr$(0) is nothing, 1=empty, 3=full)

Then use this to display the battery:
Code: GLBasic [Select]
                        batt% = PLATFORMINFO$("BATTERY")
                        batt% =MIN(4, MAX(1, (batt+10)/30 + 1 ))
                ENDIF
                PRINT CHR$(batt%), 300,2
 

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4133
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Battery status display
« Reply #1 on: 2010-Jul-23 »
Would this work on all handheld formats (Wiz, iXXX, GP2X etc.)?
I came. I saw. I played.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10666
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Battery status display
« Reply #2 on: 2010-Jul-23 »
yes. I'm not sure if the Wiz battery is properly implemented, though. The rest I am certain about. iPhone had a bug, returning 0...1 instead of 0...100.