--vmp3 by mrafenne



mov1 = 0
mov2 = 0

val = 0
r = 0
red = Color.new(255, 0, 0)
blue = Color.new(0, 0, 255)
black = Color.new(0, 0, 0)
gray = Color.new(128, 128, 128)
cyan = Color.new(100, 255, 255)
monoSpaced = Font.createMonoSpaced()
proportional = Font.createProportional()
proportionalBig = Font.createProportional()
proportional:setPixelSizes(0, 32)
proportionalBig:setPixelSizes(0, 64)
monoSpaced:setPixelSizes(0, 14)


cube = {
       {red, -1, -1, 1}, 
       {red, -1,  1, 1}, 
       {red,  1,  1, 1}, 

       {red, -1, -1, 1}, 
       {red,  1,  1, 1}, 
       {red,  1, -1, 1}, 

       {red, -1, -1, -1}, 
       {red, 1, -1,  -1}, 
       {red, 1,  1,  -1},
 
       {red, -1, -1, -1}, 
       {red,  1,  1, -1}, 
       {red, -1,  1, -1},
 
       {green, 1, -1, -1}, 
       {green, 1, -1,  1}, 
       {green, 1,  1,  1}, 

       {green, 1, -1, -1}, 
       {green, 1,  1,  1}, 
       {green, 1,  1, -1}, 

       {green, -1, -1, -1}, 
       {green, -1,  1, -1}, 
       {green, -1,  1,  1}, 

       {green, -1, -1, -1}, 
       {green, -1,  1,  1}, 
       {green, -1, -1,  1}, 

       {blue, -1,  1, -1}, 
       {blue,  1,  1, -1}, 
       {blue,  1,  1,  1}, 

       {blue, -1,  1, -1}, 
       {blue,  1,  1,  1}, 
       {blue, -1,  1,  1}, 
 
       {blue, -1, -1, -1}, 
       {blue, -1, -1,  1}, 
       {blue,  1, -1,  1}, 

       {blue, -1, -1, -1}, 
       {blue,  1, -1,  1}, 
       {blue,  1, -1, -1}, 
}
plane = {
       {blue, -8, -3, 0},
       {cyan,  8,  3, 0},
       {blue,  8, -3, 0},
       {cyan,  8,  3, 0},
       {blue, -8, -3, 0},
       {cyan, -8,  3, 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"

while true do
Gu.start3d()

if Mp3me.vis(0) <= 100 then
r = -1.3
end
if Mp3me.vis(0) <= 90 then
r = -1.4
end
if Mp3me.vis(0) <= 80 then
r = -1.5
end
if Mp3me.vis(0) <= 70 then
r = -1.6
end
if Mp3me.vis(0) <= 60 then
r = -1.7
end
if Mp3me.vis(0) <= 50 then
r = -1.8
end
if Mp3me.vis(0) <= 40 then
r = -1.9
end
if Mp3me.vis(0) <= 30 then
r = -2.0
end
if Mp3me.vis(0) <= 20 then
r = -2.1
end

      Gu.clear(Gu.COLOR_BUFFER_BIT+Gu.DEPTH_BUFFER_BIT)
      Gum.matrixMode(Gu.PROJECTION)
      Gum.loadIdentity()
      Gum.perspective(90, 480/272, 0.5, 1000) 

      Gum.matrixMode(Gu.VIEW)
      Gum.loadIdentity()
      Gum.matrixMode(Gu.MODEL)
      Gum.loadIdentity()
      Gum.translate(0, 0, -3);
      Gu.disable(Gu.TEXTURE_2D)
      Gum.drawArray(Gu.TRIANGLES, Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, plane)
      Gum.matrixMode(Gu.MODEL)
      Gum.loadIdentity()
      Gum.translate(0, 0, r);
      Gum.rotateXYZ(val * 1.79 * (Gu.PI/180), val * 0.98 * (Gu.PI/180.0), val * 1.32 * (Gu.PI/360.0))
      Gum.drawArray(Gu.TRIANGLES, Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, cube)
      val = val + 1


      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()
end

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

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

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


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


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


