Emergency 2017 Dokumentation  v3.0.1
qsf::InputSystem Class Reference

Input system class. More...

#include <InputSystem.h>

Public Member Functions

 InputSystem ()
 Default constructor. More...
 
virtual ~InputSystem ()
 Destructor. More...
 
InputDeviceManagergetInputDeviceManager () const
 Return the input device manager. More...
 
bool addInputListener (InputListener &inputListener)
 Add an input listener. More...
 
bool removeInputListener (InputListener &inputListener)
 Remove an input listener. More...
 
void updateMouseClippingArea ()
 Update the mouse clipping area. More...
 
OisManagergetOisManager () const
 Return the OIS manager instance. More...
 
void enableOisManager (bool enable)
 Return the OIS manager instance. More...
 
void addEventToInputQueue (InputEvent *inputEvent)
 Add an input event to the event queue. More...
 
template<typename TYPE >
TYPE & createInputHandler (const StringHash &id)
 Create and add a new input handler. More...
 
bool destroyInputHandler (const StringHash &id)
 Destroy an input handler. More...
 
void destroyAllInputHandlers ()
 Destroy all input handlers. More...
 
InputHandlergetInputHandlerById (const StringHash &id) const
 Return an input handler with the given ID. More...
 
KeyboardDevicegetKeyboard () const
 Return the keyboard device. More...
 
MouseDevicegetMouse () const
 Return the mouse device. More...
 
JoystickDevicegetJoystick () const
 Return the joystick device. More...
 
UserInputDeviceFeedergetUserInputDeviceFeeder () const
 Return the default feeder for user-defined input devices. More...
 
void updateJob (const JobArguments &jobArguments)
 Main update function that is passed to the job manager. More...
 
virtual const char * getName () const override
 Get the name of the system. More...
 
virtual bool onStartup (bool serverMode) override
 Startup the system. More...
 
virtual void onShutdown () override
 Shutdown the system. More...
 
- Public Member Functions inherited from qsf::System
virtual ~System ()
 Destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from qsf::System
 System ()
 Default constructor. More...
 

Detailed Description

Input system class.

Note
Todo:
  • TODO(fw): It would be nice to inject arbitrary input events; but that's tricky because of OIS, we would have to change its internal state as well.

Definition at line 55 of file InputSystem.h.

Constructor & Destructor Documentation

qsf::InputSystem::InputSystem ( )
inline

Default constructor.

Definition at line 20 of file InputSystem-inl.h.

qsf::InputSystem::~InputSystem ( )
inlinevirtual

Destructor.

Definition at line 28 of file InputSystem-inl.h.

Member Function Documentation

void qsf::InputSystem::addEventToInputQueue ( InputEvent inputEvent)

Add an input event to the event queue.

Parameters
[in]inputEventPointer to the event to add; may be a null pointer, but then nothing is done
bool qsf::InputSystem::addInputListener ( InputListener inputListener)

Add an input listener.

Parameters
[in]inputListenerInput listener to add, must stay valid as long as it's registered within the input system
Returns
"true" if all went fine, else "false" (input listener already registered?)
template<typename TYPE >
TYPE & qsf::InputSystem::createInputHandler ( const StringHash id)

Create and add a new input handler.

Parameters
[in]idID of the input handler, can be used to identify the handler later on
Note
If the ID is already in use by another input handler, this one will be automatically removed

Definition at line 65 of file InputSystem-inl.h.

void qsf::InputSystem::destroyAllInputHandlers ( )

Destroy all input handlers.

bool qsf::InputSystem::destroyInputHandler ( const StringHash id)

Destroy an input handler.

Parameters
[in]idID of the input handler to be removed
Returns
"true" if a handler with the given ID was found and could be removed, "false" if the ID was not in use
void qsf::InputSystem::enableOisManager ( bool  enable)

Return the OIS manager instance.

Parameters
[in]enable"true" to enable the OIS manager, "false" to disable it
Note
  • Calling this method invalidates all pointers, that may have been acquired by calling the getOisManager() instance
InputDeviceManager & qsf::InputSystem::getInputDeviceManager ( ) const
inline

Return the input device manager.

Definition at line 33 of file InputSystem-inl.h.

InputHandler* qsf::InputSystem::getInputHandlerById ( const StringHash id) const

Return an input handler with the given ID.

Parameters
[in]idID of the input handler to be found
Returns
Pointer to the input handler, or null pointer if no one with that ID exists; do not destroy the returned instance
JoystickDevice & qsf::InputSystem::getJoystick ( ) const
inline

Return the joystick device.

Definition at line 54 of file InputSystem-inl.h.

KeyboardDevice & qsf::InputSystem::getKeyboard ( ) const
inline

Return the keyboard device.

Definition at line 44 of file InputSystem-inl.h.

MouseDevice & qsf::InputSystem::getMouse ( ) const
inline

Return the mouse device.

Definition at line 49 of file InputSystem-inl.h.

const char * qsf::InputSystem::getName ( ) const
inlineoverridevirtual

Get the name of the system.

Returns
Null terminated ASCII name of the system, never a null pointer, do not manipulate or destroy the returned name

Implements qsf::System.

Definition at line 85 of file InputSystem-inl.h.

OisManager * qsf::InputSystem::getOisManager ( ) const
inline

Return the OIS manager instance.

Returns
A pointer to the OIS manager instance, or nullptr if the OIS manager is disabled

Definition at line 39 of file InputSystem-inl.h.

UserInputDeviceFeeder & qsf::InputSystem::getUserInputDeviceFeeder ( ) const
inline

Return the default feeder for user-defined input devices.

Definition at line 59 of file InputSystem-inl.h.

virtual void qsf::InputSystem::onShutdown ( )
overridevirtual

Shutdown the system.

Note
  • This method is only called case "onStartup()" returned successfully

Implements qsf::System.

virtual bool qsf::InputSystem::onStartup ( bool  serverMode)
overridevirtual

Startup the system.

Parameters
[in]serverMode"true" if the system should start in server mode, else "false"
Returns
"true" if all went fine, else "false"
Note
  • Server mode means that e.g. there's no need for audio & visual stuff because there's no display or sound hardware in the first place

Implements qsf::System.

bool qsf::InputSystem::removeInputListener ( InputListener inputListener)

Remove an input listener.

Parameters
[in]inputListenerInput listener to remove
Returns
"true" if all went fine, else "false" (input listener not registered?)
void qsf::InputSystem::updateJob ( const JobArguments jobArguments)

Main update function that is passed to the job manager.

Parameters
[in]jobArgumentsJob arguments
void qsf::InputSystem::updateMouseClippingArea ( )

Update the mouse clipping area.

Note
  • Call this whenever the size of the focus native window handle was changed
  • Sadly, OIS really needs this information, so don't forget to take care of it

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