aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-01-21 02:07:57 +0100
committerdec05eba <dec05eba@protonmail.com>2025-01-21 02:08:31 +0100
commit101013207f1dde35d67910b0555054d127c26aec (patch)
tree31d5012c95f0f4fa0fdb223749e7074b41515027
parente776c85d1986ee9cd7629ec5f04e89f79230378c (diff)
Add Keyboard::key_to_stringHEADmaster
m---------depends/mgl0
-rw-r--r--include/mglpp/window/Keyboard.hpp3
-rw-r--r--meson.build1
-rw-r--r--src/window/Keyboard.cpp12
4 files changed, 16 insertions, 0 deletions
diff --git a/depends/mgl b/depends/mgl
-Subproject 97d24e6a1b1fe8d2a4e217f9ee3f82a1accf468
+Subproject 66e7ceaa96de5c2acdea89b33773219ec0bb2c2
diff --git a/include/mglpp/window/Keyboard.hpp b/include/mglpp/window/Keyboard.hpp
index 17c4d7c..df2db20 100644
--- a/include/mglpp/window/Keyboard.hpp
+++ b/include/mglpp/window/Keyboard.hpp
@@ -112,6 +112,9 @@ namespace mgl {
/* This should always be the last key */
__NumKeys__
};
+
+ /* Returns nullptr if unknown key */
+ static const char* key_to_string(Key key);
};
}
diff --git a/meson.build b/meson.build
index 214ef63..258fae0 100644
--- a/meson.build
+++ b/meson.build
@@ -19,6 +19,7 @@ src = [
'src/system/Clock.cpp',
'src/system/Utf8.cpp',
'src/window/Window.cpp',
+ 'src/window/Keyboard.cpp',
'src/mglpp.cpp',
]
diff --git a/src/window/Keyboard.cpp b/src/window/Keyboard.cpp
new file mode 100644
index 0000000..bd031db
--- /dev/null
+++ b/src/window/Keyboard.cpp
@@ -0,0 +1,12 @@
+#include "../../include/mglpp/window/Keyboard.hpp"
+
+extern "C" {
+#include <mgl/window/key.h>
+}
+
+namespace mgl {
+ // static
+ const char* Keyboard::key_to_string(Key key) {
+ return mgl_key_to_string((mgl_key)key);
+ }
+} \ No newline at end of file