SLProject 4.0.000
SLInputManager Class Reference

SLInputManager. manages system input and custom input devices. More...

#include <SLInputManager.h>

Public Member Functions

 SLInputManager ()
 
SLbool pollAndProcessEvents (SLSceneView *sv)
 
void queueEvent (const SLInputEvent *e)
 
SLVInputDevicedevices ()
 

Private Member Functions

SLbool processQueuedEvents (SLSceneView *sv)
 

Private Attributes

SLQInputEvent _systemEvents
 queue for known system events More...
 
SLVInputDevice _devices
 list of activated SLInputDevices More...
 

Friends

class SLInputDevice
 

Detailed Description

SLInputManager. manages system input and custom input devices.

One static instance of SLInputManager is used in AppDemo. Every user input has to go through the SLInputManager. System event's like touch, mouse, character input will be encapsulated in SLInputEvent subclasses and will be queued up before being sent to the relevant SLSceneView. Custom SLInputDevices can also be created. The SLInputDevices are guaranteed to receive a call to their poll() function whenever the SLInputManager requires them to send out new events. The method pollAndProcessEvents is called every frame in SLScene::onUpdate.

Constructor & Destructor Documentation

◆ SLInputManager()

SLInputManager::SLInputManager ( )
inline

Member Function Documentation

◆ devices()

SLVInputDevice & SLInputManager::devices ( )
inline

◆ pollAndProcessEvents()

SLbool SLInputManager::pollAndProcessEvents ( SLSceneView sv)

Sends any queued up system event's to their correct receiver and polls all activated SLInputDevices.

Note
The event queue is similar to how Qt manages it's events. The main difference is, that we don't use the SLInputEvent class outside of the SLInputManager. The SLInputManager calls the correct SLSceneView input handler functions directly. Also we don't allow for custom SLInputEvents. This is the other main difference to the Qt event system. The decision to go this route is simplicity for now. It is totally sufficient for our use cases to provide the user with the SLInputDevice interface to realize custom input. However it has to be considered, that Qt also has many GUI related events like MouseEnter, MouseLeave, Drag etc. For a sophisticated GUI implementation the whole input management in SL would have to be reviewed.

◆ processQueuedEvents()

SLbool SLInputManager::processQueuedEvents ( SLSceneView sv)
private

Work off any queued up input event's and notify the correct receiver.

Note
this is similar to the Qt QObject::event function.

◆ queueEvent()

void SLInputManager::queueEvent ( const SLInputEvent e)

Add a new SLInputEvent to the event queue. The queue will be emtied when a call to SLInputManager::pollEvents is made. The passed in SLInputEvents have to be dynamically allocated by the user, the deallocation is handled by the SLInputManager

Friends And Related Function Documentation

◆ SLInputDevice

friend class SLInputDevice
friend

Member Data Documentation

◆ _devices

SLVInputDevice SLInputManager::_devices
private

list of activated SLInputDevices

◆ _systemEvents

SLQInputEvent SLInputManager::_systemEvents
private

queue for known system events


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