Joystick

*Give access to the real-time state of the joysticks. * *Joystick provides an interface to the state of the joysticks. * *It only contains static functions, so it's not meant to be instanciated. Instead, each joystick is identified *by an index that is passed to the functions of this class. * *This class allows users to query the state of joysticks at any time and directly, without having to deal with *a window and its events. Compared to the JoystickMoved, JoystickButtonPressed and JoystickButtonReleased events, *Joystick can retrieve the state of axes and buttons of joysticks at any time (you don't need to store and update *a boolean on your side in order to know if a button is pressed or released), and you always get the real state of *joysticks, even if they are moved, pressed or released when your window is out of focus and no event is triggered.

Members

Enums

Axis
enum Axis

Axes supported by SFML joysticks.

JoystickCount
anonymousenum JoystickCount
Undocumented in source.

Static functions

getAxisPosition
float getAxisPosition(uint joystick, Axis axis)

Get the current position of a joystick axis.

getButtonCount
uint getButtonCount(uint joystick)

Return the number of buttons supported by a joystick.

hasAxis
bool hasAxis(uint joystick, Axis axis)

Check if a joystick supports a given axis.

isButtonPressed
bool isButtonPressed(uint joystick, uint button)

Check if a joystick button is pressed.

isConnected
bool isConnected(uint joystick)

Check if a joystick is connected.

update
void update()

Update the states of all joysticks.

Meta