Reads joystick buttons or other multi-media input devices.
Bool = Strig(n)
Strig(0) - Checks if the first button of the first joystick has been pressed.
Strig(1) - Checks if the first button of the first joystick is currently being pressed
Strig(2) - Checks if the first button of second joystick has been pressed.
Strig(3) - Checks if the first button of the second joystick is currently being pressed.
Strig(4) - Checks if the second button of the first joystick has been pressed.
Strig(5) - Checks if the second button of the first joystick is currently being pressed
Strig(6) - Checks if the second button of second joystick has been pressed.
Strig(7) - Checks if the second button of the second joystick is currently being pressed.
The odd numbers return -1 if the corresponding buttons are held down. The even numbers return -1 only once if the buttons are just pressed down, then they return 0.
// Mousek added to prevent infintie loops...
// ...if no joystick plugged in or...
// ...joystick not working correctly.
Auto x_bot%, x_mid%, x_top%, y_bot%, y_mid%, y_top%
Print "Centre and Click:"
Repeat
x_mid% = Stick(0), y_mid% = Stick(1)
Until Strig(0) Or MouseK = 1
Print "Top/Left And Click:"
Repeat
x_top% = Stick(0), y_top% = Stick(1)
Until Strig(0) Or MouseK = 2
Print "Bottom/Right And Click:"
Repeat
x_bot% = Stick(0), y_bot% = Stick(1)
Until Strig(0) Or MouseK = 1
The Joystick functions use the Windows multi media functions (joyGetPos) to read the joystick, not the interrupts as in GFA-BASIC 16.
{Created by Sjouke Hamstra; Last updated: 23/10/2014 by James Gaite}