--******************************************************************
--********console grab-----scores menu script****************************
--******************************************************************

--Anonymous D
-- 07/2007

--variables

--for lines of text
a = 60

--***********define colours
red = Color.new(255, 0, 0)
green = Color.new(0, 255, 0)
blue = Color.new(0, 0, 255)
pink = Color.new(180, 0, 180)
white = Color.new(255, 255, 255)

--*****load materials***********
--****************************

--************SOUNDS
--menu loop
menu_loop = Sound.load("./sfx/menu_loop.wav",true)

--open text file
game = io.open("./recourses/gamescore.txt","r")
sony = io.open("./recourses/sony.txt","r")
nintendo = io.open("./recourses/nintendo.txt","r")
microsoft = io.open("./recourses/microsoft.txt","r")
avoidance = io.open("./recourses/avoidance.txt","r")
timeattack = io.open("./recourses/timeattack.txt","r")
dualhand = io.open("./recourses/dualhand.txt","r")

--read scores file and arrange in lines
line1 = game:read()
line2 = sony:read()
line3 = nintendo:read()
line4 = microsoft:read()
line5 = avoidance:read()
line6 = timeattack:read()
line7 = dualhand:read()

game:close()
sony:close()
nintendo:close()
microsoft:close()
avoidance:close()
timeattack:close()
dualhand:close()

--background
background = Image.load("./gfx/scrbgrnd.png")

local sound = menu_loop
voice = sound:play()

while true do

--draw in background
screen:blit(0,0,background)

--print score
screen:print(130,70,"Your last game score:" .. line1,green)
screen:print(130,80,"Your last Sony score:" .. line2,green)
screen:print(130,90,"Your last Nintendo score:" .. line3,blue)
screen:print(130,100,"Your last Microsoft score:" .. line4,blue)
screen:print(130,110,"Your last Avoidance score:" .. line5,blue)
screen:print(130,120,"Your last Timeattack score:" .. line6,blue)
screen:print(130,130,"Your last Dual hand score:" .. line7,blue)

--read pad input
pad = Controls.read()

--exit with triangle
if pad:triangle() then
background = nil
voice:stop()
menu_loop = nil
dofile("./index.lua")
break
end

--ending scripts
screen.waitVblankStart()
screen.flip()
end