| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
SDL.Input.GameController
Synopsis
- data ControllerDevice = ControllerDevice {}
- availableControllers :: MonadIO m => m (Vector ControllerDevice)
- openController :: (Functor m, MonadIO m) => ControllerDevice -> m GameController
- closeController :: MonadIO m => GameController -> m ()
- controllerAttached :: MonadIO m => GameController -> m Bool
- getControllerID :: MonadIO m => GameController -> m Int32
- controllerMapping :: MonadIO m => GameController -> m Text
- addControllerMapping :: MonadIO m => ByteString -> m ()
- addControllerMappingsFromFile :: MonadIO m => FilePath -> m ()
- data ControllerButton
- = ControllerButtonInvalid
- | ControllerButtonA
- | ControllerButtonB
- | ControllerButtonX
- | ControllerButtonY
- | ControllerButtonBack
- | ControllerButtonGuide
- | ControllerButtonStart
- | ControllerButtonLeftStick
- | ControllerButtonRightStick
- | ControllerButtonLeftShoulder
- | ControllerButtonRightShoulder
- | ControllerButtonDpadUp
- | ControllerButtonDpadDown
- | ControllerButtonDpadLeft
- | ControllerButtonDpadRight
- data ControllerButtonState
- controllerButton :: MonadIO m => GameController -> ControllerButton -> m ControllerButtonState
- data ControllerAxis
- controllerAxis :: MonadIO m => GameController -> ControllerAxis -> m Int16
- data ControllerDeviceConnection
Documentation
data ControllerDevice Source #
A description of game controller that can be opened using openController.
To retrieve a list of connected game controllers, use availableControllers.
Constructors
| ControllerDevice | |
Fields | |
Instances
availableControllers :: MonadIO m => m (Vector ControllerDevice) Source #
Enumerate all connected Controllers, retrieving a description of each.
Arguments
| :: (Functor m, MonadIO m) | |
| => ControllerDevice | The device to open. Use |
| -> m GameController |
Open a controller so that you can start receiving events from interaction with this controller.
See SDL_GameControllerOpen for C documentation.
closeController :: MonadIO m => GameController -> m () Source #
Close a controller previously opened with openController.
See SDL_GameControllerClose for C documentation.
controllerAttached :: MonadIO m => GameController -> m Bool Source #
Check if a controller has been opened and is currently connected.
See SDL_GameControllerGetAttached for C documentation.
getControllerID :: MonadIO m => GameController -> m Int32 Source #
Get the instance ID of an opened controller. The instance ID is used to identify the controller in future SDL events.
See SDL_GameControllerInstanceID for C documentation.
controllerMapping :: MonadIO m => GameController -> m Text Source #
Get the current mapping of a Game Controller.
See SDL_GameControllerMapping for C documentation.
addControllerMapping :: MonadIO m => ByteString -> m () Source #
Add support for controllers that SDL is unaware of or to cause an existing controller to have a different binding.
See SDL_GameControllerAddMapping for C documentation.
addControllerMappingsFromFile :: MonadIO m => FilePath -> m () Source #
Use this function to load a set of Game Controller mappings from a file, filtered by the
current SDL_GetPlatform(). A community sourced database of controllers is available
here
(on GitHub).
See SDL_GameControllerAddMappingsFromFile for C documentation.
data ControllerButton Source #
Identifies a gamepad button.
Constructors
Instances
data ControllerButtonState Source #
Identifies the state of a controller button.
Instances
controllerButton :: MonadIO m => GameController -> ControllerButton -> m ControllerButtonState Source #
Get the current state of a button on a game controller.
See SDL_GameControllerGetButton for C documentation.
data ControllerAxis Source #
Constructors
| ControllerAxisInvalid | |
| ControllerAxisLeftX | |
| ControllerAxisLeftY | |
| ControllerAxisRightX | |
| ControllerAxisRightY | |
| ControllerAxisTriggerLeft | |
| ControllerAxisTriggerRight | |
| ControllerAxisMax |
Instances
controllerAxis :: MonadIO m => GameController -> ControllerAxis -> m Int16 Source #
Get the current state of an axis control on a game controller.
See SDL_GameControllerGetAxis for C documentation.
data ControllerDeviceConnection Source #
Identifies whether the game controller was added, removed, or remapped.