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 

Help with screen blitting and controls!

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



Joined: 13 Dec 2005
Posts: 5

PostPosted: Fri Dec 16, 2005 12:47 pm    Post subject: Help with screen blitting and controls! Reply with quote

I'm a bit of a noob I know but hey I'm learning. I'm currently designing a "shell" because im bored and I can't think of a simple game to create. Anyway, I'm trying to work on the start menu, and whereas I can't get it to stay without letting go X. Is there anyway for it to stay when I let go X until I tap X on the start button? Here is my code below:
Code:

ystem.usbDiskModeActivate()
white = Color.new(255,255,255)
black = Color.new(0,0,0)
startbar = Image.load("./images/startbar.png")
wallpaper = Image.load("./images/wallpaper.png")
cursor = Image.load("./images/cursor.png")
taskbar = Image.load("./images/taskbar.png")
startbarlist = Image.load("./images/startbarlist.png")
startbarmouseover = Image.load("./images/startover.png")
startbarpushed = Image.load("./images/startpushed.png")
pointer_x = 480/2
pointer_y = 272/2
timefont = Font.createProportional()
timefont:setPixelSizes(0,10)
while true do
function startbar_()
   screen:blit(0,244,startbarpushed)
   screen:blit(0,1,startbarlist)
return
   end
   
   pad = Controls.read()
   dx = pad:analogX()
   dy = pad:analogY()
   
   if math.abs(dx) > 32 then
      pointer_x = pointer_x + dx / 32
      if pointer_x > 479 then
         pointer_x = 479
      end

      if pointer_x < 0 then
         pointer_x = 0
      end
   end

   if math.abs(dy) > 32 then
      pointer_y = pointer_y + dy / 32
      if pointer_y > 479 then
         pointer_y = 479
      end

      if pointer_y < 0 then
         pointer_y = 0
      end
   end
   

screen:blit(0,0,wallpaper)
screen:blit(0,245,startbar)
screen:blit(368,245,taskbar)
time = os.date("%I:%M %p")
screen:fontPrint(timefont,425,263,time)
   if pad:cross() and pointer_x < 95 and pointer_x >= 0 and pointer_y > 246 and pointer_y < 273 then
   startbar_()
   end
screen:blit(pointer_x, pointer_y, cursor)
screen.flip()
   if pad:start() then break end
   if pad:select() then screen:save("screenshot.jpg") end
   seconds=25
end


I'm nooby so try to explain it as leman as you can get :D.[/code]
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