Next: , Previous: , Up: The (sdl *) Modules   [Contents][Index]


5 Joystick

The external representation of a Joystick object is:

#<SDL-Joystick index>

where index is a decimal number of the joystick, or ‘-1’ if the object is not associated with a joystick.

Procedure: num-joysticks

Return the number of joysticks.

Procedure: joystick? obj

Return #t iff obj is a joystick object.

Procedure: joystick-name [n]

Return the (string) name of the default joystick, or #f. Optional arg n specifies which joystick to check.

Procedure: joystick-open [n]

Return a handle to the default joystick opened for use. Optional arg n specifies which joystick to open.

Procedure: joystick-opened? [n]

Return #t iff the default joystick is opened. Optional arg n specifies which joystick to check.

Procedure: joystick-index joystick

Return the index of joystick.

Procedure: joystick-num-axes joystick

Return the number of axes for joystick.

Procedure: joystick-num-balls joystick

Return the number trackballs for joystick.

Procedure: joystick-num-hats joystick

Return the number of hats for joystick.

Procedure: joystick-num-buttons joystick

Return number of buttons for joystick.

Procedure: joystick-update

Update the state of all Joysticks.

Procedure: joystick-polling [setting]

Return #t if joystick events are polled and queued (such that it is unnecessary to “manually” call joystick-update), otherwise #f. If setting is specified, set joystick events polling to the truth value of setting first.

Procedure: joystick-get-axis joystick axis

For joystick, return state of axis.

Procedure: joystick-ball-xy joystick n

Return relative motion of joystick trackball n as two values: dx and dy (both integers).

Procedure: joystick-get-hat joystick n

For joystick, return state of hat n.

Procedure: joystick-get-button joystick n

For joystick, return state of button n, a symbol, one of: released or pressed.

Procedure: joystick-close joystick

Close a previously opened joystick.


Next: CDROM, Previous: Events, Up: The (sdl *) Modules   [Contents][Index]