Draw:Battery

Draw a Battery on the screen.

nil Draw:Battery(x, y, _color)
function Draw:Battery(x, y, _color)
	local x = x or 0
	local y = y or 0
	local _color = _color or Color.new(255,255,255)
	-- Draw Battery
	screen:drawLine(x+2, y, x+21, y, _color)
	screen:drawLine(x+2, y+11, x+21, y+11, _color)
	screen:drawLine(x, y+4, x, y+7, _color)
	screen:drawLine(x+1, y+4, x+1, y+7, _color)
	screen:drawLine(x+2, y, x+2, y+11, _color)
	screen:drawLine(x+21, y, x+21, y+11, _color)
 
	-- Draw Battery Info
	local Pow = math.ceil(System.powerGetBatteryLifePercent() / 33.33333)
	if (Pow > 0) then
		screen:fillRect(x+16, y+3, 3, 6, _color)
	end
	if (Pow > 1) then
		screen:fillRect(x+11, y+3, 3, 6, _color)
	end
	if (Pow > 2) then
		screen:fillRect(x+6, y+3, 3, 6, _color)						
	end
end
 
psp/lua_player/library/romero126/draw/battery.txt · Last modified: 2008/05/15 00:07
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki