Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
SFML.Window.Joystick
- data JoystickCap
- data JoystickAxis
- isJoystickConnected :: Int -> IO Bool
- getButtonCount :: Int -> IO Int
- hasAxis :: Int -> Int -> IO Bool
- isJoystickButtonPressed :: Int -> Int -> IO Bool
- getAxisPosition :: Int -> Int -> IO Float
- getJoystickIdentification :: Int -> IO JoystickIdentification
- updateJoystick :: IO ()
Documentation
data JoystickCap
Global joysticks capabilities
Constructors
JoystickCount | Maximum number of supported joysticks |
JoystickButtonCount | Maximum number of supported buttons |
JoystickAxisCount | Maximum number of supported axes |
Instances
data JoystickAxis
Axes supported by SFML joysticks
Constructors
JoystickX | The X axis |
JoystickY | The Y axis |
JoystickZ | The Z axis |
JoystickR | The R axis |
JoystickU | The U axis |
JoystickV | The V axis |
JoystickPovX | The X axis of the point-of-view hat |
JoystickPovY | The Y axis of the point-of-view hat |
Check if a joystick is connected.
Return the number of buttons supported by a joystick.
If the joystick is not connected, this function returns 0.
Check if a joystick supports a given axis.
If the joystick is not connected, this function returns False
.
Check if a joystick button is pressed.
If the joystick is not connected, this function returns False
.
Get the current position of a joystick axis.
If the joystick is not connected, this function returns 0.
Arguments
:: Int | Index of the joystick |
-> IO JoystickIdentification |
Get the joystick information.
The result of this function will only remain valid until the next time the function is called.
updateJoystick :: IO ()
Update the states of all joysticks.
This function is used internally by SFML, so you normally don't have to call it explicitely. However, you may need to call it if you have no window yet (or no window at all): in this case the joysticks states are not updated automatically.