Name
JoyDir -- return direction of Joystick (V1.5)
Synopsis
dir = JoyDir(port)
Function
This function returns the direction of the Joystick plugged into the port specified by port.

One of the following states will be returned:

#JOYUP
Joystick direction is up
#JOYUPRIGHT
Joystick direction is up-right
#JOYRIGHT
Joystick direction is right
#JOYDOWNRIGHT
Joystick direction is down-right
#JOYDOWN
Joystick direction is down
#JOYDOWNLEFT
Joystick direction is down-left
#JOYLEFT
Joystick direction is left
#JOYUPLEFT
Joystick direction is up-left
#JOYNODIR
no direction selected

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)
Results
dir
current Joystick state (as listed above)
Example
While(state <> #JOYRIGHT)
  state = JoyDir(0)
  Wait(2)
Wend
The above code waits until the user moves the Joystick in port 0 to right.

Show TOC