This is the manager responsible for the handling of input devices and events. More...
#include <inputmanager.h>
Public Types | |
typedef ControllerContainer::const_iterator | ConstControllerIterator |
Const Iterator type for game controller instances stored by this class. | |
typedef std::vector< Controller * > | ControllerContainer |
Basic container type for game controller instances. | |
typedef ControllerContainer::iterator | ControllerIterator |
Iterator type for game controller instances stored by this class. | |
Public Types inherited from Mezzanine::ManagerBase | |
enum | ManagerType { MT_Undefined = 0, MT_AudioManager = 1, MT_AnimationManager = 2, MT_CollisionShapeManager = 3, MT_CompositorManager = 4, MT_GraphicsManager = 5, MT_EventManager = 6, MT_InputManager = 7, MT_LogManager = 8, MT_MaterialManager = 9, MT_MeshManager = 10, MT_NetworkManager = 11, MT_ResourceManager = 12, MT_ScriptingManager = 13, MT_TextureManager = 14, MT_UIManager = 15, MT_ActorManager = 101, MT_AreaEffectManager = 102, MT_DebrisManager = 103, MT_PagingManager = 104, MT_PhysicsManager = 105, MT_SceneManager = 106, MT_SoundScapeManager = 107, MT_TerrainManager = 108, MT_VehicleManager = 109, MT_UserCreated = 512 } |
A listing of Manager Types. More... | |
Public Member Functions | |||
InputManager () | |||
Class constructor. | |||
InputManager (const 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... | |||
Boole | 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::EntresolManager | |||
EntresolManager () | |||
Class constructor. | |||
virtual | ~EntresolManager () | ||
Class destructor. | |||
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... | |||
Boole | IsInitialized () const | ||
Gets whether or not this manager has been initialized. More... | |||
Public Member Functions inherited from Mezzanine::Singleton< InputManager > | |||
~Singleton () | |||
Class destructor. | |||
Static Public Attributes | |
static const String | ImplementationName = "DefaultInputManager" |
A String containing the name of this manager implementation. | |
static const ManagerBase::ManagerType | InterfaceType = ManagerBase::MT_InputManager |
A ManagerType enum value used to describe the type of interface/functionality this manager provides. | |
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 | |
Boole | Initialized |
Simple Boole 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 Boole | SingletonValid () |
Checks to see if the singleton pointer is valid. More... | |
Protected Member Functions inherited from Mezzanine::Singleton< InputManager > | |
Singleton () | |
Class constructor. | |
Static Protected Attributes inherited from Mezzanine::Singleton< InputManager > | |
static InputManager * | SingletonPtr |
The one and only pointer to the single object. More... | |
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 | ( | const XML::Node & | XMLNode | ) |
XML constructor.
XMLNode | The node of the xml document to construct from. |
Definition at line 193 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 286 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 322 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 258 of file inputmanager.cpp.
Controller * Mezzanine::Input::InputManager::GetController | ( | const UInt16 | Index | ) | const |
Gets a controller by index.
Definition at line 245 of file inputmanager.cpp.
DeviceUpdateWorkUnit * Mezzanine::Input::InputManager::GetDeviceUpdateWork | ( | ) |
Gets the work unit responsible for updating the input device classes.
Definition at line 333 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 292 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 344 of file inputmanager.cpp.
const MetaCodeContainer & Mezzanine::Input::InputManager::GetInputDeltas | ( | ) | const |
Gets all the input codes that were generated this frame.
Definition at line 304 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 341 of file inputmanager.cpp.
UInt16 Mezzanine::Input::InputManager::GetNumControllers | ( | ) | const |
Gets the number of controllers detected.
Definition at line 250 of file inputmanager.cpp.
Keyboard * Mezzanine::Input::InputManager::GetSystemKeyboard | ( | ) | const |
Gets the system keyboard.
Definition at line 240 of file inputmanager.cpp.
Mouse * Mezzanine::Input::InputManager::GetSystemMouse | ( | ) | const |
Gets the system mouse.
Definition at line 235 of file inputmanager.cpp.
|
virtual |
Configures this manager for use prior to entering the main loop.
Implements Mezzanine::ManagerBase.
Definition at line 309 of file inputmanager.cpp.
Boole 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 289 of file inputmanager.cpp.
void Mezzanine::Input::InputManager::RemoveAllInputSequences | ( | ) |
Removes all stored input sequences.
Definition at line 298 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 164 of file inputmanager.h.
|
protected |
The pointer to the internal data handled by this manager.
Definition at line 154 of file inputmanager.h.
|
protected |
Container storing all the MetaCodes generated for the current frame.
Definition at line 150 of file inputmanager.h.
|
protected |
Container storing all the cross-device sequences this manager is to check for.
Definition at line 147 of file inputmanager.h.
|
protected |
The pointer to the object representing the system keyboard.
Definition at line 160 of file inputmanager.h.
|
protected |
The pointer to the object representing the system mouse.
Definition at line 157 of file inputmanager.h.
|
protected |
Can be used for thread safe logging and other thread specific resources.
Definition at line 167 of file inputmanager.h.