SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLInputDevice.cpp
Go to the documentation of this file.
1
/**
2
* \file SLInputDevice.cpp
3
* \date January 2015
4
* \authors Marc Wacker, Marcus Hudritsch
5
* \copyright http://opensource.org/licenses/GPL-3.0
6
* \remarks Please use clangformat to format the code. See more code style on
7
* https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
8
*/
9
10
#include <algorithm>
11
#include <
SLInputManager.h
>
12
13
//-----------------------------------------------------------------------------
14
/*! Constructor for SLInputDevices. This will automatically enable the device,
15
adding them to the SLInputManager.
16
*/
17
SLInputDevice::SLInputDevice
(
SLInputManager
& inputManager)
18
: _inputManager(inputManager)
19
{
20
// enable any input device on creation
21
enable
();
22
}
23
//-----------------------------------------------------------------------------
24
/*! The destructor removes the device from SLInputManager again if necessary.
25
*/
26
SLInputDevice::~SLInputDevice
()
27
{
28
disable
();
29
}
30
//-----------------------------------------------------------------------------
31
/*! Enabling an SLInputDevice will add it to the device list kept by
32
SLInputManager
33
*/
34
void
SLInputDevice::enable
()
35
{
36
_inputManager
.
devices
().push_back(
this
);
37
}
38
//-----------------------------------------------------------------------------
39
/*! Enabling an SLInputDevice will remove it from the device list kept by
40
SLInputManager
41
*/
42
void
SLInputDevice::disable
()
43
{
44
SLVInputDevice
& dl =
_inputManager
.
devices
();
45
dl.erase(std::remove(dl.begin(), dl.end(),
this
), dl.end());
46
}
47
//-----------------------------------------------------------------------------
SLVInputDevice
vector< SLInputDevice * > SLVInputDevice
Definition:
SLInputDevice.h:37
SLInputManager.h
SLInputDevice::_inputManager
SLInputManager & _inputManager
Definition:
SLInputDevice.h:34
SLInputDevice::enable
void enable()
Definition:
SLInputDevice.cpp:34
SLInputDevice::SLInputDevice
SLInputDevice(SLInputManager &inputManager)
Definition:
SLInputDevice.cpp:17
SLInputDevice::~SLInputDevice
virtual ~SLInputDevice()
Definition:
SLInputDevice.cpp:26
SLInputDevice::disable
void disable()
Definition:
SLInputDevice.cpp:42
SLInputManager
SLInputManager. manages system input and custom input devices.
Definition:
SLInputManager.h:23
SLInputManager::devices
SLVInputDevice & devices()
Definition:
SLInputManager.h:31
modules
sl
source
input
SLInputDevice.cpp
Generated by
1.9.1