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 

Button help

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



Joined: 24 Aug 2005
Posts: 2

PostPosted: Wed Aug 24, 2005 2:26 pm    Post subject: Button help Reply with quote

Ok, I have the code to see when you press a button. But I only want it to go through the code for the button press once while its held down. now it does it every time it goes through the main loop. Is there a way to tell when its lifted so it will only work when they lift the button?
Back to top
View user's profile Send private message
Arwin



Joined: 12 Jul 2005
Posts: 426

PostPosted: Wed Aug 24, 2005 4:44 pm    Post subject: Re: Button help Reply with quote

jivemasta wrote:
Ok, I have the code to see when you press a button. But I only want it to go through the code for the button press once while its held down. now it does it every time it goes through the main loop. Is there a way to tell when its lifted so it will only work when they lift the button?


You could set a variable when it is pressed, and then keep your loop going while that variable is true, until the

crossdetected = true
ispressed = true
while ispressed
pad.read()
if pad:cross()
crossdetected = true
else
if crossdetected
crossdetected is false
endif
endif
wend

But I think there was another way, something like pad:_cross(), the underscore indicating that there was a release. You should look at the example Shine gave in my thread on button presses, as that one distinguishes between presses and releases.
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