#include <inputservice.h>
Public Member Functions | |
InputService (ServiceConfiguration *configuration) | |
InputService (const InputService &that)=delete | |
InputService & | operator= (const InputService &)=delete |
void | processWindowEvents (Window &window, InputRouter &inputRouter, const EntityList &entities) |
void | processControllerEvents (int controllerID, InputRouter &inputRouter, const EntityList &entities) |
void | processAllEvents (InputRouter &inputRouter, const EntityList &entities) |
void | addEvent (InputEventPtr inEvent) |
virtual void | postUpdate (double deltaTime) |
![]() | |
UNPREFIXED_MODULE_NAME_INPUTCASE | Service (ServiceConfiguration *configuration) |
virtual void | getDependentServices (std::vector< rtti::TypeInfo > &dependencies) override |
virtual bool | init (nap::utility::ErrorState &errorState) override |
virtual void | update (double deltaTime) override |
virtual void | shutdown () override |
Service (ServiceConfiguration *configuration) | |
virtual | ~Service () |
Core & | getCore () |
const Core & | getCore () const |
std::string | getTypeName () const |
const Module & | getModule () const |
Service (Service &)=delete | |
Service & | operator= (const Service &)=delete |
Service (Service &&)=delete | |
Service & | operator= (Service &&)=delete |
Public Attributes | |
Signal< const ControllerConnectionEvent & > | controllerConnectionChanged |
Signal emitted when a controller is removed or added. More... | |
Additional Inherited Members | |
![]() | |
virtual void | registerObjectCreators (rtti::Factory &factory) |
virtual void | getDependentServices (std::vector< rtti::TypeInfo > &dependencies) |
virtual void | created () |
virtual bool | init (utility::ErrorState &error) |
virtual void | preUpdate (double deltaTime) |
virtual void | update (double deltaTime) |
virtual void | preShutdown () |
virtual void | shutdown () |
virtual void | preResourcesLoaded () |
virtual void | postResourcesLoaded () |
template<typename SERVICE_CONFIG > | |
SERVICE_CONFIG * | getConfiguration () |
template<typename SERVICE_CONFIG > | |
const SERVICE_CONFIG * | getConfiguration () const |
std::string | getIniFilePath () const |
std::string | getIniFilePath (const std::string &appendix) const |
Stores and processes input events. Currently supports two types of input events: ControllerEvent and WindowInputEvent. Window input events are generated from a window and contain mouse, keyboard and touch events. Controller events are generated from an external piece of hardware such as a game controller or joystick and are not related to a window Separate functions are available to forward stored input events to parts of the scene / a set of entities. It's important to call process..() at least once every frame! Dangling events, ie: events that are not processed, are cleared automatically each frame.
InputService | ( | ServiceConfiguration * | configuration | ) |
|
delete |
void addEvent | ( | InputEventPtr | inEvent | ) |
Adds an input event to the queue, to be processed later.
inEvent | the event to add, ownership is transfered here |
|
delete |
|
virtual |
Clears all dangling input events.
Reimplemented from Service.
void processAllEvents | ( | InputRouter & | inputRouter, |
const EntityList & | entities | ||
) |
Utility function that processes all input events. This call forwards all events, regardless of where they come from, to the given list of entities. This only works when there is exactly 1 window and therefore no reason to distinguish between windows. When there are multiple windows call processWindowEvents and processControllerEvents individually! Individual calls ensure that input events from a certain window are forwarded to the right part of the system.
inputRouter | The input router that selects what InputComponents receive input messages. |
entities | A list of root entities that are used to traverse the entity hierarchy. |
void processControllerEvents | ( | int | controllerID, |
InputRouter & | inputRouter, | ||
const EntityList & | entities | ||
) |
Forwards all input events associated with a specific 'game' controller, to all input components that are part of the list of entities The input router controls how the events are forwarded. A default input router will suffice in most cases
controllerID | the game controller id, starting from 0 |
inputRouter | The input router that selects what InputComponents receive input messages. |
entities | A list of root entities that are used to traverse the entity hierarchy. |
void processWindowEvents | ( | Window & | window, |
InputRouter & | inputRouter, | ||
const EntityList & | entities | ||
) |
Forwards all input events, generated from a window, to all input components that are part of the list of entities The input router controls how the events are forwarded. A default input router will suffice in most cases The need for this as a separate function is because the same parts of a scene can be drawn to different windows. By explicitly giving a window the user can associate events coming from a specific window to a specific part of the scene.
window | The window to process the input events for (mouse, keyboard touch etc.) |
inputRouter | The input router that selects what InputComponents receive input messages. |
entities | A list of root entities that are used to traverse the entity hierarchy. |
Signal<const ControllerConnectionEvent&> controllerConnectionChanged |
Signal emitted when a controller is removed or added.