This is the manager responsible for the handling of input devices and events. More...
#include <inputmanager.h>
Public Types | |
typedef ControllerContainer::const_iterator | ConstControllerIterator |
typedef std::vector< Controller * > | ControllerContainer |
typedef ControllerContainer::iterator | ControllerIterator |
Public Types inherited from Mezzanine::ManagerBase | |
enum | ManagerType { MT_AudioManager = 1, MT_AnimationManager, MT_CollisionShapeManager, MT_CompositorManager, MT_GraphicsManager, MT_EventManager, MT_InputManager, MT_LogManager, MT_MaterialManager, MT_MeshManager, MT_NetworkManager, MT_ResourceManager, MT_ScriptingManager, MT_UIManager, MT_ActorManager = 100, MT_AreaEffectManager, MT_CameraManager, MT_DebrisManager, MT_PagingManager, MT_PhysicsManager, MT_SceneManager, MT_SoundScapeManager, MT_TerrainManager, MT_VehicleManager, MT_UserCreated = 512 } |
Public Member Functions | |||
InputManager () | |||
Class constructor. | |||
InputManager (XML::Node &XMLNode) | |||
XML constructor. More... | |||
virtual | ~InputManager () | ||
Class destructor. | |||
void | AddInputSequence (const MetaCodeContainer &Codes, const Int32 &SequenceID) | ||
Adds a custom sequence of inputs that this system will look for and generate MetaCode's for when they occur.
| |||
virtual void | Deinitialize () | ||
Removes this manager from any necessary configuration so it can be safely disposed of. More... | |||
UInt16 | DetectControllers () | ||
Gathers all of the controllers that are connected to the system and creates corresponding devices for each one. More... | |||
Controller * | GetController (const UInt16 Index) const | ||
Gets a controller by index. More... | |||
DeviceUpdateWorkUnit * | GetDeviceUpdateWork () | ||
Gets the work unit responsible for updating the input device classes. More... | |||
Int32 | GetIDofInputSequence (const MetaCodeContainer &Codes) | ||
Gets the ID of the provided sequence of MetaCode's.
| |||
virtual String | GetImplementationTypeName () const | ||
This Allows any manager name to be sent to a stream. Primarily used for logging. More... | |||
const MetaCodeContainer & | GetInputDeltas () const | ||
Gets all the input codes that were generated this frame. More... | |||
virtual ManagerType | GetInterfaceType () const | ||
This returns the type of this manager. More... | |||
UInt16 | GetNumControllers () const | ||
Gets the number of controllers detected. More... | |||
Keyboard * | GetSystemKeyboard () const | ||
Gets the system keyboard. More... | |||
Mouse * | GetSystemMouse () const | ||
Gets the system mouse. More... | |||
virtual void | Initialize () | ||
Configures this manager for use prior to entering the main loop. More... | |||
bool | InputSequenceExists (const MetaCodeContainer &Codes) | ||
Checks to see if the provided sequence of MetaCode's is already being checked for.
| |||
void | ReleaseAllControllers () | ||
Releases all controller devices from this manager. | |||
void | RemoveAllInputSequences () | ||
Removes all stored input sequences. More... | |||
void | RemoveInputSequence (const MetaCodeContainer &Codes) | ||
Removes the specified custom sequence of MetaCode's.
| |||
Public Member Functions inherited from Mezzanine::ManagerBase | |||
ManagerBase () | |||
Class constructor. | |||
virtual | ~ManagerBase () | ||
Class destructor. | |||
virtual String | GetInterfaceTypeAsString () const | ||
Gets a string of the interface type of this manager. More... | |||
bool | IsInitialized () const | ||
Gets whether or not this manager has been initialized. More... | |||
Public Member Functions inherited from Mezzanine::Singleton< InputManager > | |||
Singleton () | |||
Class constructor. | |||
~Singleton () | |||
Class destructor. | |||
Protected Attributes | |
DeviceUpdateWorkUnit * | DeviceUpdateWork |
The work unit that updates the input devices with the newest data. More... | |
InputManagerInternalData * | IMID |
The pointer to the internal data handled by this manager. More... | |
MetaCodeContainer | InputDeltas |
Container storing all the MetaCodes generated for the current frame. More... | |
SequenceContainer | Sequences |
Container storing all the cross-device sequences this manager is to check for. More... | |
Keyboard * | SystemKeyboard |
The pointer to the object representing the system keyboard. More... | |
Mouse * | SystemMouse |
The pointer to the object representing the system mouse. More... | |
Threading::DefaultThreadSpecificStorage::Type * | ThreadResources |
Can be used for thread safe logging and other thread specific resources. More... | |
Protected Attributes inherited from Mezzanine::ManagerBase | |
bool | Initialized |
Simple bool indicating whether or not this manager has been initialized. More... | |
Entresol * | TheEntresol |
The actual pointer to the Entresol core class. More... | |
Friends | |
class | DeviceUpdateWorkUnit |
Additional Inherited Members | |
Static Public Member Functions inherited from Mezzanine::ManagerBase | |
static String | GetTypeAsString (const ManagerType &ManagerType) |
Gets the string form of the type of manager. More... | |
static ManagerType | GetTypeFromString (const String &ManagerName) |
Gets the type of manager requested from a string. More... | |
Static Public Member Functions inherited from Mezzanine::Singleton< InputManager > | |
static InputManager * | GetSingletonPtr () |
Fetches a pointer to the singleton. More... | |
static bool | SingletonValid () |
Checks to see if the singleton pointer is valid. More... | |
Static Protected Attributes inherited from Mezzanine::Singleton< InputManager > | |
static InputManager * | SingletonPtr |
This is the manager responsible for the handling of input devices and events.
Inputs can be checked one of two ways in the input system. Either you can get the class instance for the device you want to query and use the query methods on it to check it's current state, or you can access the inputs that were raised for the current frame by getting the container storing the Input Delta's.
Another feature of the input system is the ability to set custom input sequences that can be raised via MetaCode for use elsewhere (such as the UI system). These sequences can be any number of MetaCode's of any type (that is valid) in any order. Any sequence passed in must be terminated with a "Null" MetaCode. A "Null" MetaCode is a MetaCode constructed using the default constructor, having it's Input code set to "KEY_UNKNOWN", it's meta value to 0, and it's device index set to the max value of UInt16. If the sequence is not terminated an exception will be thrown.
Input Sequences can be stored on the manager, or any input device, and their behavior is different based on where it is inserted. Input Sequences stored on the manager will look at all of the most recent inputs from all devices and use that to compare against the stored Input Sequences. If you have a single player game on the PC and want to use an Input Sequence that combines input from both the mouse and keyboard, then the InputManager is the place to store it. If however, you have a multiplayer fighter game (or split screen shooter) and want to track inputs from each of two or more controllers individually, then you'll want to place the Input Sequences on the proper controller device.
The InputManager can take any sequence, provided it is terminated. Input devices however can only take sequences with MetaCode's that pertain to their own device, otherwise an exception will be thrown. At each place of storage Input Sequences are forced to be unique(but they can exist on multiple devices). Input Sequence ID's however are not forced to be unique at any point in the system. Furthermore when a MetaCode is generated after an Input Sequence occurs, it is only given the ID the sequence, but not which sequence generated it. In the case of controllers they will be given a device ID, but otherwise the origin will not be reported. This allows you to provide multiple ways to generating the appropriate MetaCode(which could trigger something else in the UI system), but this also means great care must be taken when deciding on the ID's for each Input Sequence.
Definition at line 128 of file inputmanager.h.
Mezzanine::Input::InputManager::InputManager | ( | XML::Node & | XMLNode) |
XML constructor.
XMLNode | The node of the xml document to construct from. |
Definition at line 191 of file inputmanager.cpp.
void Mezzanine::Input::InputManager::AddInputSequence | ( | const MetaCodeContainer & | Codes, |
const Int32 & | SequenceID | ||
) |
Adds a custom sequence of inputs that this system will look for and generate MetaCode's for when they occur.
If | the vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown. An exception can also be thrown if the ID provided is the max value of an Int32. |
Codes | A vector containing the sequence of MetaCode's to be added. |
SequenceID | A unique UInt32 to be used as the identifier for this sequence when a MetaCode is generated. |
Definition at line 284 of file inputmanager.cpp.
|
virtual |
Removes this manager from any necessary configuration so it can be safely disposed of.
Implements Mezzanine::ManagerBase.
Definition at line 320 of file inputmanager.cpp.
UInt16 Mezzanine::Input::InputManager::DetectControllers | ( | ) |
Gathers all of the controllers that are connected to the system and creates corresponding devices for each one.
Definition at line 256 of file inputmanager.cpp.
Controller * Mezzanine::Input::InputManager::GetController | ( | const UInt16 | Index) | const |
Gets a controller by index.
Definition at line 243 of file inputmanager.cpp.
DeviceUpdateWorkUnit * Mezzanine::Input::InputManager::GetDeviceUpdateWork | ( | ) |
Gets the work unit responsible for updating the input device classes.
Definition at line 331 of file inputmanager.cpp.
Int32 Mezzanine::Input::InputManager::GetIDofInputSequence | ( | const MetaCodeContainer & | Codes) |
Gets the ID of the provided sequence of MetaCode's.
If | the vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown. |
Codes | A vector containing the sequence of MetaCode's to get the ID for. |
Definition at line 290 of file inputmanager.cpp.
|
virtual |
This Allows any manager name to be sent to a stream. Primarily used for logging.
Implements Mezzanine::ManagerBase.
Definition at line 342 of file inputmanager.cpp.
const MetaCodeContainer & Mezzanine::Input::InputManager::GetInputDeltas | ( | ) | const |
Gets all the input codes that were generated this frame.
Definition at line 302 of file inputmanager.cpp.
|
virtual |
This returns the type of this manager.
This is intended to make using and casting from Manager base easier. With this is is possible to cast from ManagerBase to the correct Manager Type.
Implements Mezzanine::ManagerBase.
Definition at line 339 of file inputmanager.cpp.
UInt16 Mezzanine::Input::InputManager::GetNumControllers | ( | ) | const |
Gets the number of controllers detected.
Definition at line 248 of file inputmanager.cpp.
Keyboard * Mezzanine::Input::InputManager::GetSystemKeyboard | ( | ) | const |
Gets the system keyboard.
Definition at line 238 of file inputmanager.cpp.
Mouse * Mezzanine::Input::InputManager::GetSystemMouse | ( | ) | const |
Gets the system mouse.
Definition at line 233 of file inputmanager.cpp.
|
virtual |
Configures this manager for use prior to entering the main loop.
Implements Mezzanine::ManagerBase.
Definition at line 307 of file inputmanager.cpp.
bool Mezzanine::Input::InputManager::InputSequenceExists | ( | const MetaCodeContainer & | Codes) |
Checks to see if the provided sequence of MetaCode's is already being checked for.
If | the vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown. |
Codes | A vector containing the sequence of MetaCode's to check for. |
Definition at line 287 of file inputmanager.cpp.
void Mezzanine::Input::InputManager::RemoveAllInputSequences | ( | ) |
Removes all stored input sequences.
Definition at line 296 of file inputmanager.cpp.
void Mezzanine::Input::InputManager::RemoveInputSequence | ( | const MetaCodeContainer & | Codes) |
|
protected |
The work unit that updates the input devices with the newest data.
Definition at line 156 of file inputmanager.h.
|
protected |
The pointer to the internal data handled by this manager.
Definition at line 146 of file inputmanager.h.
|
protected |
Container storing all the MetaCodes generated for the current frame.
Definition at line 142 of file inputmanager.h.
|
protected |
Container storing all the cross-device sequences this manager is to check for.
Definition at line 139 of file inputmanager.h.
|
protected |
The pointer to the object representing the system keyboard.
Definition at line 152 of file inputmanager.h.
|
protected |
The pointer to the object representing the system mouse.
Definition at line 149 of file inputmanager.h.
|
protected |
Can be used for thread safe logging and other thread specific resources.
Definition at line 159 of file inputmanager.h.