inscription = Image.load("images/inscription.png")
inscription2 = Image.load("images/inscription2.png")
continuer = Image.load("images/continuer.png")
valider = Image.load("images/valider.png")
selecteur = Image.load("images/selecteur.png")
curseur = Image.load("images/curseur.png")
rouge = Color.new(255,0,0)
x = 240
y = 135
y2 = 0
mouseover = 0
statut = 0
statutinscription = 0
MotDePasse = ""
mdp = io.open("pass.txt","r")
lire = mdp:read()
pseudo = ""
pseudonyme = io.open("pseudo.txt","r")
lire2 = pseudonyme:read()
minuteur = Timer.new()
minuteur:stop()
function deplacementcurseur()
if pad:up() then
y = y - 2.5
end
if pad:down() then
y = y + 2.5
end
if pad:left() then
x = x - 2.5
end
if pad:right() then
x = x + 2.5
end
dx = pad:analogX()
if math.abs(dx) > 27 then
x = x + dx / 25
end
dy = pad:analogY()
if math.abs(dy) > 27 then
y = y + dy / 25
end
if x >= 480 then
x = 480
end
if x <= 0 then
x = 0
end
if y >= 272 then
y = 272
end
if y <= 0 then
y = 0
end
end
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:clear()
if statut == 0 then
screen:blit(0,y2,inscription)
if y >= 194 and y2 == 0 then
y2 = -78
elseif y <= 78 and y2 == -78 then
y2 = 0
elseif y2 == -78 and y >= 222 and y <= 242 and x >= 190 and x <= 290 then
screen:blit(190,222,continuer)
if pad:cross() then
statut = 1
end
elseif not(y2 == -78 and y >= 222 and y <= 242 and x >= 190 and x <= 290) then
mouseover = 0
end
end
if statut == 1 then
screen:blit(0,0,inscription2)
minuteur:start()
currenttime = minuteur:time()
if x >= 190 and x <= 290 and y >= 230 and y <= 250 then
screen:blit(190,230,valider)
if pad:cross() and currenttime >= 1000 then
if MotDePasse ~= lire and pseudo ~= lire2 then
if lire == "0" then
mdp:write(MotDePasse.."\n")
mdp:close()
mouseover = 0
statut = 2
end
end
end
end
end
if statut == 1 then
if x >= 220 and x <= 370 and y >= 96 and y <= 116 then
screen:blit(220,96,selecteur)
if pad:cross() then
pseudo = System.startOSK(pseudo,"pseudo")
end
elseif x >= 220 and x <= 370 and y >= 126 and y <= 146 then
screen:blit(220,126,selecteur)
if pad:cross() then
MotDePasse = System.startOSK(MotDePasse,"mot de passe")
end
elseif x >= 220 and x <= 370 and y >= 156 and y <= 176 then
mouseover = 4
screen:blit(220,156,selecteur)
elseif not(x >= 190 and x <= 290 and y >= 230 and y <= 250) and not(x >= 220 and x <= 370 and y >= 96 and y <= 116) and not(x >= 220 and x <= 370 and y >= 126 and y <= 146) and not(x >= 220 and x <= 370 and y >= 156 and y <= 176) then
mouseover = 0
end
if pseudo ~= nil then
screen:print(222,100,pseudo,blanc)
end
if MotDePasse ~= nil and MotDePasse ~= "" then
screen:print(221,130,"****",blanc)
end
if mdp2 ~= nil and mdp2 ~= "6546516546216" then
screen:print(221,160,"****",blanc)
end
end
if pad:select() then
break
end
deplacementcurseur()
screen:blit(x,y,curseur)
screen.waitVblankStart()
screen.flip()
oldpad = pad
end