YourGameLib
Loading...
Searching...
No Matches
input.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019-2024 Alexander Scholz
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
162. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20#ifndef YOURGAME_INPUT_H
21#define YOURGAME_INPUT_H
22
23namespace yourgame
24{
25 namespace input
26 {
28 enum Source
29 {
155 MOUSE_BUTTON_3, // middle
298 };
299
301 float get(Source source);
302
304 int geti(Source source);
305
307 float getDelta(Source source);
308 } // namespace input
309} // namespace yourgame
310
311#endif
Source
identifies the source of an input
Definition input.h:29
@ GAMEPAD_2_BUTTON_GUIDE
Definition input.h:246
@ MOUSE_BUTTON_2
Definition input.h:154
@ KEY_F20
Definition input.h:119
@ GAMEPAD_2_BUTTON_DPAD_UP
Definition input.h:249
@ GAMEPAD_3_AXIS_RIGHT_X
Definition input.h:277
@ KEY_RIGHT_SHIFT
Definition input.h:146
@ GAMEPAD_3_BUTTON_LEFT_BUMPER
Definition input.h:264
@ TOUCH_6_X
Definition input.h:182
@ KEY_RIGHT_CONTROL
Definition input.h:147
@ SCROLL_OFFSET_X
Definition input.h:161
@ TOUCH_0_DOWN
Definition input.h:163
@ KEY_F18
Definition input.h:117
@ KEY_J
Definition input.h:58
@ GAMEPAD_2_BUTTON_RIGHT_THUMB
Definition input.h:248
@ MOUSE_Y
Definition input.h:152
@ GAMEPAD_0_BUTTON_DPAD_RIGHT
Definition input.h:206
@ GAMEPAD_3_AXIS_LEFT_Y
Definition input.h:276
@ KEY_9
Definition input.h:46
@ KEY_WORLD_1
Definition input.h:79
@ KEY_B
Definition input.h:50
@ TOUCH_1_Y
Definition input.h:168
@ GAMEPAD_2_AXIS_LEFT_X
Definition input.h:253
@ TOUCH_7_Y
Definition input.h:186
@ GAMEPAD_3_BUTTON_DPAD_LEFT
Definition input.h:274
@ TOUCH_7_DOWN
Definition input.h:184
@ TOUCH_0_Y
Definition input.h:165
@ GAMEPAD_2_BUTTON_DPAD_LEFT
Definition input.h:252
@ KEY_RIGHT_SUPER
Definition input.h:149
@ KEY_E
Definition input.h:53
@ KEY_KP_5
Definition input.h:130
@ KEY_C
Definition input.h:51
@ GAMEPAD_0_BUTTON_X
Definition input.h:196
@ TOUCH_2_Y
Definition input.h:171
@ KEY_F14
Definition input.h:113
@ GAMEPAD_1_BUTTON_Y
Definition input.h:219
@ KEY_W
Definition input.h:71
@ KEY_F15
Definition input.h:114
@ FRAMEBUF_HEIGHT_INVERSE
Definition input.h:292
@ TOUCH_5_X
Definition input.h:179
@ KEY_KP_DECIMAL
Definition input.h:135
@ GAMEPAD_0_BUTTON_START
Definition input.h:201
@ KEY_F12
Definition input.h:111
@ GAMEPAD_2_BUTTON_DPAD_RIGHT
Definition input.h:250
@ KEY_UNKNOWN
Definition input.h:30
@ KEY_F10
Definition input.h:109
@ GAMEPAD_0_BUTTON_GUIDE
Definition input.h:202
@ GAMEPAD_0_AXIS_LEFT_X
Definition input.h:209
@ KEY_F13
Definition input.h:112
@ KEY_4
Definition input.h:41
@ GAMEPAD_3_BUTTON_DPAD_UP
Definition input.h:271
@ GAMEPAD_3_BUTTON_RIGHT_THUMB
Definition input.h:270
@ KEY_PAGE_UP
Definition input.h:91
@ KEY_DOWN
Definition input.h:89
@ MOUSE_BUTTON_1
Definition input.h:153
@ GAMEPAD_2_CONNECTED
Definition input.h:237
@ GAMEPAD_2_AXIS_RIGHT_Y
Definition input.h:256
@ KEY_RIGHT
Definition input.h:87
@ TOUCH_8_Y
Definition input.h:189
@ TOUCH_7_X
Definition input.h:185
@ GAMEPAD_2_BUTTON_Y
Definition input.h:241
@ GAMEPAD_1_BUTTON_LEFT_THUMB
Definition input.h:225
@ GAMEPAD_2_BUTTON_X
Definition input.h:240
@ TOUCH_6_Y
Definition input.h:183
@ KEY_F24
Definition input.h:123
@ KEY_M
Definition input.h:61
@ KEY_KP_9
Definition input.h:134
@ GAMEPAD_0_BUTTON_DPAD_UP
Definition input.h:205
@ KEY_KP_MULTIPLY
Definition input.h:137
@ GAMEPAD_1_BUTTON_RIGHT_BUMPER
Definition input.h:221
@ TOUCH_2_DOWN
Definition input.h:169
@ MOUSE_BUTTON_6
Definition input.h:158
@ GAMEPAD_1_BUTTON_DPAD_LEFT
Definition input.h:230
@ KEY_P
Definition input.h:64
@ KEY_0
Definition input.h:37
@ TOUCH_9_DOWN
Definition input.h:190
@ KEY_V
Definition input.h:70
@ TOUCH_4_DOWN
Definition input.h:175
@ KEY_5
Definition input.h:42
@ KEY_F19
Definition input.h:118
@ GAMEPAD_1_AXIS_RIGHT_TRIGGER
Definition input.h:236
@ KEY_TAB
Definition input.h:83
@ KEY_KP_ENTER
Definition input.h:140
@ VSYNC_ON
Definition input.h:296
@ FRAMEBUF_WIDTH
Definition input.h:289
@ TOUCH_3_X
Definition input.h:173
@ KEY_CAPS_LOCK
Definition input.h:95
@ KEY_3
Definition input.h:40
@ GAMEPAD_0_AXIS_RIGHT_TRIGGER
Definition input.h:214
@ GAMEPAD_2_BUTTON_B
Definition input.h:239
@ GAMEPAD_1_BUTTON_START
Definition input.h:223
@ KEY_U
Definition input.h:69
@ KEY_RIGHT_BRACKET
Definition input.h:77
@ KEY_LEFT_BRACKET
Definition input.h:75
@ KEY_Y
Definition input.h:73
@ GAMEPAD_3_AXIS_RIGHT_Y
Definition input.h:278
@ GAMEPAD_1_AXIS_LEFT_Y
Definition input.h:232
@ KEY_KP_EQUAL
Definition input.h:141
@ GAMEPAD_0_BUTTON_BACK
Definition input.h:200
@ GAMEPAD_1_BUTTON_B
Definition input.h:217
@ WINDOW_FULLSCREEN
Definition input.h:287
@ KEY_BACKSLASH
Definition input.h:76
@ KEY_F8
Definition input.h:107
@ GAMEPAD_2_BUTTON_LEFT_BUMPER
Definition input.h:242
@ GAMEPAD_0_BUTTON_DPAD_LEFT
Definition input.h:208
@ KEY_LEFT_SHIFT
Definition input.h:142
@ KEY_H
Definition input.h:56
@ KEY_KP_DIVIDE
Definition input.h:136
@ GAMEPAD_1_BUTTON_DPAD_UP
Definition input.h:227
@ FRAMEBUF_ASPECT_RATIO_INVERSE
Definition input.h:294
@ GAMEPAD_3_BUTTON_Y
Definition input.h:263
@ TOUCH_8_X
Definition input.h:188
@ KEY_KP_8
Definition input.h:133
@ GAMEPAD_3_BUTTON_START
Definition input.h:267
@ TOUCH_4_X
Definition input.h:176
@ GAMEPAD_1_AXIS_LEFT_X
Definition input.h:231
@ GAMEPAD_2_BUTTON_RIGHT_BUMPER
Definition input.h:243
@ GAMEPAD_3_AXIS_RIGHT_TRIGGER
Definition input.h:280
@ TOUCH_3_DOWN
Definition input.h:172
@ TOUCH_0_X
Definition input.h:164
@ FRAMEBUF_WIDTH_INVERSE
Definition input.h:290
@ TOUCH_4_Y
Definition input.h:177
@ KEY_F22
Definition input.h:121
@ GAMEPAD_0_AXIS_LEFT_TRIGGER
Definition input.h:213
@ KEY_F5
Definition input.h:104
@ KEY_L
Definition input.h:60
@ WINDOW_HEIGHT
Definition input.h:283
@ KEY_NUM_LOCK
Definition input.h:97
@ KEY_MINUS
Definition input.h:34
@ GAMEPAD_3_AXIS_LEFT_TRIGGER
Definition input.h:279
@ TOUCH_6_DOWN
Definition input.h:181
@ KEY_F23
Definition input.h:122
@ TOUCH_5_Y
Definition input.h:180
@ GAMEPAD_1_BUTTON_X
Definition input.h:218
@ KEY_K
Definition input.h:59
@ GAMEPAD_3_AXIS_LEFT_X
Definition input.h:275
@ KEY_R
Definition input.h:66
@ TOUCH_2_X
Definition input.h:170
@ GAMEPAD_3_BUTTON_BACK
Definition input.h:266
@ KEY_SPACE
Definition input.h:31
@ GAMEPAD_1_BUTTON_RIGHT_THUMB
Definition input.h:226
@ GAMEPAD_3_BUTTON_X
Definition input.h:262
@ GAMEPAD_2_BUTTON_A
Definition input.h:238
@ KEY_KP_6
Definition input.h:131
@ KEY_O
Definition input.h:63
@ KEY_APOSTROPHE
Definition input.h:32
@ GAMEPAD_2_AXIS_LEFT_Y
Definition input.h:254
@ GAMEPAD_1_BUTTON_DPAD_RIGHT
Definition input.h:228
@ KEY_PRINT_SCREEN
Definition input.h:98
@ KEY_1
Definition input.h:38
@ TOUCH_3_Y
Definition input.h:174
@ GAMEPAD_2_BUTTON_LEFT_THUMB
Definition input.h:247
@ GAMEPAD_3_BUTTON_GUIDE
Definition input.h:268
@ KEY_S
Definition input.h:67
@ GAMEPAD_2_BUTTON_BACK
Definition input.h:244
@ GAMEPAD_2_AXIS_RIGHT_TRIGGER
Definition input.h:258
@ KEY_6
Definition input.h:43
@ KEY_F25
Definition input.h:124
@ GAMEPAD_1_AXIS_RIGHT_X
Definition input.h:233
@ KEY_ESCAPE
Definition input.h:81
@ TOUCH_1_X
Definition input.h:167
@ KEY_COMMA
Definition input.h:33
@ KEY_G
Definition input.h:55
@ GAMEPAD_0_BUTTON_B
Definition input.h:195
@ GAMEPAD_3_BUTTON_DPAD_DOWN
Definition input.h:273
@ GAMEPAD_1_BUTTON_DPAD_DOWN
Definition input.h:229
@ KEY_SEMICOLON
Definition input.h:47
@ KEY_KP_4
Definition input.h:129
@ TOUCH_5_DOWN
Definition input.h:178
@ TOUCH_9_Y
Definition input.h:192
@ KEY_LEFT
Definition input.h:88
@ KEY_7
Definition input.h:44
@ MOUSE_BUTTON_4
Definition input.h:156
@ GAMEPAD_0_BUTTON_LEFT_THUMB
Definition input.h:203
@ KEY_MENU
Definition input.h:150
@ KEY_LEFT_SUPER
Definition input.h:145
@ GAMEPAD_0_CONNECTED
Definition input.h:193
@ GAMEPAD_3_BUTTON_B
Definition input.h:261
@ KEY_PAUSE
Definition input.h:99
@ FRAMEBUF_HEIGHT
Definition input.h:291
@ KEY_F2
Definition input.h:101
@ KEY_KP_7
Definition input.h:132
@ GAMEPAD_0_BUTTON_RIGHT_BUMPER
Definition input.h:199
@ GAMEPAD_2_BUTTON_START
Definition input.h:245
@ KEY_SCROLL_LOCK
Definition input.h:96
@ WINDOW_ASPECT_RATIO
Definition input.h:285
@ MOUSE_X
Definition input.h:151
@ GAMEPAD_0_BUTTON_DPAD_DOWN
Definition input.h:207
@ KEY_2
Definition input.h:39
@ KEY_F11
Definition input.h:110
@ MOUSE_BUTTON_3
Definition input.h:155
@ SCROLL_OFFSET_Y
Definition input.h:162
@ GAMEPAD_0_AXIS_LEFT_Y
Definition input.h:210
@ GAMEPAD_0_BUTTON_A
Definition input.h:194
@ WINDOW_ASPECT_RATIO_INVERSE
Definition input.h:286
@ GAMEPAD_2_BUTTON_DPAD_DOWN
Definition input.h:251
@ MOUSE_BUTTON_5
Definition input.h:157
@ KEY_ENTER
Definition input.h:82
@ KEY_KP_SUBTRACT
Definition input.h:138
@ KEY_Z
Definition input.h:74
@ GAMEPAD_3_BUTTON_LEFT_THUMB
Definition input.h:269
@ KEY_F
Definition input.h:54
@ MOUSE_BUTTON_8
Definition input.h:160
@ KEY_F3
Definition input.h:102
@ FRAMEBUF_MATCHES_WINDOW
Definition input.h:295
@ KEY_T
Definition input.h:68
@ KEY_UP
Definition input.h:90
@ GAMEPAD_0_AXIS_RIGHT_X
Definition input.h:211
@ KEY_N
Definition input.h:62
@ GAMEPAD_1_BUTTON_BACK
Definition input.h:222
@ KEY_F17
Definition input.h:116
@ KEY_RIGHT_ALT
Definition input.h:148
@ KEY_X
Definition input.h:72
@ KEY_D
Definition input.h:52
@ TOUCH_8_DOWN
Definition input.h:187
@ GAMEPAD_3_BUTTON_A
Definition input.h:260
@ MOUSE_BUTTON_7
Definition input.h:159
@ KEY_LEFT_ALT
Definition input.h:144
@ GAMEPAD_1_BUTTON_A
Definition input.h:216
@ KEY_F7
Definition input.h:106
@ WINDOW_HEIGHT_INVERSE
Definition input.h:284
@ POSTPROC_INITIALIZED
Definition input.h:288
@ KEY_8
Definition input.h:45
@ GAMEPAD_1_BUTTON_GUIDE
Definition input.h:224
@ GAMEPAD_0_AXIS_RIGHT_Y
Definition input.h:212
@ KEY_F4
Definition input.h:103
@ KEY_KP_3
Definition input.h:128
@ KEY_F6
Definition input.h:105
@ KEY_F16
Definition input.h:115
@ KEY_F9
Definition input.h:108
@ GAMEPAD_3_BUTTON_DPAD_RIGHT
Definition input.h:272
@ KEY_KP_0
Definition input.h:125
@ GAMEPAD_1_AXIS_LEFT_TRIGGER
Definition input.h:235
@ GAMEPAD_3_BUTTON_RIGHT_BUMPER
Definition input.h:265
@ KEY_DELETE
Definition input.h:86
@ WINDOW_WIDTH_INVERSE
Definition input.h:282
@ KEY_WORLD_2
Definition input.h:80
@ KEY_I
Definition input.h:57
@ GAMEPAD_3_CONNECTED
Definition input.h:259
@ TOUCH_9_X
Definition input.h:191
@ MOUSE_CATCHED
Definition input.h:297
@ KEY_GRAVE_ACCENT
Definition input.h:78
@ GAMEPAD_1_CONNECTED
Definition input.h:215
@ FRAMEBUF_ASPECT_RATIO
Definition input.h:293
@ KEY_LEFT_CONTROL
Definition input.h:143
@ KEY_EQUAL
Definition input.h:48
@ KEY_KP_ADD
Definition input.h:139
@ KEY_Q
Definition input.h:65
@ KEY_F21
Definition input.h:120
@ KEY_A
Definition input.h:49
@ KEY_INSERT
Definition input.h:85
@ KEY_KP_2
Definition input.h:127
@ KEY_PERIOD
Definition input.h:35
@ KEY_HOME
Definition input.h:93
@ KEY_PAGE_DOWN
Definition input.h:92
@ TOUCH_1_DOWN
Definition input.h:166
@ GAMEPAD_2_AXIS_LEFT_TRIGGER
Definition input.h:257
@ GAMEPAD_0_BUTTON_RIGHT_THUMB
Definition input.h:204
@ GAMEPAD_2_AXIS_RIGHT_X
Definition input.h:255
@ KEY_SLASH
Definition input.h:36
@ WINDOW_WIDTH
Definition input.h:281
@ GAMEPAD_0_BUTTON_Y
Definition input.h:197
@ KEY_END
Definition input.h:94
@ GAMEPAD_1_AXIS_RIGHT_Y
Definition input.h:234
@ KEY_KP_1
Definition input.h:126
@ GAMEPAD_1_BUTTON_LEFT_BUMPER
Definition input.h:220
@ KEY_BACKSPACE
Definition input.h:84
@ KEY_F1
Definition input.h:100
@ GAMEPAD_0_BUTTON_LEFT_BUMPER
Definition input.h:198
float get(Source source)
returns the current value of the input source source
Definition input.cpp:47
int geti(Source source)
returns the current value of the input source source, rounded to int
Definition input.cpp:53
float getDelta(Source source)
returns the value delta (current minus last frame value) of the input source source
Definition input.cpp:58
Definition audio.h:27