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

◆ from_glfw_key()

MAYAFLUX_API IO::Keys MayaFlux::Core::from_glfw_key ( int  glfw_key)
noexcept

Convert a GLFW key code to MayaFlux Keys enum.

GLFW key codes directly map to our Keys enum values (by design), so this is a straightforward type-safe cast.

Parameters
glfw_keyGLFW key code (from GLFW_KEY_* constants)
Returns
The corresponding IO::Keys value
Note
Unknown/unmapped GLFW keys are converted to Keys::Unknown

Definition at line 5 of file KeyMapping.cpp.

6{
7 if (glfw_key < -1 || glfw_key > 348) {
8 return IO::Keys::Unknown;
9 }
10
11 auto result = static_cast<IO::Keys>(glfw_key);
12
13 if (!is_valid_glfw_key(glfw_key)) {
14 return IO::Keys::Unknown;
15 }
16
17 return result;
18}

References is_valid_glfw_key(), and MayaFlux::IO::Unknown.

+ Here is the call graph for this function: