GetJoy ([port])  

Definition:

Checks to see if a joystick button has been pressed - returns the number of the button or 0 if no button is pressed.

Parameter Description:


port = optional joystick port to read

Command Description:

Unlike the other similar commands (JoyDown and JoyHit), this command doesn't need to know which button you are trying to test for. It looks for any joystick button, then returns the number the user pressed. Since you are polling all the buttons instead of just a specific one, this may be a tad less efficient than using JoyDown or JoyHit. Use this command in conjunction with Select/Case for maximum efficiency!

Example:

; GetJoy Example

While Not KeyHit(1)
button=GetJoy()
If button <> 0 Then
Print "You pressed joystick button #" + button
End If
Wend

Index