CoriEngine
Loading...
Searching...
No Matches
CoriKeycodes.hpp
Go to the documentation of this file.
1#pragma once
2#include <string_view>
3#define MAGIC_ENUM_RANGE_MIN 0
4#define MAGIC_ENUM_RANGE_MAX 512
5#include <magic_enum/magic_enum.hpp>
6
7namespace Cori {
8 namespace Core {
12 typedef enum CoriKeycode {
13
14 // this is just an adapted sdl scancodes for cori API
15
17
23 /* @{ */
24
51
62
68
121
123
136
151
170
212 /* not sure whether there's a reason to enable these */
213 /* CORI_KEY_LOCKINGCAPSLOCK = 130, */
214 /* CORI_KEY_LOCKINGNUMLOCK = 131, */
215 /* CORI_KEY_LOCKINGSCROLLLOCK = 132, */
218
238
251
298
307
312
313 /* @} *//* Usage page 0x07 */
314
324 /* @{ */
325
328
331
342 CORI_KEY_MEDIA_SELECT = 272, /* Media Select */
343
351
359
360 /* @} *//* Usage page 0x0C */
361
362
368 /* @{ */
369
380
381 /* @} *//* Mobile keys */
382
383 /* Add any other keys here. */
384
386
388
390
391 [[maybe_unused]] static std::string CoriGetKeyName(const CoriKeycode code) {
392 std::string_view name = magic_enum::enum_name(code);
393 constexpr std::string_view prefix = "CORI_";
394 if (name.starts_with(prefix)) {
395 name.remove_prefix(prefix.size());
396 }
397 return std::string(name);
398 }
399 }
400}
static std::string CoriGetKeyName(const CoriKeycode code)
CoriKeycode
This is a adaptation of SDL3 scancodes. Taken from 'SDL_scancode.h'.
@ CORI_KEY_DECIMALSEPARATOR
@ CORI_KEY_MEDIA_NEXT_TRACK
@ CORI_KEY_CHANNEL_INCREMENT
@ CORI_KEY_MEDIA_PLAY_PAUSE
@ CORI_KEY_MEDIA_PREVIOUS_TRACK
@ CORI_KEY_THOUSANDSSEPARATOR
@ CORI_KEY_KP_DBLVERTICALBAR
@ CORI_KEY_MEDIA_FAST_FORWARD
@ CORI_KEY_CHANNEL_DECREMENT
Global engine namespace.