MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Glfw/KeyMapping.hpp
Go to the documentation of this file.
1#pragma once
2
3#ifdef GLFW_BACKEND
4
6
7namespace MayaFlux::Core {
8
9/**
10 * @brief Convert a GLFW key code to MayaFlux Keys enum.
11 *
12 * GLFW key codes directly map to our Keys enum values (by design),
13 * so this is a straightforward type-safe cast.
14 *
15 * @param glfw_key GLFW key code (from GLFW_KEY_* constants)
16 * @return The corresponding IO::Keys value
17 *
18 * @note Unknown/unmapped GLFW keys are converted to Keys::Unknown
19 */
20MAYAFLUX_API IO::Keys from_glfw_key(int glfw_key) noexcept;
21
22/**
23 * @brief Convert a MayaFlux Keys enum to GLFW key code.
24 *
25 * Reverse mapping from our Keys enum back to GLFW key codes.
26 * Used when you need to interface with GLFW or serialize key bindings.
27 *
28 * @param key The IO::Keys value to convert
29 * @return The corresponding GLFW key code
30 */
31MAYAFLUX_API int to_glfw_key(IO::Keys key) noexcept;
32
33/**
34 * @brief Check if a GLFW key code is valid/supported.
35 *
36 * @param glfw_key GLFW key code to validate
37 * @return True if the key is a recognized MayaFlux key, false otherwise
38 */
39MAYAFLUX_API bool is_valid_glfw_key(int glfw_key) noexcept;
40
41} // namespace MayaFlux::Core
42
43#endif // GLFW_BACKEND