This Determines the kind of user input. More...
#include <metacode.h>
Public Member Functions | |
MetaCode () | |
Default constructor. More... | |
MetaCode (const MetaCode &Other) | |
Copy constructor. More... | |
MetaCode (const Int32 &Value, const Input::InputCode &NewCode) | |
Descriptive Constructor. More... | |
MetaCode (const Int32 &Value, const Input::InputCode &NewCode, const UInt16 &Index) | |
Descriptive Constructor. More... | |
MetaCode (const RawEvent &RawEvent_) | |
The Heavy Lifting Constructor. More... | |
Input::InputCode | GetCode () const |
This Returns the Inputcode. More... | |
UInt16 | GetDeviceIndex () const |
Gets the currently set device index. More... | |
Input::InputDevice | GetDeviceType () const |
Gets the device-type this MetaCode is representing. More... | |
Int32 | GetMetaValue () const |
This Returns the MetaValue. More... | |
Input::ButtonState | GetMetaValueAsButtonState () const |
Get the MetaValue as a Input::ButtonState. More... | |
Input::DirectionalMotionState | GetMetaValueAsDirectionalMotionState () const |
Get the MetaValue as a Input::DirectionalMotionState. More... | |
bool | IsAltKey () const |
Is this a left or right Alt key. More... | |
bool | IsControllerAxisEvent () const |
Does this MetaCode Represent an axis position on a controller. More... | |
bool | IsControllerButton () const |
Does this MetaCode Represent a state of a Controller button. More... | |
bool | IsControllerEvent () const |
Does this MetaCode Represent a state of a Controller Event. More... | |
bool | IsControllerHatEvent () const |
Does this MetaCode Represent a hat position on a controller. More... | |
bool | IsCtrlKey () const |
Is this a left or right Ctrl key. More... | |
bool | IsDeviceButton () const |
Does this MetaCode Represent a state of any button on an input device. More... | |
bool | IsInputEvent () const |
Does this MetaCode Represent some other (non-keyboard and non-mouse button). More... | |
bool | IsKeyboardButton () const |
Does this MetaCode Represent a state of a keyboard key. More... | |
bool | IsKeyboardEvent () const |
Does this MetaCode Represent a state of a keyboard Event. More... | |
bool | IsMouseButton () const |
Does this MetaCode Represent a state of a Mouse button. More... | |
bool | IsMouseEvent () const |
Does this MetaCode Represent a state of a mouse Event. More... | |
bool | IsMouseMotionEvent () const |
Does this MetaCode Represent movement of the mouse or mouse wheel. More... | |
bool | IsMouseMultiClickEvent () const |
Does this MetaCode Represent multiple clicks of a mouse button. More... | |
bool | IsMultitouchEvent () const |
Does this MetaCode Represent a state of a multitouch device. More... | |
bool | IsPollable () const |
Is this metacode a pollable event. More... | |
bool | IsShiftKey () const |
Is this a left or right Shift key. More... | |
bool | IsSuperKey () const |
Is this a left or right Super key (Windows logo key, Apple logo key, etc...). More... | |
bool | operator!= (const MetaCode &Other) const |
Compares two MetaCode's for inequality. More... | |
bool | operator< (const MetaCode &Other) const |
Compares two MetaCode's to see if this is less. More... | |
MetaCode & | operator= (const MetaCode &Other) |
Assignment operator. More... | |
bool | operator== (const MetaCode &Other) const |
Compares two MetaCode's for equality. More... | |
bool | operator> (const MetaCode &Other) const |
Compares two MetaCode's to see if this is greater. More... | |
void | ProtoDeSerialize (const XML::Node &OneNode) |
Take the data stored in an XML and overwrite this instance of this object with it. More... | |
void | ProtoSerialize (XML::Node &CurrentRoot) const |
Convert this class to an XML::Node ready for serialization. More... | |
String | SerializableName () const |
Get the name of the the XML tag this class will leave behind as its instances are serialized. More... | |
void | SetCode (const Input::InputCode &NewCode) |
This Sets The InputCode. More... | |
void | SetCode (const Int32 &NewCode) |
This Sets The InputCode using an Int32. More... | |
void | SetDeviceIndex (const UInt16 &Index) |
Sets the device index if applicable. More... | |
void | SetMetaValue (const Int32 &Value) |
This Sets The MetaValue. More... | |
void | SetNullValues () |
Sets all the values of this MetaCode to Null values. | |
Static Public Member Functions | |
static Input::InputCode | GetControllerAxisCode (const UInt16 AxisNumber) |
Accepts a int and returns the InputCode for the Corresponding Controller Axis. More... | |
static Input::InputCode | GetControllerButtonCode (const UInt16 ButtonNumber) |
Accepts a int and returns the InputCode for the Corresponding Controller button. More... | |
static Input::InputCode | GetMouseButtonCode (const UInt16 ButtonNumber) |
Accepts a int and returns the InputCode for the Corresponding Mouse button. More... | |
Protected Member Functions | |
void | Construct (const RawEvent &RawEvent_) |
void | Construct (const Int32 &Value, const Input::InputCode &NewCode) |
Static Protected Member Functions | |
static Input::InputCode | GetInputCodeFromSDL_JOYSTICK (const RawEvent &RawEvent_) |
static Input::InputCode | GetInputCodeFromSDL_KEY (const RawEvent &RawEvent_) |
static Input::InputCode | GetInputCodeFromSDL_MOUSE (const RawEvent &RawEvent_) |
Protected Attributes | |
Input::InputCode | Code |
UInt16 | DeviceIndex |
Int32 | MetaValue |
This Determines the kind of user input.
A Metacode contains the data that is passed around with an input event. It stores one type of button press or analog representation (Mouse move, joystick tilt, wheel spin, etc...). If it is an analog representation it will also store how far or how it is pushed, pressed, rotated, or whatever. Several of these can be used in combination to represent button combinations, or complex input combinations (like portions of fighter game moves).
Definition at line 93 of file metacode.h.
Mezzanine::Input::MetaCode::MetaCode | ( | ) |
Default constructor.
This sets nothing on the MetaCode and leaves it completely unassigned. Accessing a data member could cause problems.
Definition at line 71 of file metacode.cpp.
Mezzanine::Input::MetaCode::MetaCode | ( | const MetaCode & | Other) |
Copy constructor.
This sets all values in the MetaCode, leaving it in completely ready state.
Other | The other MetaCode to copy from. |
Definition at line 74 of file metacode.cpp.
Mezzanine::Input::MetaCode::MetaCode | ( | const Int32 & | Value, |
const Input::InputCode & | NewCode | ||
) |
Descriptive Constructor.
This sets all values in the MetaCode, leaving it in completely ready state. This is the ideal constructor for simulating user input.
Value | How much is something moving, tilting, rotating or whatever. For buttons a positive value is pushed, and a negative value is becoming unpressed, and 0 is unpressed. |
NewCode | Which key or which type of input was pressed. Sqeaky, thinks this has partial unicode support. |
Definition at line 77 of file metacode.cpp.
Mezzanine::Input::MetaCode::MetaCode | ( | const Int32 & | Value, |
const Input::InputCode & | NewCode, | ||
const UInt16 & | Index | ||
) |
Descriptive Constructor.
This sets all values in the MetaCode, leaving it in completely ready state. This is the ideal constructor for simulating user input.
Value | How much is something moving, tilting, rotating or whatever. For buttons a positive value is pushed, and a negative value is becoming unpressed, and 0 is unpressed. |
NewCode | Which key or which type of input was pressed. Sqeaky, thinks this has partial unicode support. |
Index | The index of the device this metacode is describing. |
Definition at line 82 of file metacode.cpp.
Mezzanine::Input::MetaCode::MetaCode | ( | const RawEvent & | RawEvent_) |
The Heavy Lifting Constructor.
This contructor accepts a RawEvent from the input event subsystem internal to the engine. This converts all the required information from the lower level format and store what is needed in the event that is created. This is used heavily by engine internals.
This constructor expects to receive a type of RawEvent that can be converted into exactly one kind of Metacode. Depending on the User input subsystem, this could be all RawEvents, or even just some RawEvents.
RawEvent which creates Multiple Metacodes inserted into Metacode | - Thrown when passed a certain (system dependant) incorrect type of RawEvent. |
Unknown User Input Inserted into Metacode | - Thrown when receiving either a corrupt, improperly handle, or unsupported RawEvent. |
Definition at line 88 of file metacode.cpp.
Input::InputCode Mezzanine::Input::MetaCode::GetCode | ( | ) | const |
This Returns the Inputcode.
This Value can be use to determine what keyboard button has been pressed, or what specific kind of Joystick or mouse event has occurred. This value can be set with SetCode .
Definition at line 175 of file metacode.cpp.
|
static |
Accepts a int and returns the InputCode for the Corresponding Controller Axis.
AxisNumber | The number of the button you want the code for. |
Definition at line 235 of file metacode.cpp.
|
static |
Accepts a int and returns the InputCode for the Corresponding Controller button.
ButtonerNumber | The number of the button you want the code for. |
Definition at line 227 of file metacode.cpp.
UInt16 Mezzanine::Input::MetaCode::GetDeviceIndex | ( | ) | const |
Gets the currently set device index.
Definition at line 187 of file metacode.cpp.
Input::InputDevice Mezzanine::Input::MetaCode::GetDeviceType | ( | ) | const |
Gets the device-type this MetaCode is representing.
Definition at line 300 of file metacode.cpp.
Int32 Mezzanine::Input::MetaCode::GetMetaValue | ( | ) | const |
This Returns the MetaValue.
The MetaValue can be use to determine how far something is tilted, pushed, rotated, or other analog value. This value can be set with SetMetaValue .
Definition at line 181 of file metacode.cpp.
Input::ButtonState Mezzanine::Input::MetaCode::GetMetaValueAsButtonState | ( | ) | const |
Get the MetaValue as a Input::ButtonState.
This | throws a Mezzanine::Exception if the MetaValue is less than BUTTON_LIFTING or greater than BUTTON_DOWN. |
Definition at line 199 of file metacode.cpp.
Input::DirectionalMotionState Mezzanine::Input::MetaCode::GetMetaValueAsDirectionalMotionState | ( | ) | const |
Get the MetaValue as a Input::DirectionalMotionState.
This | throws a Mezzanine::Exception if the MetaValue is less than MOUSEWHEEL_DOWN or greater than MOUSEWHEEL_UP. |
Definition at line 209 of file metacode.cpp.
|
static |
Accepts a int and returns the InputCode for the Corresponding Mouse button.
ButtonerNumber | The number of the button you want the code for. |
Definition at line 219 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsAltKey | ( | ) | const |
Is this a left or right Alt key.
Definition at line 285 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsControllerAxisEvent | ( | ) | const |
Does this MetaCode Represent an axis position on a controller.
Definition at line 276 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsControllerButton | ( | ) | const |
Does this MetaCode Represent a state of a Controller button.
Definition at line 252 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsControllerEvent | ( | ) | const |
Does this MetaCode Represent a state of a Controller Event.
Definition at line 273 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsControllerHatEvent | ( | ) | const |
Does this MetaCode Represent a hat position on a controller.
Definition at line 279 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsCtrlKey | ( | ) | const |
Is this a left or right Ctrl key.
Definition at line 288 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsDeviceButton | ( | ) | const |
Does this MetaCode Represent a state of any button on an input device.
Definition at line 255 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsInputEvent | ( | ) | const |
Does this MetaCode Represent some other (non-keyboard and non-mouse button).
Definition at line 282 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsKeyboardButton | ( | ) | const |
Does this MetaCode Represent a state of a keyboard key.
Definition at line 246 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsKeyboardEvent | ( | ) | const |
Does this MetaCode Represent a state of a keyboard Event.
Definition at line 258 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsMouseButton | ( | ) | const |
Does this MetaCode Represent a state of a Mouse button.
Definition at line 249 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsMouseEvent | ( | ) | const |
Does this MetaCode Represent a state of a mouse Event.
Definition at line 261 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsMouseMotionEvent | ( | ) | const |
Does this MetaCode Represent movement of the mouse or mouse wheel.
Definition at line 264 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsMouseMultiClickEvent | ( | ) | const |
Does this MetaCode Represent multiple clicks of a mouse button.
Definition at line 267 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsMultitouchEvent | ( | ) | const |
Does this MetaCode Represent a state of a multitouch device.
Definition at line 270 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsPollable | ( | ) | const |
Is this metacode a pollable event.
Definition at line 297 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsShiftKey | ( | ) | const |
Is this a left or right Shift key.
Definition at line 291 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::IsSuperKey | ( | ) | const |
Is this a left or right Super key (Windows logo key, Apple logo key, etc...).
Definition at line 294 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::operator!= | ( | const MetaCode & | Other) | const |
Compares two MetaCode's for inequality.
Other | The other MetaCode to compare with. |
Definition at line 327 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::operator< | ( | const MetaCode & | Other) | const |
Compares two MetaCode's to see if this is less.
Other | The other MetaCode to compare with. |
Definition at line 334 of file metacode.cpp.
Assignment operator.
Other | The other MetaCode to assign to this. |
Definition at line 312 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::operator== | ( | const MetaCode & | Other) | const |
Compares two MetaCode's for equality.
Other | The other MetaCode to compare with. |
Definition at line 320 of file metacode.cpp.
bool Mezzanine::Input::MetaCode::operator> | ( | const MetaCode & | Other) | const |
Compares two MetaCode's to see if this is greater.
Other | The other MetaCode to compare with. |
Definition at line 339 of file metacode.cpp.
void Mezzanine::Input::MetaCode::ProtoDeSerialize | ( | const XML::Node & | OneNode) |
Take the data stored in an XML and overwrite this instance of this object with it.
OneNode | and XML::Node containing the data. |
Definition at line 367 of file metacode.cpp.
void Mezzanine::Input::MetaCode::ProtoSerialize | ( | XML::Node & | CurrentRoot) | const |
Convert this class to an XML::Node ready for serialization.
CurrentRoot | The point in the XML hierarchy that all this vector3 should be appended to. |
Definition at line 345 of file metacode.cpp.
String Mezzanine::Input::MetaCode::SerializableName | ( | ) | const |
Get the name of the the XML tag this class will leave behind as its instances are serialized.
Definition at line 383 of file metacode.cpp.
void Mezzanine::Input::MetaCode::SetCode | ( | const Input::InputCode & | NewCode) |
This Sets The InputCode.
See GetCode to see exactly what the Code is. This will Set the code stored in this MetaCode. This value can be retrieved with GetCode .
NewCode | The value you want the stored code to become. |
Definition at line 169 of file metacode.cpp.
void Mezzanine::Input::MetaCode::SetCode | ( | const Int32 & | NewCode) |
This Sets The InputCode using an Int32.
NewCode | The value you want the stored code to become. |
Definition at line 172 of file metacode.cpp.
void Mezzanine::Input::MetaCode::SetDeviceIndex | ( | const UInt16 & | Index) |
Sets the device index if applicable.
Index | The index of the device this metacode applies to. |
Definition at line 184 of file metacode.cpp.
void Mezzanine::Input::MetaCode::SetMetaValue | ( | const Int32 & | Value) |
This Sets The MetaValue.
See GetMetaValue to see exactly what the MetaValue is. This will set the MetaValue stored in this MetaCode. This value can be retrieved with GetMetaValue .
Value | The value you want the stored MetaValue to become. No bounds checking will be done. You can supply a completely invalid value if you choose to. |
Definition at line 178 of file metacode.cpp.