SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLInputDevice Class Referenceabstract

Interface for input devices that have to be pollsed. More...

#include <SLInputDevice.h>

Public Member Functions

 SLInputDevice (SLInputManager &inputManager)
 
virtual ~SLInputDevice ()
 
void enable ()
 
void disable ()
 
virtual SLbool poll ()=0
 

Private Attributes

SLInputManager_inputManager
 

Detailed Description

Interface for input devices that have to be pollsed.

Definition at line 20 of file SLInputDevice.h.

Constructor & Destructor Documentation

◆ SLInputDevice()

SLInputDevice::SLInputDevice ( SLInputManager inputManager)
explicit

Constructor for SLInputDevices. This will automatically enable the device, adding them to the SLInputManager.

Definition at line 17 of file SLInputDevice.cpp.

18  : _inputManager(inputManager)
19 {
20  // enable any input device on creation
21  enable();
22 }
SLInputManager & _inputManager
Definition: SLInputDevice.h:34

◆ ~SLInputDevice()

SLInputDevice::~SLInputDevice ( )
virtual

The destructor removes the device from SLInputManager again if necessary.

Definition at line 26 of file SLInputDevice.cpp.

27 {
28  disable();
29 }

Member Function Documentation

◆ disable()

void SLInputDevice::disable ( )

Enabling an SLInputDevice will remove it from the device list kept by SLInputManager

Definition at line 42 of file SLInputDevice.cpp.

43 {
45  dl.erase(std::remove(dl.begin(), dl.end(), this), dl.end());
46 }
vector< SLInputDevice * > SLVInputDevice
Definition: SLInputDevice.h:37
SLVInputDevice & devices()

◆ enable()

void SLInputDevice::enable ( )

Enabling an SLInputDevice will add it to the device list kept by SLInputManager

Definition at line 34 of file SLInputDevice.cpp.

35 {
36  _inputManager.devices().push_back(this);
37 }

◆ poll()

virtual SLbool SLInputDevice::poll ( )
pure virtual

Polls a custom input device. returns true if the poll resulted in event's being sent out that were accepted by some receiver.

Member Data Documentation

◆ _inputManager

SLInputManager& SLInputDevice::_inputManager
private

Definition at line 34 of file SLInputDevice.h.


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