GLBasic forum

Codesnippets => Math => Topic started by: Kitty Hello on 2010-Jul-23

Title: Battery status display
Post by: Kitty Hello 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
Title: Re: Battery status display
Post by: Ian Price on 2010-Jul-23
Would this work on all handheld formats (Wiz, iXXX, GP2X etc.)?
Title: Re: Battery status display
Post by: Kitty Hello 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.