Name
JoyFire -- check if Joystick button is pressed (V1.5)
Synopsis
pressed = JoyFire(port[, button])
Function
This function returns True if a button of the Joystick plugged into the port specified by port has been pressed. Otherwise False is returned. The optional argument button specifies which button to look for. If you are looking for a specific button, specify the number of this button (must be between 1 and 32). If you are looking for multiple buttons, specify 0 and this function will return a 32-bit mask in which each of the 32 bits indicates the state of the button (pressed or not pressed).

port can range from 0 to the number of joysticks currently plugged in minus 1. You can find out the number of currently plugged in joysticks using the CountJoysticks() function. Please note that under AmigaOS, port 0 refers to the standard joystick port although this is in reality port 1. Hollywood does it this way just for cross-platform consistency: Port 0 shall always refer to the default joystick.

Inputs
port
port number (usually 0 for the standard Joystick port)
button
optional: button to look for or 0 for all buttons (defaults to 1 which means look for first, i.e. fire, button) (V4.6)
Results
pressed
True if button is pressed, otherwise FALSE; if you passed 0 for button, then this will be a 32-bit mask indicating the states of all 32 buttons
Example
While(fire = FALSE)
  fire = JoyFire(0)
  Wait(2)
Wend
The above code waits until the user presses fire.

Show TOC