MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ is_valid_glfw_key()

MAYAFLUX_API bool MayaFlux::Core::is_valid_glfw_key ( int  glfw_key)
noexcept

Check if a GLFW key code is valid/supported.

Parameters
glfw_keyGLFW key code to validate
Returns
True if the key is a recognized MayaFlux key, false otherwise

Definition at line 25 of file KeyMapping.cpp.

26{
27 // GLFW only generates specific key codes;
28 // Supported ranges based on Keys enum:
29 // - 32-126: Printable ASCII
30 // - 256-269: Navigation/editing
31 // - 280-284: Lock keys
32 // - 290-314: Function keys (F1-F25)
33 // - 320-336: Keypad
34 // - 340-348: Modifiers and menu
35
36 if (glfw_key == -1) {
37 return false;
38 }
39
40 if (glfw_key >= 32 && glfw_key <= 126) {
41 return true; // Printable ASCII range
42 }
43
44 if (glfw_key >= 256 && glfw_key <= 269) {
45 return true; // Escape through End
46 }
47
48 if (glfw_key >= 280 && glfw_key <= 284) {
49 return true; // Lock keys
50 }
51
52 if (glfw_key >= 290 && glfw_key <= 314) {
53 return true; // F1-F25
54 }
55
56 if (glfw_key >= 320 && glfw_key <= 336) {
57 return true; // Keypad
58 }
59
60 if (glfw_key >= 340 && glfw_key <= 348) {
61 return true; // Modifiers and Menu
62 }
63
64 return false;
65}

Referenced by from_glfw_key().

+ Here is the caller graph for this function: