VoltAir
|
A platform independent event generated by controller device. More...
Public Types | |
typedef std::map< KeyCode, bool > | KeyStates |
Map of keys to their changes in pressed state. More... | |
typedef std::map < JoystickAxisCode, float > | JoystickAxisStates |
Map of joystick axes to their changes in [-1.0f, 1.0f] axis value. More... | |
typedef std::map < TriggerAxisCode, float > | TriggerAxisStates |
Map of trigger axes to their changes in [0.0f, 1.0f] axis value. More... | |
Public Member Functions | |
ControllerEvent (int deviceId=-1) | |
Constructs a ControllerEvent for a controller identified by the specified deviceId . More... | |
bool | hasDeviceId () const |
Returns whether or not this ControllerEvent has a valid (non-zero) deviceId. More... | |
int | getDeviceId () const |
Returns the deviceId for this ControllerEvent, or a negative number if it is "deviceless". More... | |
void | setDeviceId (int deviceId) |
Sets the deviceId for this ControllerEvent. More... | |
bool | hasKeyInfo () const |
Returns whether or not this ControllerEvent contains any key press information. More... | |
bool | hasKeyInfo (const KeyCode &keyCode) const |
Returns whether or not this ControllerEvent contains any key press information for the specified key. More... | |
bool | isKeyPressed (const KeyCode &keyCode) const |
Returns whether or not the specified key is pressed. More... | |
const KeyStates & | getKeyStates () const |
Returns pressed state changes for all keys contained in this event. More... | |
void | setKeyState (const KeyCode &keyCode, bool isPressed) |
Sets whether or not the key has been pressed or released. More... | |
bool | hasJoystickAxisInfo () const |
Returns whether or not this ControllerEvent contains any axis information for the specified joystick axis. More... | |
bool | hasJoystickAxisInfo (const JoystickAxisCode &axis) const |
Returns whether or not this ControllerEvent contains any axis information. More... | |
float | getJoystickAxisValue (const JoystickAxisCode &axis) const |
Returns the [-1.0f, 1.0f] axis value for the specified joystick axis. More... | |
const JoystickAxisStates & | getJoystickAxisStates () const |
Returns joystick axis value changes for all joystick axes contained in this event. More... | |
void | setJoystickAxisValue (const JoystickAxisCode &axis, float value) |
Sets the [-1.0f, 1.0f] joystick axis value for the specified joystick axis. More... | |
bool | hasTriggerAxisInfo () const |
Returns whether or not this ControllerEvent contains any axis information for the specified trigger axis. More... | |
bool | hasTriggerAxisInfo (const TriggerAxisCode &axis) const |
Returns the [0.0, 1.0] axis value for the specified trigger axis. More... | |
float | getTriggerAxisValue (const TriggerAxisCode &axis) const |
Returns the [0.0, 1.0] axis value for the specified trigger axis. More... | |
const TriggerAxisStates & | getTriggerAxisStates () const |
Returns trigger axis value changes for all trigger axes contained in this event. More... | |
void | setTriggerAxisValue (const TriggerAxisCode &axis, float value) |
Sets the [0.0, 1.0] trigger axis value for the specified trigger axis. More... | |
A platform independent event generated by controller device.
This event can represent input events from any type of controller without respect to platform.
typedef std::map<JoystickAxisCode, float> ControllerEvent::JoystickAxisStates |
Map of joystick axes to their changes in [-1.0f, 1.0f]
axis value.
typedef std::map<KeyCode, bool> ControllerEvent::KeyStates |
Map of keys to their changes in pressed state.
typedef std::map<TriggerAxisCode, float> ControllerEvent::TriggerAxisStates |
Map of trigger axes to their changes in [0.0f, 1.0f]
axis value.
ControllerEvent::ControllerEvent | ( | int | deviceId = -1 | ) |
Constructs a ControllerEvent for a controller identified by the specified deviceId
.
deviceId | Id that uniquely identifies a controller |
|
inline |
Returns the deviceId for this ControllerEvent, or a negative number if it is "deviceless".
|
inline |
Returns joystick axis value changes for all joystick axes contained in this event.
float ControllerEvent::getJoystickAxisValue | ( | const JoystickAxisCode & | axis | ) | const |
Returns the [-1.0f, 1.0f]
axis value for the specified joystick axis.
axis | Code of the joystick axis to query for axis value |
|
inline |
Returns pressed state changes for all keys contained in this event.
|
inline |
Returns trigger axis value changes for all trigger axes contained in this event.
float ControllerEvent::getTriggerAxisValue | ( | const TriggerAxisCode & | axis | ) | const |
Returns the [0.0, 1.0]
axis value for the specified trigger axis.
axis | Code of the trigger axis to query for axis value |
|
inline |
Returns whether or not this ControllerEvent has a valid (non-zero) deviceId.
|
inline |
Returns whether or not this ControllerEvent contains any axis information for the specified joystick axis.
|
inline |
Returns whether or not this ControllerEvent contains any axis information.
axis | Code of the joystick axis to query for presence of axis information |
|
inline |
Returns whether or not this ControllerEvent contains any key press information.
|
inline |
Returns whether or not this ControllerEvent contains any key press information for the specified key.
keyCode | Code of key to query for presence of pressed state information |
|
inline |
Returns whether or not this ControllerEvent contains any axis information for the specified trigger axis.
|
inline |
Returns the [0.0, 1.0]
axis value for the specified trigger axis.
axis | Code of the trigger axis to query for axis value |
bool ControllerEvent::isKeyPressed | ( | const KeyCode & | keyCode | ) | const |
Returns whether or not the specified key is pressed.
keyCode | Code of key to query for pressed state information |
|
inline |
Sets the deviceId
for this ControllerEvent.
void ControllerEvent::setJoystickAxisValue | ( | const JoystickAxisCode & | axis, |
float | value | ||
) |
Sets the [-1.0f, 1.0f]
joystick axis value for the specified joystick axis.
axis | Code of joystick axis whose state has changed |
value | [-1.0f, 1.0f] new axis value |
|
inline |
Sets whether or not the key has been pressed or released.
keyCode | Code of key whose state has changed |
isPressed | Whether or the key is pressed |
void ControllerEvent::setTriggerAxisValue | ( | const TriggerAxisCode & | axis, |
float | value | ||
) |
Sets the [0.0, 1.0]
trigger axis value for the specified trigger axis.
axis | Code of trigger axis whose state has changed |
value | [0.0, 1.0] new axis value |