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 

Function help plz

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



Joined: 31 Aug 2005
Posts: 53

PostPosted: Mon Sep 12, 2005 10:52 am    Post subject: Function help plz Reply with quote

Can anyone help me turn this into a function? Im still haveing a few problems trying to learn functions.

Code:

      if usb==1 then
      System.usbDiskModeActivate()
      screen:blit(1, 3, usba)
      end
   
      if usb==0 then
      System.usbDiskModeDeactivate()
      end
   
      pad = Controls.read()
      if pad:select() then
         screen.waitVblankStart(20)
         if usb==1 then
         usb = 0
         else
         usb = 1
         end


_________________
I want my money back!?
Back to top
View user's profile Send private message
chaos



Joined: 10 Apr 2005
Posts: 135

PostPosted: Mon Sep 12, 2005 12:58 pm    Post subject: Reply with quote

Code:
-- a function to toggle usb mode
function toggleUSB()
   if usb==0 then
      System.usbDiskModeActivate()
      screen:blit(1, 3, usba)
      usb = 1
   else
      System.usbDiskModeDeactivate()
      usb = 0
   end
end

-- the rest of this should be in your main loop
pad = Controls.read()
if pad:select() then
   toggleUSB()
end

_________________
Chaosmachine Studios: High Quality Homebrew.
Back to top
View user's profile Send private message
2Xtremes2004



Joined: 31 Aug 2005
Posts: 53

PostPosted: Mon Sep 12, 2005 1:22 pm    Post subject: Reply with quote

thank you so much, this will give me a good example to help me learn more! Again, thx
_________________
I want my money back!?
Back to top
View user's profile Send private message
chaos



Joined: 10 Apr 2005
Posts: 135

PostPosted: Mon Sep 12, 2005 1:34 pm    Post subject: Reply with quote

glad i could help.
_________________
Chaosmachine Studios: High Quality Homebrew.
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