Previous: , Up: Input   [Contents][Index]


3.3.4 Game Controllers

(use-modules (sdl2 input game-controller))
Procedure: load-game-controller-mappings! file

Load game controller mapping from file and return the number of mappings added this way.

See https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt for a community maintained controller mapping file.

Procedure: open-game-controller joystick-index

Return a game controller object for the physical joystick device associated with the joystick-index.

Procedure: close-game-controller controller

Close controller.

Procedure: game-controller? controller

Close controller.

Procedure: game-controller-attached? controller

Return #t if controller is currently in use.

Procedure: game-controller-joystick controller

Return the underlying joystick object associated with controller.

Procedure: game-controller-name controller

Return the human readable name for controller.

Procedure: game-controller-axis controller axis

Return a number in the range [-32768, 32767] representing the current state of axis on controller.

axis may be one of the following symbols:

Procedure: game-controller-button-pressed? controller button

Return #t if button is pressed on controller.

button may be one of the following symbols:

Procedure: game-controller-index? joystick-index

Return #t if joystick-index is a valid game controller index.