Page 1 of 1
How to check if the mousebutton was pressed or released.
Posted: Thu May 12, 2005 11:38 pm
by Joakim Christiansen
Code: Select all
;0=false, 1=pressed, 2=down, 3=released
If MouseButton(1)
If MB_Left = 0
MB_Left = 1
Else
MB_Left = 2
EndIf
Else
If MB_Left = 3
MB_Left = 0
ElseIf MB_Left = 2
MB_Left = 3
EndIf
EndIf
This should be placed in the main loop after ExamineMouse().
Posted: Tue May 17, 2005 7:57 am
by Psychophanta
Nice!
This is the way i used to do it:
Code: Select all
If MouseButton(1);<-if current key status is PUSHED
If pka.b=0:pka.b=1:EndIf;<-if previous key status was NOT PUSHED
ElseIf pka.b;<-else (if previous key status was PUSHED and current key status is NOT PUSHED):
pka.b=0;<-set previous key status to NOT PUSHED.
EndIf
Yours is more complete, because it detects the releasing edge too. Mine only detects the pressing edge.