numJoysticks()
name(Index)
open(Index)
opened(Index)
index(Joystick)
numAxes(Joystick)
numBalls(Joystick)
numHats(Joystick)
numButtons(Joystick)
update()
getAxis(Joystick, Axis)
getHat(Joystick, Hat)
getButton(Joystick, Button)
getBall(Joystick, Ball)
close(Joystick) Args: none
Returns: Number of joysticks
C-API: int SDL_NumJoysticks(void);
Desc:
Count the number of joysticks attached to the system
Args: JoystickIndex
Returns: Name (List)
C-API: char *SDL_JoystickName(int device_index);
Desc:
Get the implementation dependent name of a joystick. This can be called before any joysticks are opened. If no name can be found, this function returns NULL.
Args: JoystickIndex
Returns: Joystick or exits
C-API: SDL_Joystick *SDL_JoystickOpen(int device_index);
Desc:
Open a joystick for use - the index passed as an argument refers to the N'th joystick on the system. This index is the value which will identify this joystick in future joystick events. This function returns a joystick identifier, or NULL if an error occurred.
Args: JoystickIndex
Returns: true or false
C-API: int SDL_JoystickOpened(int device_index);
Desc:
Returns true if the joystick has been opened, or false if it has not.
Args: Joystick
Returns: index
C-API: int SDL_JoystickIndex(SDL_Joystick *joystick);
Desc:
Get the device index of an opened joystick.
Args: Joystick
Returns: no of axes
C-API: int SDL_JoystickNumAxes(SDL_Joystick *joystick);
Desc:
Get the number of general axis controls on a joystick
Args: Joystick
Returns: no of balls
C-API: int SDL_JoystickNumBalls(SDL_Joystick *joystick);
Desc:
Get the number of trackballs on a joystick Joystick trackballs have only relative motion events associated with them and their state cannot be polled.
Args: Joystick
Returns: no of Hats
C-API: int SDL_JoystickNumHats(SDL_Joystick *joystick);
Desc:
Get the number of POV hats on a joystick
Args: Joystick
Returns: no of Buttons
C-API: int SDL_JoystickNumButtons(SDL_Joystick *joystick);
Desc:
Get the number of buttons on a joystick
Args: none
Returns: none
C-API: void SDL_JoystickUpdate(void);
Desc:
Update the current state of the open joysticks. This is called automatically by the event loop if any joystick events are enabled.
Args: Joystick, Axis
Returns: State (Int range: -32768 to 32767)
C-API: Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
Desc:
Get the current state of an axis control on a joystick The state is a value ranging from -32768 to 32767. The axis indices start at index 0.
Args: Joystick, Hat
Returns: HatState
C-API: Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
Desc:
Get the current state of a POV hat on a joystick The return value is one of the following positions in sdl_joystick.hrl The hat indices start at index 0.
Args: Joystick, Button
Returns: State
C-API: Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
Desc:
Get the current state of a button on a joystick The button indices start at index 0.
Args: Joystick, Ball
Returns: {DX, DY} or badarg
C-API: int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
Desc:
Get the ball axis change since the last poll This returns 0, or -1 if you passed it invalid parameters. The ball indices start at index 0.
Args: Joystick
Returns: none
C-API: void SDL_JoystickClose(SDL_Joystick *joystick);
Desc:
Close a joystick previously opened with SDL_JoystickOpen()