Safe Haskell | None |
---|---|
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
ControllerButtonInvalid | |
ControllerButtonA | |
ControllerButtonB | |
ControllerButtonX | |
ControllerButtonY | |
ControllerButtonBack | |
ControllerButtonGuide | |
ControllerButtonStart | |
ControllerButtonLeftStick | |
ControllerButtonRightStick | |
ControllerButtonLeftShoulder | |
ControllerButtonRightShoulder | |
ControllerButtonDpadUp | |
ControllerButtonDpadDown | |
ControllerButtonDpadLeft | |
ControllerButtonDpadRight |
Instances
Data ControllerButton Source # | |||||
Defined in SDL.Input.GameController Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ControllerButton -> c ControllerButton # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ControllerButton # toConstr :: ControllerButton -> Constr # dataTypeOf :: ControllerButton -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ControllerButton) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ControllerButton) # gmapT :: (forall b. Data b => b -> b) -> ControllerButton -> ControllerButton # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ControllerButton -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ControllerButton -> r # gmapQ :: (forall d. Data d => d -> u) -> ControllerButton -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ControllerButton -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ControllerButton -> m ControllerButton # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ControllerButton -> m ControllerButton # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ControllerButton -> m ControllerButton # | |||||
Generic ControllerButton Source # | |||||
Defined in SDL.Input.GameController Associated Types
Methods from :: ControllerButton -> Rep ControllerButton x # to :: Rep ControllerButton x -> ControllerButton # | |||||
Read ControllerButton Source # | |||||
Defined in SDL.Input.GameController Methods readsPrec :: Int -> ReadS ControllerButton # readList :: ReadS [ControllerButton] # | |||||
Show ControllerButton Source # | |||||
Defined in SDL.Input.GameController Methods showsPrec :: Int -> ControllerButton -> ShowS # show :: ControllerButton -> String # showList :: [ControllerButton] -> ShowS # | |||||
Eq ControllerButton Source # | |||||
Defined in SDL.Input.GameController Methods (==) :: ControllerButton -> ControllerButton -> Bool # (/=) :: ControllerButton -> ControllerButton -> Bool # | |||||
Ord ControllerButton Source # | |||||
Defined in SDL.Input.GameController Methods compare :: ControllerButton -> ControllerButton -> Ordering # (<) :: ControllerButton -> ControllerButton -> Bool # (<=) :: ControllerButton -> ControllerButton -> Bool # (>) :: ControllerButton -> ControllerButton -> Bool # (>=) :: ControllerButton -> ControllerButton -> Bool # max :: ControllerButton -> ControllerButton -> ControllerButton # min :: ControllerButton -> ControllerButton -> ControllerButton # | |||||
FromNumber ControllerButton Int32 Source # | |||||
Defined in SDL.Input.GameController Methods fromNumber :: Int32 -> ControllerButton Source # | |||||
ToNumber ControllerButton Int32 Source # | |||||
Defined in SDL.Input.GameController Methods toNumber :: ControllerButton -> Int32 Source # | |||||
type Rep ControllerButton Source # | |||||
Defined in SDL.Input.GameController type Rep ControllerButton = D1 ('MetaData "ControllerButton" "SDL.Input.GameController" "sdl2-2.5.5.1-Bzr9Ol9UwiR7yGdwAXZbf7" 'False) ((((C1 ('MetaCons "ControllerButtonInvalid" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerButtonA" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ControllerButtonB" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerButtonX" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ControllerButtonY" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerButtonBack" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ControllerButtonGuide" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerButtonStart" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "ControllerButtonLeftStick" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerButtonRightStick" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ControllerButtonLeftShoulder" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerButtonRightShoulder" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ControllerButtonDpadUp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerButtonDpadDown" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ControllerButtonDpadLeft" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerButtonDpadRight" 'PrefixI 'False) (U1 :: Type -> Type))))) |
data ControllerButtonState Source #
Identifies the state of a controller button.
Instances
Data ControllerButtonState Source # | |||||
Defined in SDL.Input.GameController Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ControllerButtonState -> c ControllerButtonState # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ControllerButtonState # toConstr :: ControllerButtonState -> Constr # dataTypeOf :: ControllerButtonState -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ControllerButtonState) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ControllerButtonState) # gmapT :: (forall b. Data b => b -> b) -> ControllerButtonState -> ControllerButtonState # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ControllerButtonState -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ControllerButtonState -> r # gmapQ :: (forall d. Data d => d -> u) -> ControllerButtonState -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ControllerButtonState -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ControllerButtonState -> m ControllerButtonState # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ControllerButtonState -> m ControllerButtonState # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ControllerButtonState -> m ControllerButtonState # | |||||
Generic ControllerButtonState Source # | |||||
Defined in SDL.Input.GameController Associated Types
Methods from :: ControllerButtonState -> Rep ControllerButtonState x # to :: Rep ControllerButtonState x -> ControllerButtonState # | |||||
Read ControllerButtonState Source # | |||||
Defined in SDL.Input.GameController Methods readsPrec :: Int -> ReadS ControllerButtonState # readList :: ReadS [ControllerButtonState] # | |||||
Show ControllerButtonState Source # | |||||
Defined in SDL.Input.GameController Methods showsPrec :: Int -> ControllerButtonState -> ShowS # show :: ControllerButtonState -> String # showList :: [ControllerButtonState] -> ShowS # | |||||
Eq ControllerButtonState Source # | |||||
Defined in SDL.Input.GameController Methods (==) :: ControllerButtonState -> ControllerButtonState -> Bool # (/=) :: ControllerButtonState -> ControllerButtonState -> Bool # | |||||
Ord ControllerButtonState Source # | |||||
Defined in SDL.Input.GameController Methods compare :: ControllerButtonState -> ControllerButtonState -> Ordering # (<) :: ControllerButtonState -> ControllerButtonState -> Bool # (<=) :: ControllerButtonState -> ControllerButtonState -> Bool # (>) :: ControllerButtonState -> ControllerButtonState -> Bool # (>=) :: ControllerButtonState -> ControllerButtonState -> Bool # max :: ControllerButtonState -> ControllerButtonState -> ControllerButtonState # min :: ControllerButtonState -> ControllerButtonState -> ControllerButtonState # | |||||
FromNumber ControllerButtonState Word32 Source # | |||||
Defined in SDL.Input.GameController Methods | |||||
type Rep ControllerButtonState Source # | |||||
Defined in SDL.Input.GameController type Rep ControllerButtonState = D1 ('MetaData "ControllerButtonState" "SDL.Input.GameController" "sdl2-2.5.5.1-Bzr9Ol9UwiR7yGdwAXZbf7" 'False) (C1 ('MetaCons "ControllerButtonPressed" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ControllerButtonReleased" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerButtonInvalidState" 'PrefixI 'False) (U1 :: Type -> Type))) |
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
Data ControllerAxis Source # | |||||
Defined in SDL.Input.GameController Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ControllerAxis -> c ControllerAxis # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ControllerAxis # toConstr :: ControllerAxis -> Constr # dataTypeOf :: ControllerAxis -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ControllerAxis) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ControllerAxis) # gmapT :: (forall b. Data b => b -> b) -> ControllerAxis -> ControllerAxis # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ControllerAxis -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ControllerAxis -> r # gmapQ :: (forall d. Data d => d -> u) -> ControllerAxis -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ControllerAxis -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ControllerAxis -> m ControllerAxis # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ControllerAxis -> m ControllerAxis # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ControllerAxis -> m ControllerAxis # | |||||
Generic ControllerAxis Source # | |||||
Defined in SDL.Input.GameController Associated Types
Methods from :: ControllerAxis -> Rep ControllerAxis x # to :: Rep ControllerAxis x -> ControllerAxis # | |||||
Read ControllerAxis Source # | |||||
Defined in SDL.Input.GameController Methods readsPrec :: Int -> ReadS ControllerAxis # readList :: ReadS [ControllerAxis] # | |||||
Show ControllerAxis Source # | |||||
Defined in SDL.Input.GameController Methods showsPrec :: Int -> ControllerAxis -> ShowS # show :: ControllerAxis -> String # showList :: [ControllerAxis] -> ShowS # | |||||
Eq ControllerAxis Source # | |||||
Defined in SDL.Input.GameController Methods (==) :: ControllerAxis -> ControllerAxis -> Bool # (/=) :: ControllerAxis -> ControllerAxis -> Bool # | |||||
Ord ControllerAxis Source # | |||||
Defined in SDL.Input.GameController Methods compare :: ControllerAxis -> ControllerAxis -> Ordering # (<) :: ControllerAxis -> ControllerAxis -> Bool # (<=) :: ControllerAxis -> ControllerAxis -> Bool # (>) :: ControllerAxis -> ControllerAxis -> Bool # (>=) :: ControllerAxis -> ControllerAxis -> Bool # max :: ControllerAxis -> ControllerAxis -> ControllerAxis # min :: ControllerAxis -> ControllerAxis -> ControllerAxis # | |||||
FromNumber ControllerAxis Int32 Source # | |||||
Defined in SDL.Input.GameController Methods fromNumber :: Int32 -> ControllerAxis Source # | |||||
ToNumber ControllerAxis Int32 Source # | |||||
Defined in SDL.Input.GameController Methods toNumber :: ControllerAxis -> Int32 Source # | |||||
type Rep ControllerAxis Source # | |||||
Defined in SDL.Input.GameController type Rep ControllerAxis = D1 ('MetaData "ControllerAxis" "SDL.Input.GameController" "sdl2-2.5.5.1-Bzr9Ol9UwiR7yGdwAXZbf7" 'False) (((C1 ('MetaCons "ControllerAxisInvalid" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerAxisLeftX" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ControllerAxisLeftY" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerAxisRightX" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ControllerAxisRightY" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerAxisTriggerLeft" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ControllerAxisTriggerRight" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerAxisMax" 'PrefixI 'False) (U1 :: Type -> Type)))) |
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.
Instances
Data ControllerDeviceConnection Source # | |||||
Defined in SDL.Input.GameController Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ControllerDeviceConnection -> c ControllerDeviceConnection # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ControllerDeviceConnection # toConstr :: ControllerDeviceConnection -> Constr # dataTypeOf :: ControllerDeviceConnection -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ControllerDeviceConnection) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ControllerDeviceConnection) # gmapT :: (forall b. Data b => b -> b) -> ControllerDeviceConnection -> ControllerDeviceConnection # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ControllerDeviceConnection -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ControllerDeviceConnection -> r # gmapQ :: (forall d. Data d => d -> u) -> ControllerDeviceConnection -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ControllerDeviceConnection -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ControllerDeviceConnection -> m ControllerDeviceConnection # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ControllerDeviceConnection -> m ControllerDeviceConnection # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ControllerDeviceConnection -> m ControllerDeviceConnection # | |||||
Generic ControllerDeviceConnection Source # | |||||
Defined in SDL.Input.GameController Associated Types
Methods from :: ControllerDeviceConnection -> Rep ControllerDeviceConnection x # to :: Rep ControllerDeviceConnection x -> ControllerDeviceConnection # | |||||
Read ControllerDeviceConnection Source # | |||||
Defined in SDL.Input.GameController | |||||
Show ControllerDeviceConnection Source # | |||||
Defined in SDL.Input.GameController Methods showsPrec :: Int -> ControllerDeviceConnection -> ShowS # show :: ControllerDeviceConnection -> String # showList :: [ControllerDeviceConnection] -> ShowS # | |||||
Eq ControllerDeviceConnection Source # | |||||
Defined in SDL.Input.GameController Methods (==) :: ControllerDeviceConnection -> ControllerDeviceConnection -> Bool # (/=) :: ControllerDeviceConnection -> ControllerDeviceConnection -> Bool # | |||||
Ord ControllerDeviceConnection Source # | |||||
Defined in SDL.Input.GameController Methods compare :: ControllerDeviceConnection -> ControllerDeviceConnection -> Ordering # (<) :: ControllerDeviceConnection -> ControllerDeviceConnection -> Bool # (<=) :: ControllerDeviceConnection -> ControllerDeviceConnection -> Bool # (>) :: ControllerDeviceConnection -> ControllerDeviceConnection -> Bool # (>=) :: ControllerDeviceConnection -> ControllerDeviceConnection -> Bool # max :: ControllerDeviceConnection -> ControllerDeviceConnection -> ControllerDeviceConnection # min :: ControllerDeviceConnection -> ControllerDeviceConnection -> ControllerDeviceConnection # | |||||
FromNumber ControllerDeviceConnection Word32 Source # | |||||
Defined in SDL.Input.GameController Methods | |||||
type Rep ControllerDeviceConnection Source # | |||||
Defined in SDL.Input.GameController type Rep ControllerDeviceConnection = D1 ('MetaData "ControllerDeviceConnection" "SDL.Input.GameController" "sdl2-2.5.5.1-Bzr9Ol9UwiR7yGdwAXZbf7" 'False) (C1 ('MetaCons "ControllerDeviceAdded" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ControllerDeviceRemoved" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ControllerDeviceRemapped" 'PrefixI 'False) (U1 :: Type -> Type))) |