--vmp3 by mrafenne



mov1 = 0
mov2 = 0
logo = Image.load("ms0:/PSP/GAME/vmp3 v1/images/logo.png")


val = 0
r = 0
p = 0

cube = {
	{0, 0, white, -1, -1,  1},
	{1, 0, white, -1,  1,  1},
	{1, 1, white,  1,  1,  1},

	{0, 0, white, -1, -1,  1},
	{1, 1, white,  1,  1,  1},
	{0, 1, white,  1, -1,  1},

	{0, 0, white, -1, -1, -1},
	{1, 0, white,  1, -1, -1},
	{1, 1, white,  1,  1, -1},

	{0, 0, white, -1, -1, -1},
	{1, 1, white,  1,  1, -1},
	{0, 1, white, -1,  1, -1},

	{0, 0, white,  1, -1, -1},
	{1, 0, white,  1, -1,  1},
	{1, 1, white,  1,  1,  1},

	{0, 0, white,  1, -1, -1},
	{1, 1, white,  1,  1,  1},
	{0, 1, white,  1,  1, -1},

	{0, 0, white, -1, -1, -1},
	{1, 0, white, -1,  1, -1},
	{1, 1, white, -1,  1,  1},

	{0, 0, white, -1, -1, -1},
	{1, 1, white, -1,  1,  1},
	{0, 1, white, -1, -1,  1},

	{0, 0, white, -1,  1, -1},
	{1, 0, white,  1,  1, -1},
	{1, 1, white,  1,  1,  1},

	{0, 0, white, -1,  1, -1},
	{1, 1, white,  1,  1,  1},
	{0, 1, white, -1,  1,  1},

	{0, 0, white, -1, -1, -1},
	{1, 0, white, -1, -1,  1},
	{1, 1, white,  1, -1,  1},

	{0, 0, white, -1, -1, -1},
	{1, 1, white,  1, -1,  1},
	{0, 1, white,  1, -1, -1},  

}      

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()
bg1 = nil
bg2 = nil
bg3 = nil
bg= nil
mov1 = nil
mov2 = nil
collectgarbage()
end


statut = "defaut"

while true do
Gu.start3d()

	Gu.clear(Gu.COLOR_BUFFER_BIT+Gu.DEPTH_BUFFER_BIT)
	Gum.matrixMode(Gu.PROJECTION)
	Gum.loadIdentity()
	Gum.perspective(110, 16/9, 0.5, 1000)

	Gum.matrixMode(Gu.VIEW)
	Gum.loadIdentity()
       Gum.lookAt(0, 0, 5, 0, 0, 0, 0, 1, 0);
       
 	Gu.enable(Gu.BLEND)
	Gu.blendFunc(Gu.ADD, Gu.SRC_ALPHA, Gu.ONE_MINUS_SRC_ALPHA, 0, 0)
	Gu.enable(Gu.TEXTURE_2D);	
       Gu.texImage(logo)
--	Gu.texImage(image)

	Gu.texScale( 1, 1)

	Gum.matrixMode(Gu.MODEL)
	Gum.loadIdentity()
	Gum.translate(0, 0, 0);

	Gum.rotateXYZ(val * 1 * (Gu.PI/180), val * 4.98 * (Gu.PI/180), val * 4.32 * (Gu.PI/180))
	Gum.drawArray(Gu.TRIANGLES, Gu.TEXTURE_32BITF+Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, cube)
       val = val + p

--	Gum.loadIdentity()
	Gum.translate(2.1, 0, 0);

       Gum.rotateXYZ(val * 20.79 * (Gu.PI/180), val * 4.98 * (Gu.PI/180), val * 4.32 * (Gu.PI/180))
	Gum.drawArray(Gu.TRIANGLES, Gu.TEXTURE_32BITF+Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, cube)

--	Gum.loadIdentity()
	Gum.translate(4.2, 0, 0);

	Gum.rotateXYZ(val * 10.79 * (Gu.PI/180), val * 4.98 * (Gu.PI/180), val * 4.32 * (Gu.PI/180))
	Gum.drawArray(Gu.TRIANGLES, Gu.TEXTURE_32BITF+Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, cube)


--	Gum.loadIdentity()
	Gum.translate(6.3, 0, 0);

	Gum.rotateXYZ(val * 10.79 * (Gu.PI/180), val * 4.98 * (Gu.PI/180), val * 4.32 * (Gu.PI/180))
	Gum.drawArray(Gu.TRIANGLES, Gu.TEXTURE_32BITF+Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, cube)


--	Gum.loadIdentity()
       Gum.translate(-2.1, 0, 0);

	Gum.rotateXYZ(val * 10.79 * (Gu.PI/180), val * 4.98 * (Gu.PI/180), val * 4.32 * (Gu.PI/180))
	Gum.drawArray(Gu.TRIANGLES, Gu.TEXTURE_32BITF+Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, cube)


--	Gum.loadIdentity()
	Gum.translate(-4.2, 0, 0);

	Gum.rotateXYZ(val * 10.79 * (Gu.PI/180), val * 4.98 * (Gu.PI/180), val * 4.32 * (Gu.PI/180))
	Gum.drawArray(Gu.TRIANGLES, Gu.TEXTURE_32BITF+Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, cube)

--	Gum.loadIdentity()
	Gum.translate(-6.3, 0, 0);

	Gum.rotateXYZ(val * 10.79 * (Gu.PI/180), val * 4.98 * (Gu.PI/180), val * 4.32 * (Gu.PI/180))
	Gum.drawArray(Gu.TRIANGLES, Gu.TEXTURE_32BITF+Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, cube)

      Gu.disable(Gu.TEXTURE_2D);
      Gu.disable(Gu.BLEND)
if Mp3me.vis(0) <= 100 then
p = 1.6
end
if Mp3me.vis(0) <= 90 then
p = 1.2
end
if Mp3me.vis(0) <= 80 then
p = 0.8
end
if Mp3me.vis(0) <= 70 then
p = 0.4
end
if Mp3me.vis(0) <= 60 then
p = 0 
end
if Mp3me.vis(0) <= 50 then
p = -0.4
end
if Mp3me.vis(0) <= 40 then
p = -0.8
end
if Mp3me.vis(0) <= 30 then
p = -1.2
end
if Mp3me.vis(0) <= 20 then
p = 1.6
end



	Gu.end3d()

pad = Controls.read()
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


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()
p = 0 
end

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

if pad:right() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/Ibis/vmp31.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


