Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Protected Member Functions | List of all members
Mezzanine::EventUserInput Class Reference

This is a container for MetaCodes that is used in the EventManager. More...

#include <eventuserinput.h>

+ Inheritance diagram for Mezzanine::EventUserInput:
+ Collaboration diagram for Mezzanine::EventUserInput:

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::MetaCodeGetMetaCode (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::MetaCodeAddCodeFromSDLJoyStickBall (const RawEvent &RawEvent_)
 Gets the MetaCode from RawInput Data. More...
 
std::vector< Input::MetaCodeAddCodeFromSDLJoyStickHat (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::MetaCodeAddCodesFromSDLJoyStickMotion (const RawEvent &RawEvent_)
 Gets the MetaCode from RawInput Data. More...
 
std::vector< Input::MetaCodeAddCodesFromSDLMouseMotion (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
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.

Parameters
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.

Member Function Documentation

Input::MetaCode Mezzanine::EventUserInput::AddCode ( const Input::MetaCode Code_)

Adds a MetaCode.

Parameters
Code_The User Input MetaCode tobe added.

This adds an existing metacode to this event.

Returns
This returns a const reference to the MetaCode that was Added. This reference is valid for the lifetime of this EventUserInput.

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.

Parameters
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.

Returns
This returns a const reference to the MetaCode that was Added. This reference is valid for the lifetime of this EventUserInput.

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.

Parameters
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.

Returns
This returns a const reference to the MetaCode that was Added. This reference is valid for the lifetime of this EventUserInput.

Definition at line 100 of file eventuserinput.cpp.

vector< Input::MetaCode > Mezzanine::EventUserInput::AddCodeFromSDLJoyStickBall ( const RawEvent RawEvent_)
protected

Gets the MetaCode from RawInput Data.

Parameters
RawEvent_The event that contains only Joystick Ball data.
Returns
a vector of metacode that represents ball motions.

Definition at line 173 of file eventuserinput.cpp.

vector< Input::MetaCode > Mezzanine::EventUserInput::AddCodeFromSDLJoyStickHat ( const RawEvent RawEvent_)
protected

Gets the MetaCode from RawInput Data.

Parameters
RawEvent_The event that contains only Joystick Hat data.
Returns
a vector of metacode that represents hat presses.

Definition at line 159 of file eventuserinput.cpp.

Input::MetaCode Mezzanine::EventUserInput::AddCodeFromSDLMouseButton ( const RawEvent RawEvent_)
protected

Gets the MetaCode from RawInput Data.

Parameters
RawEvent_The event that contains only Mouse button data.
Returns
a metacode that represents a button press.
void Mezzanine::EventUserInput::AddCodes ( const std::vector< Input::MetaCode > &  Codes)

Add Several MetaCodes from a vector.

Parameters
CodesA 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.

vector< Input::MetaCode > Mezzanine::EventUserInput::AddCodesFromSDLJoyStickMotion ( const RawEvent RawEvent_)
protected

Gets the MetaCode from RawInput Data.

Parameters
RawEvent_The event that contains only Joystick Motion data.
Returns
a vector of metacode that represents button presses.

Definition at line 150 of file eventuserinput.cpp.

vector< Input::MetaCode > Mezzanine::EventUserInput::AddCodesFromSDLMouseMotion ( const RawEvent RawEvent_)
protected

Gets the MetaCode from RawInput Data.

Parameters
RawEvent_The event that contains only Mouse Motion data.
Returns
a vector of metacode that represents button presses.

Definition at line 135 of file eventuserinput.cpp.

void Mezzanine::EventUserInput::EraseCode ( const Input::MetaCode Code_)

Removes a specific code from storage.

Parameters
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.

Parameters
IndexThis 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.

Returns
Index The requested MetaCode to return.

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.

Returns
The amount of codes stored in this EventUserInput.

Retrieves a count of the stored Metacodes. Synonym for vector::size();

Definition at line 85 of file eventuserinput.cpp.

EventBase::EventType Mezzanine::EventUserInput::GetType ( ) const
virtual

Returns the type of this event.

Returns
Returns EventType::UserInput.

Implements Mezzanine::EventBase.

Definition at line 128 of file eventuserinput.cpp.


The documentation for this class was generated from the following files: