diff options
m--------- | depends/mgl | 0 | ||||
-rw-r--r-- | include/mglpp/window/Keyboard.hpp | 3 | ||||
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | src/window/Keyboard.cpp | 12 |
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 |