SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLInputEvent.h
Go to the documentation of this file.
1 /**
2  * \file SLInputEvent.h
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 #ifndef SLINPUTEVENT_H
11 #define SLINPUTEVENT_H
12 
13 #include <SL.h>
14 #include <SLEnums.h>
15 #include <queue>
16 
17 //-----------------------------------------------------------------------------
18 //! Baseclass for all system input events.
19 /*! SLProject has it's own internal event queue to guarantee the same input
20 handling accross multiple platforms. Some system's might send system events
21 asynchronously. This is why we provide the SLInputEvent class for all
22 system relevant input events.
23 */
25 {
26 public:
27  enum Type
28  {
44  NumEvents
45  } type; //!< concrete type of the event
46  SLint svIndex; //!< index of the receiving scene view for this event
47 
48  SLInputEvent(Type t) : type(t) {}
49 };
50 
51 //-----------------------------------------------------------------------------
52 //! Specialized SLInput class for all mouse related input events.
53 class SLMouseEvent : public SLInputEvent
54 {
55 public:
60 
62 };
63 
64 //-----------------------------------------------------------------------------
65 //! Specialized SLInput class for all keypress related input events.
66 class SLKeyEvent : public SLInputEvent
67 {
68 public:
71 
73 };
74 
75 //-----------------------------------------------------------------------------
76 //! Specialized SLInput class for touch related input events.
77 class SLTouchEvent : public SLInputEvent
78 {
79 public:
84 
86 };
87 
88 //-----------------------------------------------------------------------------
89 //! Specialized SLInput class for all device rotation related input events.
91 {
92 public:
93  float x, y, z, w;
94 
96 };
97 
98 //-----------------------------------------------------------------------------
99 //! Specialized SLInput class for window resize events.
101 {
102 public:
103  int width;
104  int height;
105 
107 };
108 
109 //-----------------------------------------------------------------------------
110 //! Specialized SLInput class for unicode character input.
111 /*! Character input differs from simple key input that it can be generated from
112 a combination of different key presses. Some key's might not fire a character
113 event, others might fire multiple at once.
114 */
116 {
117 public:
119 
121 };
122 
123 //-----------------------------------------------------------------------------
124 //! Specialized SLInput class to trigger a screen capture
126 {
127 public:
129 
131 };
132 
133 //-----------------------------------------------------------------------------
134 typedef std::queue<const SLInputEvent*> SLQInputEvent;
135 //-----------------------------------------------------------------------------
136 #endif
unsigned int SLuint
Definition: SL.h:171
string SLstring
Definition: SL.h:158
int SLint
Definition: SL.h:170
SLMouseButton
Mouse button codes.
Definition: SLEnums.h:98
SLKey
Keyboard key codes enumeration.
Definition: SLEnums.h:16
std::queue< const SLInputEvent * > SLQInputEvent
Definition: SLInputEvent.h:134
Specialized SLInput class for unicode character input.
Definition: SLInputEvent.h:116
Baseclass for all system input events.
Definition: SLInputEvent.h:25
SLint svIndex
index of the receiving scene view for this event
Definition: SLInputEvent.h:46
SLInputEvent(Type t)
Definition: SLInputEvent.h:48
enum SLInputEvent::Type type
concrete type of the event
Specialized SLInput class for all keypress related input events.
Definition: SLInputEvent.h:67
SLKeyEvent(Type t)
Definition: SLInputEvent.h:72
SLKey modifier
Definition: SLInputEvent.h:70
Specialized SLInput class for all mouse related input events.
Definition: SLInputEvent.h:54
SLKey modifier
Definition: SLInputEvent.h:59
SLMouseButton button
Definition: SLInputEvent.h:58
SLMouseEvent(Type t)
Definition: SLInputEvent.h:61
Specialized SLInput class for window resize events.
Definition: SLInputEvent.h:101
Specialized SLInput class for all device rotation related input events.
Definition: SLInputEvent.h:91
SLRotationEvent(Type t)
Definition: SLInputEvent.h:95
Specialized SLInput class to trigger a screen capture.
Definition: SLInputEvent.h:126
Specialized SLInput class for touch related input events.
Definition: SLInputEvent.h:78
SLTouchEvent(Type t)
Definition: SLInputEvent.h:85