22 #ifndef FIFE_EVENTCHANNEL_JOYSTICK_H 23 #define FIFE_EVENTCHANNEL_JOYSTICK_H 93 Joystick(int32_t joystickId, int32_t deviceIndex);
bool isConnected() const
Indicates if the joystick / gamecontroller is connected.
int32_t m_joystickId
Our joystick id.
void closeController()
Closes / deactivates the gamecontroller.
int32_t m_deviceIndex
SDLs device index.
uint8_t getNumberOfHats() const
Return the number of hats.
SDL_JoystickID m_instanceId
SDLs joystick id (different from device index)
bool isController() const
Indicates if this a controller.
void close()
Closes / deactivates the joystick.
std::string m_name
The name of the joystick / controller.
void setDeviceIndex(int32_t deviceIndex)
Sets the device index of the joystick.
uint8_t getNumberOfAxes() const
Return the number of axes.
Represents a Joystick and if available the Gamecontroller.
bool isButtonPressed(int8_t button) const
Return the current value for given axis.
const std::string & getGuid()
Return the GUID of the joystick / gamecontroller class as string.
int32_t getJoystickId() const
Sets the instance id of the joystick.
Joystick(int32_t joystickId, int32_t deviceIndex)
Constructor.
float convertRange(int16_t value) const
Converts the int16 in -1.0 to 1.0 range.
int32_t getDeviceIndex() const
Return the device index of the joystick.
void openController()
Opens / activates the gamecontroller, only possible with valid GUID mapping.
uint8_t getNumberOfButtons() const
Return the number of buttons.
SDL_GameController * m_controllerHandle
SDLs controller handle.
float getAxisValue(int8_t axis) const
Return the current value for given axis.
const std::string & getName()
Return the name of the joystick.
int32_t getInstanceId() const
Return the instance id of the joystick.
SDL_Joystick * m_joystickHandle
SDLs joystick handle.
void open()
Opens / activates the joystick and sets values.
std::string m_guidStr
The GUID as string.
int8_t getHatValue(int8_t hat) const
Return the hat value (see Hat positions), for given hat index.