17 #ifndef CONTROLLEREVENT_H
18 #define CONTROLLEREVENT_H
22 #include "JoystickAxisCodes.h"
23 #include "TriggerAxisCodes.h"
108 return mJoystickAxisStates.count(axis) > 0;
136 return mTriggerAxisStates.count(axis) > 0;
161 #endif // CONTROLLEREVENT_H
const TriggerAxisStates & getTriggerAxisStates() const
Returns trigger axis value changes for all trigger axes contained in this event.
Definition: ControllerEvent.h:146
bool hasKeyInfo(const KeyCode &keyCode) const
Returns whether or not this ControllerEvent contains any key press information for the specified key...
Definition: ControllerEvent.h:81
const JoystickAxisStates & getJoystickAxisStates() const
Returns joystick axis value changes for all joystick axes contained in this event.
Definition: ControllerEvent.h:118
int getDeviceId() const
Returns the deviceId for this ControllerEvent, or a negative number if it is "deviceless".
Definition: ControllerEvent.h:66
void setDeviceId(int deviceId)
Sets the deviceId for this ControllerEvent.
Definition: ControllerEvent.h:70
void setKeyState(const KeyCode &keyCode, bool isPressed)
Sets whether or not the key has been pressed or released.
Definition: ControllerEvent.h:96
bool hasKeyInfo() const
Returns whether or not this ControllerEvent contains any key press information.
Definition: ControllerEvent.h:75
bool hasTriggerAxisInfo() const
Returns whether or not this ControllerEvent contains any axis information for the specified trigger a...
Definition: ControllerEvent.h:130
A platform independent event generated by controller device.
Definition: ControllerEvent.h:34
bool hasJoystickAxisInfo() const
Returns whether or not this ControllerEvent contains any axis information for the specified joystick ...
Definition: ControllerEvent.h:102
void setJoystickAxisValue(const JoystickAxisCode &axis, float value)
Sets the [-1.0f, 1.0f]joystick axis value for the specified joystick axis.
void setTriggerAxisValue(const TriggerAxisCode &axis, float value)
Sets the [0.0, 1.0] trigger axis value for the specified trigger axis.
float getJoystickAxisValue(const JoystickAxisCode &axis) const
Returns the [-1.0f, 1.0f] axis value for the specified joystick axis.
const KeyStates & getKeyStates() const
Returns pressed state changes for all keys contained in this event.
Definition: ControllerEvent.h:90
bool isKeyPressed(const KeyCode &keyCode) const
Returns whether or not the specified key is pressed.
bool hasJoystickAxisInfo(const JoystickAxisCode &axis) const
Returns whether or not this ControllerEvent contains any axis information.
Definition: ControllerEvent.h:107
ControllerEvent(int deviceId=-1)
Constructs a ControllerEvent for a controller identified by the specified deviceId.
std::map< TriggerAxisCode, float > TriggerAxisStates
Map of trigger axes to their changes in [0.0f, 1.0f] axis value.
Definition: ControllerEvent.h:47
float getTriggerAxisValue(const TriggerAxisCode &axis) const
Returns the [0.0, 1.0] axis value for the specified trigger axis.
bool hasTriggerAxisInfo(const TriggerAxisCode &axis) const
Returns the [0.0, 1.0] axis value for the specified trigger axis.
Definition: ControllerEvent.h:135
std::map< JoystickAxisCode, float > JoystickAxisStates
Map of joystick axes to their changes in [-1.0f, 1.0f] axis value.
Definition: ControllerEvent.h:43
std::map< KeyCode, bool > KeyStates
Map of keys to their changes in pressed state.
Definition: ControllerEvent.h:39
bool hasDeviceId() const
Returns whether or not this ControllerEvent has a valid (non-zero) deviceId.
Definition: ControllerEvent.h:61