SLInputManager. manages system input and custom input devices.
More...
#include <SLInputManager.h>
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.
◆ SLInputManager()
SLInputManager::SLInputManager |
( |
| ) |
|
|
inline |
◆ devices()
◆ pollAndProcessEvents()
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()
Work off any queued up input event's and notify the correct receiver.
- Note
- this is similar to the Qt QObject::event function.
◆ queueEvent()
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
◆ SLInputDevice
◆ _devices
list of activated SLInputDevices
◆ _systemEvents
queue for known system events
The documentation for this class was generated from the following files: