This is a container for MetaCodes that is used in the EventManager. More...
#include <eventuserinput.h>
Public Member Functions | |
EventUserInput () | |
Default constructor. More... | |
EventUserInput (const Input::MetaCode &Code_) | |
Single Data Point constructor. More... | |
EventUserInput (const std::vector< Input::MetaCode > &Codes_) | |
Multi Data Point constructor. More... | |
virtual | ~EventUserInput () |
Default destructor. | |
Input::MetaCode | AddCode (const Input::MetaCode &Code_) |
Adds a MetaCode. More... | |
Input::MetaCode | AddCode (const int &MetaValue_, const Input::InputCode &Code_) |
Adds a MetaCode Created From Raw Values. More... | |
Input::MetaCode | AddCode (const int &MetaValue_, const Input::InputCode &Code_, const UInt16 &DeviceIndex_) |
Adds a MetaCode Created From Raw Values. More... | |
void | AddCodes (const std::vector< Input::MetaCode > &Codes) |
Add Several MetaCodes from a vector. More... | |
void | EraseCode (const Input::MetaCode &Code_) |
Removes a specific code from storage. More... | |
void | EraseCode (const unsigned int &Index) |
Removes a specific code from storage. More... | |
const Input::MetaCode & | GetMetaCode (const unsigned int &Index) |
Single Data Point constructor. More... | |
size_t | GetMetaCodeCount () |
Retrieves a count of the stored Metacodes. More... | |
virtual EventType | GetType () const |
Returns the type of this event. More... | |
Public Member Functions inherited from Mezzanine::EventBase | |
virtual | ~EventBase () |
Virtual Deconstructor. | |
Protected Member Functions | |
std::vector< Input::MetaCode > | AddCodeFromSDLJoyStickBall (const RawEvent &RawEvent_) |
Gets the MetaCode from RawInput Data. More... | |
std::vector< Input::MetaCode > | AddCodeFromSDLJoyStickHat (const RawEvent &RawEvent_) |
Gets the MetaCode from RawInput Data. More... | |
Input::MetaCode | AddCodeFromSDLMouseButton (const RawEvent &RawEvent_) |
Gets the MetaCode from RawInput Data. More... | |
std::vector< Input::MetaCode > | AddCodesFromSDLJoyStickMotion (const RawEvent &RawEvent_) |
Gets the MetaCode from RawInput Data. More... | |
std::vector< Input::MetaCode > | AddCodesFromSDLMouseMotion (const RawEvent &RawEvent_) |
Gets the MetaCode from RawInput Data. More... | |
Additional Inherited Members | |
Public Types inherited from Mezzanine::EventBase | |
enum | EventType { GameWindow, QuitMessage, UserInput, Other } |
A listing of values that can be used to identify Events. More... | |
This is a container for MetaCodes that is used in the EventManager.
The EventUserInput is the container for information about how a user enters data and commands into a program. By Default one is inserted into event manager the with all the user input from each run of the main loop. These can be manually inserted into the EventManager to simulate input from other sources. If setup properly this can allow computer controlled characters to use the same interface players, allowing for more realistic response from them.
This is implemented by inheriting from std::vector. Any feature of std::vector can be used to interact with the metacodes stored within. Using Iterators is great way to quickly and easily get what you need from this. For the most part any extra functions on this are for seamless interaction with the EventManager, or to convert incoming data into a more usable form.
Definition at line 97 of file eventuserinput.h.
Mezzanine::EventUserInput::EventUserInput | ( | ) |
Default constructor.
This creates a perfectly functional, but empty EventUserInput.
Definition at line 70 of file eventuserinput.cpp.
Mezzanine::EventUserInput::EventUserInput | ( | const Input::MetaCode & | Code_ | ) |
Single Data Point constructor.
Code_ | This MetaCode will be added to the EventUserInput during creation. |
This creates a functional EventUserInput which already contains one metacode.
Definition at line 73 of file eventuserinput.cpp.
Mezzanine::EventUserInput::EventUserInput | ( | const std::vector< Input::MetaCode > & | Codes_ | ) |
Multi Data Point constructor.
Codes_ | The MetaCodes in this vecotor will be added to the EventUserInput during creation. |
This creates a ready to use EventUserInput which already contains all the metacodes included.
Definition at line 76 of file eventuserinput.cpp.
Input::MetaCode Mezzanine::EventUserInput::AddCode | ( | const Input::MetaCode & | Code_ | ) |
Adds a MetaCode.
Code_ | The User Input MetaCode tobe added. |
This adds an existing metacode to this event.
Definition at line 88 of file eventuserinput.cpp.
Input::MetaCode Mezzanine::EventUserInput::AddCode | ( | const int & | MetaValue_, |
const Input::InputCode & | Code_ | ||
) |
Adds a MetaCode Created From Raw Values.
MetaValue_ | The MetaValue that will be in the MetaCode. |
Code_ | The InputCode that will be in the MetaCode. |
This creates metacode a metacode and adds it to this event.
Definition at line 94 of file eventuserinput.cpp.
Input::MetaCode Mezzanine::EventUserInput::AddCode | ( | const int & | MetaValue_, |
const Input::InputCode & | Code_, | ||
const UInt16 & | DeviceIndex_ | ||
) |
Adds a MetaCode Created From Raw Values.
MetaValue_ | The MetaValue that will be in the MetaCode. |
Code_ | The InputCode that will be in the MetaCode. |
DeviceIndex_ | The index of the device the added code applies to. |
This creates metacode a metacode and adds it to this event.
Definition at line 100 of file eventuserinput.cpp.
|
protected |
Gets the MetaCode from RawInput Data.
RawEvent_ | The event that contains only Joystick Ball data. |
Definition at line 173 of file eventuserinput.cpp.
|
protected |
Gets the MetaCode from RawInput Data.
RawEvent_ | The event that contains only Joystick Hat data. |
Definition at line 159 of file eventuserinput.cpp.
|
protected |
Gets the MetaCode from RawInput Data.
RawEvent_ | The event that contains only Mouse button data. |
void Mezzanine::EventUserInput::AddCodes | ( | const std::vector< Input::MetaCode > & | Codes | ) |
Add Several MetaCodes from a vector.
Codes | A vector of MetaCodes to be added to this event. |
This adds several existing metacodes to this event.
Definition at line 106 of file eventuserinput.cpp.
|
protected |
Gets the MetaCode from RawInput Data.
RawEvent_ | The event that contains only Joystick Motion data. |
Definition at line 150 of file eventuserinput.cpp.
|
protected |
Gets the MetaCode from RawInput Data.
RawEvent_ | The event that contains only Mouse Motion data. |
Definition at line 135 of file eventuserinput.cpp.
void Mezzanine::EventUserInput::EraseCode | ( | const Input::MetaCode & | Code_ | ) |
Removes a specific code from storage.
Code_ | This will search for all matching copies of this. |
All MetaCodes that are equal to Code_ will simply be erased.
Definition at line 112 of file eventuserinput.cpp.
void Mezzanine::EventUserInput::EraseCode | ( | const unsigned int & | Index | ) |
Removes a specific code from storage.
Index | This is the location to removed from. |
The MetaCode at and only at the given Index will be deleted.
Definition at line 125 of file eventuserinput.cpp.
const Input::MetaCode & Mezzanine::EventUserInput::GetMetaCode | ( | const unsigned int & | Index | ) |
Single Data Point constructor.
This function simply retrieves the requested MetaCode. It can throw standard Out of bounds exceptions if attemped to reference a negative item or an item with Index higher than what exists
This is useful for accessing each MetaCode stored in this UserInputEvent.
Definition at line 82 of file eventuserinput.cpp.
size_t Mezzanine::EventUserInput::GetMetaCodeCount | ( | ) |
Retrieves a count of the stored Metacodes.
Retrieves a count of the stored Metacodes. Synonym for vector::size();
Definition at line 85 of file eventuserinput.cpp.
|
virtual |
Returns the type of this event.
Implements Mezzanine::EventBase.
Definition at line 128 of file eventuserinput.cpp.