--[[
Love Calculator PSP par J3r3mie
Modification non autorisé sans mon accord
www.j3r3miedev.blogspot.com
www.blackdev.hotgoo.net
Police : Dafont.com
Musique : sound-fishing.net
]]
 
sccnt=1
 
oldpad = Controls.read()
 
--Couleurs
blanc = Color.new(255,255,255)
 
--Variables
poucentage = math.random(0,100)
nom1 = "Entrez le nom"
nom2 = "Entrez le nom"
val = 0
status = "Splash"
longueur2 = string.len(nom2)
 
 
--Police
Police = Font.load("Font.ttf")
Police:setPixelSizes(18,18)
 
Mp3me.load("Musique.mp3")
 
while true do
screen:clear()
pad = Controls.read()
math.randomseed(os.time())
if pad:select() then screen:save("Screen.png") end
 
Mp3me.play()
 
if Mp3me.percent() == 100 then
Mp3me.stop()
Mp3me.load("Musique.mp3")
Mp3me.play()
end
 
if status == "Splash" then
screen:fontPrint(Police,10,30,"Bienvenue dans Love Calculator PSP, un",blanc)
screen:fontPrint(Police,10,60,"homebrew qui calcule vos chances de",blanc)
screen:fontPrint(Police,10,90,"sortir avec une fille ou un gars.",blanc)
screen:fontPrint(Police,10,120,"Entrez simplement les 2 noms et",blanc)
screen:fontPrint(Police,10,150,"appuyez sur Start puis l'homebrew",blanc)
screen:fontPrint(Police,10,180,"calculera un pourcentage de chance.",blanc)
screen:fontPrint(Police,60,230,"Amusant ? Appuyez sur X ...",blanc) 
if pad:cross() then
status = "Menu"
end
end
 
if status == "Menu" then
local longueur2 = string.len(nom2)
screen:fontPrint(Police,10,30,"L : "..nom1,blanc)
screen:fontPrint(Police,272-longueur2,30,"R : "..nom2,blanc)
screen:fontPrint(Police,170,230,"Start : Calculer",blanc)
screen:fontPrint(Police,90,260,"Triangle : Retourner au Menu Jeux",blanc)
if pad:l() and oldpad:l() ~=pad:l() then
oldpad = pad
nom1 = System.startOSK("","Entrez le premier nom.")
end
if pad:r() and oldpad:r() ~=pad:r() then
oldpad = pad
nom2 = System.startOSK("","Entrez le deuxieme nom.")
end
if pad:start() and oldpad:start() ~=pad:start() and nom1 ~= "Entrez le nom" and nom2 ~= "Entrez le nom" and nom1 ~= "" and nom2 ~= "" then
oldpad = pad
status = "Load"
end
if pad:start() then
if nom1 == "Entrez le nom" or nom2 == "Entrez le nom" or nom1 == "" or nom2 == "" then
screen:fontPrint(Police,170,100,"Entrez un nom !",blanc)
end
end
if pad:triangle() then 
System.message("Merci d'avoir jouer",0)
dofile("./scripts/menu.lua")() end
end
 
if status == "Load" then
screen:fontPrint(Police,40,50,nom1.." + "..nom2.." =",blanc)
screen:fontPrint(Police,45,75,"... Chargement ...",blanc)
screen:fillRect(45,90,val,5,blanc)
val = val + 1
if val > 180 then
poucentage = math.random(0,100)
status = "Reponse"
end
end

if pad:select() then
screen:save("ms0:/PSP/PHOTO/"..sccnt..".png")
sccnt=sccnt+1 end
 
if status == "Reponse" then
screen:fontPrint(Police,40,50,nom1.." + "..nom2.." =",blanc)
screen:fontPrint(Police,45,75,poucentage.." %",blanc)
screen:fontPrint(Police,110,180,"Select : faire un screen",blanc)
screen:fontPrint(Police,100,210,"Start : Retourner au Menu",blanc)
screen:fontPrint(Police,90,240,"Triangle : Retourner au Menu Jeux",blanc)
if pad:start() and oldpad:start() ~=pad:start() then
oldpad = pad
nom1 = "Entrez le nom"
nom2 = "Entrez le nom"
val = 0
status = "Menu"
end
if pad:triangle() then 
System.message("Merci d'avoir jouer",0)
dofile("./scripts/menu.lua")() end
end
 
screen.waitVblankStart()
screen.flip()
oldpad = pad
end 
