API Documentation
Loading...
Searching...
No Matches
Event.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: Event
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Vector.h>
34#include <NDEVR/StringStream.h>
35namespace NDEVR
36{
37 /**----------------------------------------------------------------------------
38 \brief Base class for user-driven events which are typically KeyEvent or MouseEvent
39 Events can be used to trigger various behavior in the NDEVR API
40 ----------------------------------------------------------------------------*/
41 struct Event
42 {};
43
44 /**----------------------------------------------------------------------------
45 \brief A class which describes a user key press
46 The KeyEvent can be used to trigger various behavior in the NDEVR API
47 ----------------------------------------------------------------------------*/
48 class KeyEvent : public Event
49 {
50 public:
51 /**----------------------------------------------------------------------------
52 The pressed key
53 ----------------------------------------------------------------------------*/
54 enum KEY
55 {
56 VK_UNSPECIFIED = 0x00
57 , VK_ABNT_C1 = 0xC1
58 , VK_ABNT_C2 = 0xC2
59 , LIB_VK_ADD = 0x6B
60 , LIB_VK_ATTN = 0xF6
61 , LIB_VK_BACK = 0x08
63 , LIB_VK_CLEAR = 0x0C
64 , LIB_VK_CRSEL = 0xF7
67 , LIB_VK_EREOF = 0xF9
69 , LIB_VK_SHIFT = 0x10
70
71 , LIB_VK_LEFT = 0x25
72 , LIB_VK_UP = 0x26
73 , LIB_VK_RIGHT = 0x27
74 , LIB_VK_DOWN = 0x28
76
79 , LIB_VK_META = 0xA4
80 , LIB_VK_MENU = 0x12
81 //, LIB_VK_ESCAPE = 0x1B
84 , LIB_VK_EXSEL = 0xF8
87
88 //Number keys
89 , VK_KEY_0 = 0x30
90 , VK_KEY_1 = 0x31
91 , VK_KEY_2 = 0x32
92 , VK_KEY_3 = 0x33
93 , VK_KEY_4 = 0x34
94 , VK_KEY_5 = 0x35
95 , VK_KEY_6 = 0x36
96 , VK_KEY_7 = 0x37
97 , VK_KEY_8 = 0x38
98 , VK_KEY_9 = 0x39
99 //Letter Keys
100 , VK_KEY_A = 0x41
101 , VK_KEY_B = 0x42
102 , VK_KEY_C = 0x43
103 , VK_KEY_D = 0x44
104 , VK_KEY_E = 0x45
105 , VK_KEY_F = 0x46
106 , VK_KEY_G = 0x47
107 , VK_KEY_H = 0x48
108 , VK_KEY_I = 0x49
109 , VK_KEY_J = 0x4A
110 , VK_KEY_K = 0x4B
111 , VK_KEY_L = 0x4C
112 , VK_KEY_M = 0x4D
113 , VK_KEY_N = 0x4E
114 , VK_KEY_O = 0x4F
115 , VK_KEY_P = 0x50
116 , VK_KEY_Q = 0x51
117 , VK_KEY_R = 0x52
118 , VK_KEY_S = 0x53
119 , VK_KEY_T = 0x54
120 , VK_KEY_U = 0x55
121 , VK_KEY_V = 0x56
122 , VK_KEY_W = 0x57
123 , VK_KEY_X = 0x58
124 , VK_KEY_Y = 0x59
125 , VK_KEY_Z = 0x5A
126 //
129 //NumPad
140 //Function keys
141 , VK_KEY_F1 = 0x70
142 , VK_KEY_F2 = 0x71
143 , VK_KEY_F3 = 0x72
144 , VK_KEY_F4 = 0x73
145 , VK_KEY_F5 = 0x74
146 , VK_KEY_F6 = 0x75
147 , VK_KEY_F7 = 0x76
148 , VK_KEY_F8 = 0x77
149 , VK_KEY_F9 = 0x78
150 , VK_KEY_F10 = 0x79
151 , VK_KEY_F11 = 0x7A
152 , VK_KEY_F12 = 0x7B
153 , VK_KEY_F13 = 0x7C
154 , VK_KEY_F14 = 0x7D
155 , VK_KEY_F15 = 0x7E
156 , VK_KEY_F16 = 0x7F
157 , VK_KEY_F17 = 0x80
158 , VK_KEY_F18 = 0x81
159 , VK_KEY_F19 = 0x82
160 , VK_KEY_F20 = 0x83
161 , VK_KEY_F21 = 0x84
162 , VK_KEY_F22 = 0x85
163 , VK_KEY_F23 = 0x86
164 , VK_KEY_F24 = 0x87
165 //OEM
198 //
199 , LIB_VK_PA1 = 0xFD
201 , LIB_VK_PLAY = 0xFA
209 , LIB_VK_ZOOM = 0xFB
210 , LIB_VK_NONE = 0xFF
212
224
229 , LIB_VK_BASS_UP = 0x0204
233
234 , LIB_VK_FORWARD = 0x0301
235 , LIB_VK_STOP = 0x0302
236 , LIB_VK_REFRESH = 0x0303
237
244
245
246 };
247 /**----------------------------------------------------------------------------
248 \brief The action taken with the key
249 The type of the KeyEvent determines how the program will react.
250 ----------------------------------------------------------------------------*/
258
259 /**----------------------------------------------------------------------------
260 \brief Modifiers describe a second key which affects the behavior of the key
261 being pressed
262 ----------------------------------------------------------------------------*/
264 {
265 SHIFT = 0x01
266 , CTRL = 0x02
267 , FUNCTION = 0x04
268 , ALT = 0x08
269 , META = 0x10
270 };
271 public:
285 bool operator==(const KeyEvent& other) const
286 {
287 return other.key_type == key_type &&
288 other.event_type == event_type &&
289 other.key_modifier == key_modifier;
290 }
291 NDEVR_BASE_API char toChar() const;
292 };
293 class WindowInstance;
345 template class NDEVR_BASE_API StringStream<KeyEvent>;
346}
347
#define NDEVR_BASE_API
Definition DLLInfo.h:57
A class which describes a user key press.
Definition Event.h:49
KeyEentType event_type
Definition Event.h:284
KEY
Definition Event.h:55
@ LIB_VK_BUTTON_R1
Definition Event.h:218
@ LIB_VK_OEM_PA1
Definition Event.h:191
@ LIB_VK_BACKSLASH
Definition Event.h:211
@ LIB_VK_OEM_ENLW
Definition Event.h:183
@ LIB_VK_MEDIA_PAUSE
Definition Event.h:243
@ VK_KEY_2
Definition Event.h:91
@ LIB_VK_OEM_5
Definition Event.h:171
@ LIB_VK_OEM_102
Definition Event.h:167
@ LIB_VK_BACK
Definition Event.h:61
@ VK_KEY_U
Definition Event.h:120
@ VK_KEY_F14
Definition Event.h:154
@ LIB_VK_ADD
Definition Event.h:59
@ VK_KEY_W
Definition Event.h:122
@ LIB_VK_LEFT
Definition Event.h:71
@ VK_KEY_Z
Definition Event.h:125
@ LIB_VK_DECIMAL
Definition Event.h:65
@ VK_KEY_T
Definition Event.h:119
@ LIB_VK_OEM_PLUS
Definition Event.h:195
@ VK_KEY_M
Definition Event.h:112
@ LIB_VK_PLAY
Definition Event.h:201
@ VK_KEY_I
Definition Event.h:108
@ LIB_VK_VOLUME_MUTE
Definition Event.h:227
@ LIB_VK_DELETE
Definition Event.h:75
@ LIB_VK_NONAME
Definition Event.h:128
@ LIB_VK_ICO_HELP
Definition Event.h:86
@ LIB_VK_OEM_PA3
Definition Event.h:193
@ LIB_VK_OEM_COMMA
Definition Event.h:180
@ VK_KEY_J
Definition Event.h:109
@ LIB_VK_BUTTON_A
Definition Event.h:213
@ LIB_VK_SUBTRACT
Definition Event.h:207
@ VK_KEY_N
Definition Event.h:113
@ VK_KEY_F15
Definition Event.h:155
@ VK_KEY_9
Definition Event.h:98
@ VK_KEY_E
Definition Event.h:104
@ LIB_VK_REFRESH
Definition Event.h:236
@ LIB_VK_OEM_FJ_TOUROKU
Definition Event.h:188
@ LIB_VK_PACKET
Definition Event.h:200
@ LIB_VK_OEM_6
Definition Event.h:172
@ LIB_VK_OEM_4
Definition Event.h:170
@ VK_KEY_0
Definition Event.h:89
@ LIB_VK_MULTIPLY
Definition Event.h:127
@ LIB_VK_META
Definition Event.h:79
@ VK_KEY_F1
Definition Event.h:141
@ LIB_VK_ZOOM
Definition Event.h:209
@ LIB_VK_CRSEL
Definition Event.h:64
@ LIB_LIB_VK_OEM_CLEAR
Definition Event.h:179
@ VK_KEY_F5
Definition Event.h:145
@ VK_KEY_5
Definition Event.h:94
@ VK_KEY_C
Definition Event.h:102
@ VK_KEY_F24
Definition Event.h:164
@ LIB_VK_OEM_PA2
Definition Event.h:192
@ VK_KEY_Q
Definition Event.h:116
@ VK_KEY_D
Definition Event.h:103
@ VK_ABNT_C2
Definition Event.h:58
@ LIB_VK_NUMPAD2
Definition Event.h:132
@ VK_KEY_P
Definition Event.h:115
@ LIB_VK_OEM_FJ_MASSHOU
Definition Event.h:186
@ LIB_VK_VOLUME_DOWN
Definition Event.h:226
@ LIB_VK_BUTTON_L1
Definition Event.h:217
@ VK_KEY_X
Definition Event.h:123
@ VK_KEY_7
Definition Event.h:96
@ LIB_VK_TREBLE_DOWN
Definition Event.h:232
@ LIB_VK_OEM_2
Definition Event.h:168
@ LIB_VK_TAB
Definition Event.h:208
@ LIB_VK_NUMPAD4
Definition Event.h:134
@ LIB_VK_OEM_BACKTAB
Definition Event.h:178
@ LIB_VK_OEM_AX
Definition Event.h:177
@ VK_KEY_B
Definition Event.h:101
@ LIB_VK_SEPARATOR
Definition Event.h:205
@ VK_KEY_F13
Definition Event.h:153
@ LIB_VK_BASS_BOOST
Definition Event.h:228
@ LIB_VK_BASS_DOWN
Definition Event.h:230
@ LIB_VK_BUTTON_MODE
Definition Event.h:221
@ LIB_VK_EQUAL
Definition Event.h:68
@ LIB_VK_ESCAPE
Definition Event.h:82
@ LIB_VK_OEM_3
Definition Event.h:169
@ LIB_VK_MENU
Definition Event.h:80
@ LIB_VK_OEM_FJ_LOYA
Definition Event.h:185
@ VK_KEY_6
Definition Event.h:95
@ LIB_VK_LCONTROL
Definition Event.h:77
@ VK_KEY_F21
Definition Event.h:161
@ LIB_VK_NUMPAD0
Definition Event.h:130
@ VK_KEY_F10
Definition Event.h:150
@ VK_KEY_F12
Definition Event.h:152
@ LIB_VK_OEM_PERIOD
Definition Event.h:194
@ LIB_VK_UP
Definition Event.h:72
@ VK_KEY_L
Definition Event.h:111
@ LIB_VK_OEM_JUMP
Definition Event.h:189
@ LIB_VK_OEM_1
Definition Event.h:166
@ VK_KEY_V
Definition Event.h:121
@ VK_KEY_G
Definition Event.h:106
@ LIB_VK_BUTTON_THUMBR
Definition Event.h:223
@ LIB_VK_OEM_FINISH
Definition Event.h:184
@ VK_KEY_F18
Definition Event.h:158
@ LIB_VK_OEM_ATTN
Definition Event.h:175
@ LIB_VK_DIVIDE
Definition Event.h:66
@ LIB_VK_RCONTROL
Definition Event.h:78
@ VK_KEY_F4
Definition Event.h:144
@ VK_KEY_F6
Definition Event.h:146
@ VK_KEY_3
Definition Event.h:92
@ LIB_VK_MEDIA_PREVIOUS
Definition Event.h:240
@ LIB_VK_SPACE
Definition Event.h:206
@ VK_KEY_K
Definition Event.h:110
@ LIB_VK_NUMPAD9
Definition Event.h:139
@ LIB_VK_TREBLE_UP
Definition Event.h:231
@ VK_KEY_F23
Definition Event.h:163
@ LIB_VK_OEM_8
Definition Event.h:174
@ VK_KEY_F16
Definition Event.h:156
@ LIB_VK_OEM_RESET
Definition Event.h:196
@ VK_KEY_A
Definition Event.h:100
@ LIB_VK_OEM_COPY
Definition Event.h:181
@ LIB_VK_BUTTON_SELECT
Definition Event.h:219
@ VK_KEY_1
Definition Event.h:90
@ VK_KEY_S
Definition Event.h:118
@ LIB_VK_VOLUME_UP
Definition Event.h:225
@ LIB_VK_NUMPAD3
Definition Event.h:133
@ LIB_VK_PA1
Definition Event.h:199
@ LIB_VK_PROCESSKEY
Definition Event.h:202
@ VK_KEY_F
Definition Event.h:105
@ LIB_VK_OEM_MINUS
Definition Event.h:190
@ LIB_VK_SELECT
Definition Event.h:204
@ VK_KEY_F20
Definition Event.h:160
@ LIB_VK_NUMPAD7
Definition Event.h:137
@ LIB_VK_RETURN
Definition Event.h:203
@ VK_KEY_F2
Definition Event.h:142
@ LIB_VK_BASS_UP
Definition Event.h:229
@ LIB_VK_DOWN
Definition Event.h:74
@ LIB_VK_OEM_FJ_ROYA
Definition Event.h:187
@ VK_KEY_F17
Definition Event.h:157
@ VK_KEY_F22
Definition Event.h:162
@ LIB_VK_BUTTON_Y
Definition Event.h:216
@ LIB_VK_BUTTON_X
Definition Event.h:215
@ LIB_VK_BUTTON_B
Definition Event.h:214
@ LIB_VK_SHIFT
Definition Event.h:69
@ VK_ABNT_C1
Definition Event.h:57
@ VK_KEY_O
Definition Event.h:114
@ VK_KEY_F8
Definition Event.h:148
@ LIB_VK_MEDIA_RECORD
Definition Event.h:242
@ LIB_VK_BUTTON_THUMBL
Definition Event.h:222
@ LIB_VK_OEM_7
Definition Event.h:173
@ LIB_VK_MEDIA_PLAY
Definition Event.h:238
@ VK_KEY_F7
Definition Event.h:147
@ VK_KEY_F9
Definition Event.h:149
@ VK_KEY_R
Definition Event.h:117
@ LIB_VK_BUTTON_START
Definition Event.h:220
@ LIB_VK_EXECUTE
Definition Event.h:83
@ VK_KEY_F11
Definition Event.h:151
@ VK_KEY_Y
Definition Event.h:124
@ VK_KEY_8
Definition Event.h:97
@ VK_KEY_H
Definition Event.h:107
@ LIB_VK_MEDIA_NEXT
Definition Event.h:241
@ LIB_VK_STOP
Definition Event.h:235
@ LIB_VK_OEM_WSCTRL
Definition Event.h:197
@ LIB_VK_NUMPAD8
Definition Event.h:138
@ LIB_VK_FORWARD
Definition Event.h:234
@ LIB_VK_RIGHT
Definition Event.h:73
@ LIB_VK_OEM_CUSEL
Definition Event.h:182
@ LIB_VK_CLEAR
Definition Event.h:63
@ LIB_VK_NUMPAD1
Definition Event.h:131
@ LIB_VK_ICO_CLEAR
Definition Event.h:85
@ LIB_VK_NUMPAD6
Definition Event.h:136
@ LIB_VK_EREOF
Definition Event.h:67
@ VK_KEY_F3
Definition Event.h:143
@ LIB_VK_NUMPAD5
Definition Event.h:135
@ LIB_VK_OEM_AUTO
Definition Event.h:176
@ VK_KEY_4
Definition Event.h:93
@ LIB_VK_MEDIA_STOP
Definition Event.h:239
@ LIB_VK_CANCEL
Definition Event.h:62
@ LIB_VK_NONE
Definition Event.h:210
@ LIB_VK_ATTN
Definition Event.h:60
@ VK_KEY_F19
Definition Event.h:159
@ VK_UNSPECIFIED
Definition Event.h:56
@ LIB_VK_EXSEL
Definition Event.h:84
KeyModifier
Modifiers describe a second key which affects the behavior of the key.
Definition Event.h:264
@ SHIFT
Definition Event.h:265
@ CTRL
Definition Event.h:266
@ META
Definition Event.h:269
@ FUNCTION
Definition Event.h:267
@ ALT
Definition Event.h:268
uint01 key_modifier
Definition Event.h:283
KEY key_type
Definition Event.h:282
bool operator==(const KeyEvent &other) const
Definition Event.h:285
KeyEvent()
Definition Event.h:272
KeyEvent(KEY key_type, uint01 key_modifier=0, KeyEentType event_type=KeyEentType::KEY_UNSPECIFIED)
Definition Event.h:277
NDEVR_BASE_API char toChar() const
KeyEentType
The action taken with the key.
Definition Event.h:252
@ KEY_RELEASED
Definition Event.h:256
@ KEY_UNSPECIFIED
Definition Event.h:253
@ KEY_PRESSED
Definition Event.h:255
@ KEY_CLICKED
Definition Event.h:254
Definition Event.h:295
WindowInstance * window_instance
Definition Event.h:331
MouseEventType
Definition Event.h:298
@ e_mouse_dragged
Definition Event.h:300
@ e_mouse_clicked
Definition Event.h:299
@ e_mouse_released
Definition Event.h:305
@ e_mouse_pressed
Definition Event.h:304
@ e_touch_zoomed
Definition Event.h:307
@ e_mouse_moved
Definition Event.h:303
@ e_mouse_scrolled
Definition Event.h:306
@ e_mouse_entered
Definition Event.h:301
@ e_mouse_exited
Definition Event.h:302
MouseClickType
Definition Event.h:311
@ e_right_button
Definition Event.h:312
@ none
Definition Event.h:315
@ e_left_button
Definition Event.h:314
@ e_center_button
Definition Event.h:313
uint01 number_of_clicks
Definition Event.h:330
Vector< 2, fltp04 > prev_location
Definition Event.h:325
MouseEvent(WindowInstance *instance)
Definition Event.h:321
Vector< 2, fltp04 > distance_scrolled
Definition Event.h:326
uint01 key_modifier
Definition Event.h:327
Vector< 2, fltp04 > event_location
Definition Event.h:324
MouseEventType event_type
Definition Event.h:328
MouseClickType click_type
Definition Event.h:329
MouseEvent()
Definition Event.h:318
bool operator==(const MouseEvent &other) const
Definition Event.h:333
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
Base class for user-driven events which are typically KeyEvent or MouseEvent.
Definition Event.h:42