--vmp3 by mrafenne



mov1 = 0
mov2 = 0

pApp3 =Image.load("ms0:/PSP/GAME/vmp3 v1/images/bg3.png")
pApp2 =Image.load("ms0:/PSP/GAME/vmp3 v1/images/bg2.png")
pApp1 =Image.load("ms0:/PSP/GAME/vmp3 v1/images/bg1.png")
pApp = Image.load("ms0:/PSP/GAME/vmp3 v1/images/bg.png")

scrollx = 0
scrolly = 0
v = 0
t = 0

function nomvis1()
mov2 = 0
if preiw == "fasle" and next == "fasle" then
if mov1 <= 251 and mov1 >= 0 then
mov1 = mov1 +8
end
end
end

statut = "defaut"

function exitMenu()
pApp1 = nil
pApp2 = nil
pApp3 = nil
pApp= nil
mov1 = nil
mov2 = nil
collectgarbage()
end


statut = "defaut"

while true do
screen:clear()

if pad:circle() then
statut = "affiche"
end

if statut == "affiche" then
nomvis1() 
screen:fillRect(40,mov1,400,1,white)
screen:fillRect(40,mov1,Mp3me.percent()*4,1,green)
screen:fontPrint(font,mov1+120,253,Mp3me.gettime(),green)
screen:fontPrint(font,mov1+120,270,Mp3me.songTime(),white)
screen:fontPrint(font,mov1-215,253,Mp3me.title(),white)
screen:fontPrint(font,mov1-215,270,Mp3me.album(),white)


end
if pad:square() then
statut = "defaut"
end


       scrollx = scrollx + v
	scrolly = scrolly + v
		
	if scrollx > pApp:height() then scrollx = 0 end
	if scrollx < 0 then scrollx = pApp:height() + scrollx end
	
	if scrolly > pApp:width() then scrolly = 0 end
	if scrolly < 0 then scrolly = pApp:width() + scrolly end
	
	for y=0, screen:height()/pApp:height() do
       for x=0, screen:width()/pApp:width() do

if Mp3me.vis(0) <= 100 then
end

if Mp3me.vis(0) <= 90 then
v = 50
screen:blit(x*pApp:width(), y*pApp:height(), pApp,scrollx, scrolly, pApp:width(), pApp:height(), true)
end

if Mp3me.vis(0) <= 80 then
v = 50
screen:blit(x*pApp1:width(), y*pApp1:height(), pApp1,scrollx, scrolly, pApp1:width(), pApp1:height(), true)
end


if Mp3me.vis(0) <= 70 then
v = 50
screen:blit(x*pApp2:width(), y*pApp2:height(), pApp2,scrollx, scrolly, pApp2:width(), pApp2:height(), true)
end


if Mp3me.vis(0) <= 60 then
v = -50
screen:blit(x*pApp3:width(), y*pApp3:height(), pApp3,scrollx, scrolly, pApp3:width(), pApp3:height(), true)
end

end
end


pad = Controls.read()

if pad:r() and not oldpad:r() then
if fbrowser.s < (fbrowser.nf + 1) then
i = fbrowser.s + 1
if i < (fbrowser.nf + 1) then
if string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".mp3" or
string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".MP3" then
fbrowser.s = fbrowser.s + 1
Mp3me.stop()
screen:clear()
Mp3me.load(fbrowser.fl[fbrowser.s].name)
Mp3me.play()
end
end
end
end

if pad:l() and not oldpad:l() then
if fbrowser.s < (fbrowser.nf + 1) and fbrowser.s > 2 then
i = fbrowser.s - 1
if i < (fbrowser.nf + 1) and i > 2 then
if string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".mp3" or
string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".MP3" then
Mp3me.stop()
screen:clear()
fbrowser.s = fbrowser.s - 1
Mp3me.load(fbrowser.fl[fbrowser.s].name)
Mp3me.play()
end
end
end
end

if pad:cross() and not oldpad:cross() then
Mp3me.pause()
end

if pad:left() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/Ibis/vmp316.lua")
exitMenu()
end

if pad:right() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/Ibis/vmp318.lua")
exitMenu()
end

if pad:triangle() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/menu.lua")
exitMenu()
end


if pad:start() then 
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/script1.lua")
exitMenu()
end


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


