Skip to main content

GLFWKeyLookup.ixx File

GLFW key code to `helios::input::types::Key` mapping. More...

Included Headers

#include <GLFW/glfw3.h> #include <array> #include <helios.input.types.Key>

Namespaces Index

namespacehelios
namespaceext

Platform-specific extensions and backend implementations. More...

namespaceglfw

GLFW-specific implementations. More...

namespaceinput

GLFW input handling. More...

namespaceGLFWKeyLookup

Description

GLFW key code to `helios::input::types::Key` mapping.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file GLFWKeyLookup.ixx
3 * @brief GLFW key code to `helios::input::types::Key` mapping.
4 */
5module;
6
7#include <GLFW/glfw3.h>
8#include <array>
9
10export module helios.ext.glfw.input.GLFWKeyLookup;
11
12import helios.input.types.Key;
13
15
16 /**
17 * @brief Provides a lookup for converting helios key codes to glfw-specific key codes.
18 *
19 * @param key The helios key to map to the key codes registered by GLFW
20 *
21 * @return A key-code in glfw space.
22 */
23 inline int from(const helios::input::types::Key key) noexcept {
24
25 static constexpr std::array<int, helios::input::types::Key::size_> HELIOS_TO_GLFW=[] {
26 std::array<int, helios::input::types::Key::size_> map{};
27
28 map[helios::input::types::Key::ESC] = GLFW_KEY_ESCAPE;
29 map[helios::input::types::Key::TILDE] = GLFW_KEY_GRAVE_ACCENT;
30 return map;
31 }();
32
33 return HELIOS_TO_GLFW[key];
34 }
35
36}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.