This Determines the kind of user input. More...
#include <metacode.h>
Public Types | |
typedef MetaCodeContainer::const_iterator | ConstMetaCodeIterator |
Const Iterator type for convenient MetaCode storage. | |
typedef std::vector< Input::MetaCode > | MetaCodeContainer |
Convenience datatype for storage of MetaCodes. | |
typedef MetaCodeContainer::iterator | MetaCodeIterator |
Iterator type for convenient MetaCode storage. | |
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 Int32 Index) | |
Descriptive Constructor. More... | |
MetaCode (const RawEvent &Raw) | |
The Heavy Lifting Constructor. More... | |
~MetaCode () | |
Class destructor. | |
Input::InputCode | GetCode () const |
This Returns the Inputcode. More... | |
Int32 | 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... | |
String | GetSerializableName () const |
Get the name of the the XML tag this class will leave behind as its instances are serialized. More... | |
Boole | IsAltKey () const |
Is this a left or right Alt key. More... | |
Boole | IsControllerAxisEvent () const |
Does this MetaCode Represent an axis position on a controller. More... | |
Boole | IsControllerButton () const |
Does this MetaCode Represent a state of a Controller button. More... | |
Boole | IsControllerEvent () const |
Does this MetaCode Represent a state of a Controller Event. More... | |
Boole | IsControllerHatEvent () const |
Does this MetaCode Represent a hat position on a controller. More... | |
Boole | IsCtrlKey () const |
Is this a left or right Ctrl key. More... | |
Boole | IsDeviceButton () const |
Does this MetaCode Represent a state of any button on an input device. More... | |
Boole | IsInputEvent () const |
Does this MetaCode Represent some other (non-keyboard and non-mouse button). More... | |
Boole | IsKeyboardButton () const |
Does this MetaCode Represent a state of a keyboard key. More... | |
Boole | IsKeyboardEvent () const |
Does this MetaCode Represent a state of a keyboard Event. More... | |
Boole | IsMouseButton () const |
Does this MetaCode Represent a state of a Mouse button. More... | |
Boole | IsMouseEvent () const |
Does this MetaCode Represent a state of a mouse Event. More... | |
Boole | IsMouseMotionEvent () const |
Does this MetaCode Represent movement of the mouse or mouse wheel. More... | |
Boole | IsMouseMultiClickEvent () const |
Does this MetaCode Represent multiple clicks of a mouse button. More... | |
Boole | IsMultitouchEvent () const |
Does this MetaCode Represent a state of a multitouch device. More... | |
Boole | IsPollable () const |
Is this metacode a pollable event. More... | |
Boole | IsShiftKey () const |
Is this a left or right Shift key. More... | |
Boole | IsSuperKey () const |
Is this a left or right Super key (Windows logo key, Apple logo key, etc...). More... | |
Boole | operator!= (const MetaCode &Other) const |
Compares two MetaCode's for inequality. More... | |
Boole | operator< (const MetaCode &Other) const |
Compares two MetaCode's to see if this is less. More... | |
MetaCode & | operator= (const MetaCode &Other) |
Assignment operator. More... | |
Boole | operator== (const MetaCode &Other) const |
Compares two MetaCode's for equality. More... | |
Boole | 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... | |
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 Int32 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 MetaCodeContainer | CreateMetaCodes (const RawEvent &Raw) |
Internal creation method. More... | |
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 | GetControllerHatCode (const UInt16 HatNumber) |
Accepts a int and returns the InputCode for the Corresponding Controller Hat. More... | |
static Input::InputCode | GetMouseButtonCode (const UInt16 ButtonNumber) |
Accepts a int and returns the InputCode for the Corresponding Mouse button. More... | |
Static Protected Member Functions | |
static Input::InputCode | GetInputCodeFromSDL_JOYSTICK (const RawEvent &Raw) |
Converts an internal controller input event into a Mezzanine controller InputCode. More... | |
static Input::InputCode | GetInputCodeFromSDL_KEY (const RawEvent &Raw) |
Converts an internal keyboard input event into a Mezzanine keyboard InputCode. More... | |
static Input::InputCode | GetInputCodeFromSDL_MOUSE (const RawEvent &Raw) |
Converts an internal mouse input event into a Mezzanine mouse InputCode. More... | |
Protected Attributes | |
Input::InputCode | Code |
The code indicating what type of input this is. More... | |
Int32 | DeviceIndex |
The device index if this is input from a controller. For keyboards and mice this is the max value if a Int32. More... | |
Int32 | MetaValue |
The relevant value for the type of input this is, if applicable. More... | |
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.
Definition at line 72 of file metacode.cpp.
Mezzanine::Input::MetaCode::MetaCode | ( | const MetaCode & | Other | ) |
Copy constructor.
Other | The other MetaCode to copy from. |
Definition at line 78 of file metacode.cpp.
Mezzanine::Input::MetaCode::MetaCode | ( | const Int32 | Value, |
const Input::InputCode | NewCode | ||
) |
Descriptive Constructor.
Value | How much is something moving, tilting, rotating or whatever. |
NewCode | Which key or which type of input was pressed. |
Definition at line 84 of file metacode.cpp.
Mezzanine::Input::MetaCode::MetaCode | ( | const Int32 | Value, |
const Input::InputCode | NewCode, | ||
const Int32 | Index | ||
) |
Descriptive Constructor.
Value | How much is something moving, tilting, rotating or whatever. |
NewCode | Which key or which type of input was pressed. |
Index | The index of the device this metacode is describing. |
Definition at line 90 of file metacode.cpp.
Mezzanine::Input::MetaCode::MetaCode | ( | const RawEvent & | Raw | ) |
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. |
|
static |
Internal creation method.
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. |
Raw | The internal event to be converted into one or more MetaCodes. |
Definition at line 99 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 244 of file metacode.cpp.
|
static |
Accepts a int and returns the InputCode for the Corresponding Controller Axis.
AxisNumber | The number of the axis you want the code for. |
Definition at line 303 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 295 of file metacode.cpp.
|
static |
Accepts a int and returns the InputCode for the Corresponding Controller Hat.
HatNumber | The index of the hat you want the code for. |
Definition at line 311 of file metacode.cpp.
Int32 Mezzanine::Input::MetaCode::GetDeviceIndex | ( | ) | const |
Gets the currently set device index.
Definition at line 256 of file metacode.cpp.
Input::InputDevice Mezzanine::Input::MetaCode::GetDeviceType | ( | ) | const |
Gets the device-type this MetaCode is representing.
Definition at line 376 of file metacode.cpp.
|
staticprotected |
Converts an internal controller input event into a Mezzanine controller InputCode.
Raw | The internal event to be converted into a controller InputCode. |
Definition at line 232 of file metacode.cpp.
|
staticprotected |
Converts an internal keyboard input event into a Mezzanine keyboard InputCode.
Raw | The internal event to be converted into a keyboard InputCode. |
Definition at line 208 of file metacode.cpp.
|
staticprotected |
Converts an internal mouse input event into a Mezzanine mouse InputCode.
Raw | The internal event to be converted into a mouse InputCode. |
Definition at line 219 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 250 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 269 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 278 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 287 of file metacode.cpp.
String Mezzanine::Input::MetaCode::GetSerializableName | ( | ) | const |
Get the name of the the XML tag this class will leave behind as its instances are serialized.
Definition at line 456 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsAltKey | ( | ) | const |
Is this a left or right Alt key.
Definition at line 361 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsControllerAxisEvent | ( | ) | const |
Does this MetaCode Represent an axis position on a controller.
Definition at line 352 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsControllerButton | ( | ) | const |
Does this MetaCode Represent a state of a Controller button.
Definition at line 328 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsControllerEvent | ( | ) | const |
Does this MetaCode Represent a state of a Controller Event.
Definition at line 349 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsControllerHatEvent | ( | ) | const |
Does this MetaCode Represent a hat position on a controller.
Definition at line 355 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsCtrlKey | ( | ) | const |
Is this a left or right Ctrl key.
Definition at line 364 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsDeviceButton | ( | ) | const |
Does this MetaCode Represent a state of any button on an input device.
Definition at line 331 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsInputEvent | ( | ) | const |
Does this MetaCode Represent some other (non-keyboard and non-mouse button).
Definition at line 358 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsKeyboardButton | ( | ) | const |
Does this MetaCode Represent a state of a keyboard key.
Definition at line 322 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsKeyboardEvent | ( | ) | const |
Does this MetaCode Represent a state of a keyboard Event.
Definition at line 334 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsMouseButton | ( | ) | const |
Does this MetaCode Represent a state of a Mouse button.
Definition at line 325 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsMouseEvent | ( | ) | const |
Does this MetaCode Represent a state of a mouse Event.
Definition at line 337 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsMouseMotionEvent | ( | ) | const |
Does this MetaCode Represent movement of the mouse or mouse wheel.
Definition at line 340 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsMouseMultiClickEvent | ( | ) | const |
Does this MetaCode Represent multiple clicks of a mouse button.
Definition at line 343 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsMultitouchEvent | ( | ) | const |
Does this MetaCode Represent a state of a multitouch device.
Definition at line 346 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsPollable | ( | ) | const |
Is this metacode a pollable event.
Definition at line 373 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsShiftKey | ( | ) | const |
Is this a left or right Shift key.
Definition at line 367 of file metacode.cpp.
Boole Mezzanine::Input::MetaCode::IsSuperKey | ( | ) | const |
Is this a left or right Super key (Windows logo key, Apple logo key, etc...).
Definition at line 370 of file metacode.cpp.
Compares two MetaCode's for inequality.
Other | The other MetaCode to compare with. |
Definition at line 403 of file metacode.cpp.
Compares two MetaCode's to see if this is less.
Other | The other MetaCode to compare with. |
Definition at line 410 of file metacode.cpp.
Assignment operator.
Other | The other MetaCode to assign to this. |
Definition at line 388 of file metacode.cpp.
Compares two MetaCode's for equality.
Other | The other MetaCode to compare with. |
Definition at line 396 of file metacode.cpp.
Compares two MetaCode's to see if this is greater.
Other | The other MetaCode to compare with. |
Definition at line 413 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 431 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 416 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 238 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 241 of file metacode.cpp.
void Mezzanine::Input::MetaCode::SetDeviceIndex | ( | const Int32 | Index | ) |
Sets the device index if applicable.
Index | The index of the device this metacode applies to. |
Definition at line 253 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 247 of file metacode.cpp.
|
protected |
The code indicating what type of input this is.
Definition at line 111 of file metacode.h.
|
protected |
The device index if this is input from a controller. For keyboards and mice this is the max value if a Int32.
Definition at line 108 of file metacode.h.
|
protected |
The relevant value for the type of input this is, if applicable.
Definition at line 105 of file metacode.h.