Next: , Previous: Events, Up: Top   [Contents][Index]


5 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-event-state state

NB: This procedure is obsoleted by joystick-polling and will be removed after 2013-12-31.

Set or query the state of internal joystick event processing, based on state (a symbol). If state is SDL_QUERY, return the current state. If it is SDL_IGNORE or SDL_ENABLE, disable or enable, respectively, internal joystick event processing and return state. When enabled, it is not necessary to call joystick-update.

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-ball joystick n

NB: This procedure is obsoleted by joystick-ball-xy and will be removed after 2013-12-31.

For joystick, return relative motion of trackball n, as an alist with keys dx and dy. If n is invalid, return #f.

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: , Previous: Events, Up: Top   [Contents][Index]