forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

My first Lua menu :)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Ngel



Joined: 23 Nov 2005
Posts: 4

PostPosted: Mon Jan 23, 2006 1:38 am    Post subject: My first Lua menu :) Reply with quote

It's my first project and i really love to use lua!!!
I will get my new psp in the end of this month, hope it would be 1.5 :\
Here is the code:

Code:

-- Ngel V1.0 Menu Test !

green = Color.new(0, 255, 0)
select = 10
icon = Image.load("icon.png")


function delay(delay)
   for i = 1,delay do
   end
end

function choice(cho)
      screen:clear()
   if cho == 1 then
      screen:print(200, 200, "Option 1", green)
   end
   if cho == 2 then
      screen:print(200, 200, "Option 2", green)
   end
   if cho == 3 then
      screen:print(200, 200, "Option 3", green)
   end
   makemenu("0")
end

function makemenu(place)
if place == "down" then
   if select < 70 then
      select = select +30
      screen:clear()
   end
elseif place == "up" then
   if select > 10 then
      select = select - 30
      screen:clear()
   end
end
screen:print(200, 10, "Option 1", green)
screen:print(200, 40, "Option 2", green)
screen:print(200, 70, "Option 3", green)
screen:blit(177, select-6, icon)
screen.flip()
screen.waitVblankStart()
end

makemenu()

while true do
   pad = Controls.read()
   if pad:down() then
      makemenu("down")
      delay("9199900")
   end
   if pad:up() then
      makemenu("up")
      delay("9199900")
   end
   if pad:start() then
      break
   end
   if pad:select() then
      if select == 10 then
      choice(1)
      delay("9199900")
      end
      if select ==40 then
      choice(2)
      delay("9199900")
      end
      if select ==70 then
      choice(3)
      delay("9199900")
      end
   end   
end


Here is the icon.png:


fixed the problem!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group