--by shefqet 2007 - 2008
unloadbuff()

Black = Color.new (0, 0, 0)
red = Color.new(255, 0, 0)
white = Color.new(255, 255, 255)
------------------------------------------------
Select=1
maxSelect=3
menuBackground = Image.load("img/bg.png")
ico = Image.load("img/button.png")
ico1 = Image.load("img/button1.png")
ico2 = Image.load("img/button2.png")
full=Image.load("battery/full.png")
half=Image.load("battery/half.png")
third=Image.load("battery/last.png")
dead=Image.load("battery/dead.png")
usb1=Image.load("usb/usb1.png")
usb2=Image.load("usb/usb2.png")
-----------------------------------------------
oldpad = Controls.read()
------------------------------------------------
while true do
pad=Controls.read()
screen:clear()
screen:blit(0,0,menuBackground)
------------------------------------------------
-----------------------------icons--------------

if pad:left() and oldpad:left() ~= pad:left() then
Select = Select - 1
end
if pad:right() and oldpad:right() ~= pad:right() then
Select = Select + 1
end
if Select > maxSelect then
Select = 1
elseif Select <= 0 then
Select = maxSelect
end
if Select == 1 then
screen:blit(100,75,ico)
screen:blit(200,80,ico1)
screen:blit(300,80,ico2)
end
if Select == 2 then
screen:blit(100,80,ico)
screen:blit(200,75,ico1)
screen:blit(300,80,ico2)
end
if Select == 3 then
screen:blit(100,80,ico)
screen:blit(200,80,ico1)
screen:blit(300,75,ico2)
end
if pad:cross() and Select == 1 then
dofile("kat.lua")
end
if pad:cross() and Select == 2 then
dofile("credit.lua")
end
if pad:cross() and Select == 3 then
dofile("main.lua")
end


--USB-----------------------------------------------
if pad:r() then 
System.usbDiskModeActivate()
screen:blit(400,12,usb1)
end
if pad:l()then
System.usbDiskModeDeactivate()
screen:blit(400,12,usb2)
end
--1-------------------------------------------------
batteryLife=System.powerGetBatteryLifePercent()

if batteryLife > 75 then
screen:blit(5,5,full)
end
if batteryLife < 75 and batteryLife > 50 then
screen:blit(5,5,half)
end
if batteryLife < 50 and batteryLife > 25 then
screen:blit(5,5,third)
end
if batteryLife < 25 and batteryLife > 0 then
screen:blit(5,5,dead)
end
-- -------------------------------------------------
screen:print(30,30,"Welcome to PortableQuiz!!")
screen.waitVblankStart()
screen.flip()
oldpad = pad
end
