--MENU (taken from evil mana codebase)
 
 -- EVILMANA.COM PSP LUA CODEBASE
-- www.evilmana.com/tutorials/codebase
-- Simple Menu
-- SUBMITTED BY: ARza







--Colors
white = Color.new(255,255,255)
black = Color.new(0,0,0)
red = Color.new(255,0,0)

bground = Image.load("bg.jpg")
  Music.playFile("sounds/aberration_living_in_a_fantasy.xm", false) 
  
--Music.volume( [number {0-128}] )
  Music.volume (30)







current = 1 --this is our current menu selection
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:clear()
	screen:blit(0,0,bground) --bground
-- Prints our 16 menu options
-- screen:print(180,60,"=='PSP Trivia'==",white)


screen:print(200,50,"Play quiz 01",black)
screen:print(200,60,"Play quiz 02",black)
screen:print(200,70,"Play quiz 03",black)
screen:print(200,80,"Play quiz 04",black)
screen:print(200,90,"Play quiz 05",black)
screen:print(200,100,"Play quiz 06",black)
screen:print(200,110,"Play quiz 07",black)
screen:print(200,120,"Play quiz 08",black)
screen:print(200,130,"Play quiz 09",black)
screen:print(200,140,"Play quiz 10",black)
screen:print(200,150,"Play quiz 11",black)
screen:print(200,160,"Play quiz 12",black)
screen:print(200,170,"Play quiz 13",black)
screen:print(200,180,"Play quiz 14",black)
screen:print(200,190,"Play quiz 15",black)






screen:print(217,210,"- Exit -",white)









-- These make it so when the variable "current" changes
-- so does the current menu selection
if current == 1 then
screen:print(200,50,"Play quiz 01",white) 



	
		

end


if current == 2 then
screen:print(200,60,"Play quiz 02",white)
end
if current == 3 then
screen:print(200,70,"Play quiz 03",white)
end
if current == 4 then
screen:print(200,80,"Play quiz 04",white)
end
if current == 5 then
screen:print(200,90,"Play quiz 05",white)
end


if current == 6 then
screen:print(200,100,"Play quiz 06",white)
end

if current == 7 then
screen:print(200,110,"Play quiz 07",white)
end

if current == 8 then
screen:print(200,120,"Play quiz 08",white)
end


if current == 9 then
screen:print(200,130,"Play quiz 09",white)
end


if current == 10 then
screen:print(200,140,"Play quiz 10",white)
end

if current == 11 then
screen:print(200,150,"Play quiz 11",white)
end


if current == 12 then
screen:print(200,160,"Play quiz 12",white)
end


if current == 13 then
screen:print(200,170,"Play quiz 13",white)
end


if current == 14 then
screen:print(200,180,"Play quiz 14",white)
end


if current == 15 then
screen:print(200,190,"Play quiz 15",white)
end



if current == 16 then
screen:print(217,210,"- Exit -",red)
end




-- Makes it so when UP/DOWN is pressed, the variable
-- "current" changes making the selection change
if pad:up() and oldpad:up() ~= pad:up() then
current = current - 1
end
if pad:down() and oldpad:down() ~= pad:down() then
current = current + 1
end
--Makes it so the selection goes from the bottom to top
if current == 17 then
current = 1
end
if current == 0 then
current = 16
end
--buttons 


if pad:cross() and current == 1 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "1"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")

end

if pad:cross() and current == 2 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "2"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 3 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "3"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 4 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "4"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end



if pad:cross() and current == 5 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "5"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 6 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "6"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 7 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "7"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 8 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "8"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 9 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "9"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 10 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "10"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 11 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "11"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 12 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "12"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 13 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "13"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 14 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "14"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end

if pad:cross() and current == 15 then
Music.stop()
file = io.open("settings.txt","w")
myText = "quizdir" 
myText2 = " = "
myText3 = "15"
file:write(myText, myText2, myText3)
file:close()
dofile("./game.lua")
end



if pad:cross() and current == 16 then
Music.stop()
os.exit()
end



screen.waitVblankStart()
screen.flip()
oldpad = pad

end

-- To make the menu work you just need to add a few
-- if/then statements. For example


-- This will make it so if "Start" is highligted and 
-- you press Cross then it will do the function Start()





