diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-06-15 14:28:29 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-07-03 20:50:19 +0100 |
commit | 7c7dc660e587eac1aa3c8b3405eba95ba558e682 (patch) | |
tree | 81d12d560b60d397be23c7d132e32a5de30e409a /src/keyboard.h | |
parent | 20e9d23b82f55a751c3cf1166cb59ef26775ee00 (diff) | |
download | imv-7c7dc660e587eac1aa3c8b3405eba95ba558e682.tar.gz |
Big glfw refactor
I did a lot of this in a very ad-hoc fashion with no proper commit
history. As such, the kindest thing to do seemed to be to just squash it
into this one commit.
Diffstat (limited to 'src/keyboard.h')
-rw-r--r-- | src/keyboard.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/keyboard.h b/src/keyboard.h new file mode 100644 index 0000000..755bae2 --- /dev/null +++ b/src/keyboard.h @@ -0,0 +1,27 @@ +#ifndef IMV_KEYBOARD_H +#define IMV_KEYBOARD_H + +#include <stdbool.h> +#include <unistd.h> + +struct imv_keyboard; + +/* Create a keyboard instance */ +struct imv_keyboard *imv_keyboard_create(void); + +/* Clean up a keyboard */ +void imv_keyboard_free(struct imv_keyboard *keyboard); + +/* Notify the keyboard of the state of a key */ +void imv_keyboard_update_key(struct imv_keyboard *keyboard, int scancode, bool pressed); + +/* Write the null-terminated name of the key corresponding to scancode into buf */ +size_t imv_keyboard_keyname(struct imv_keyboard *keyboard, int scancode, char *buf, size_t buflen); + +/* Describe the key corresponding to scancode, with modifier keys prefixed */ +char *imv_keyboard_describe_key(struct imv_keyboard *keyboard, int scancode); + +/* Write the null-terminated text generated by scancode being pressed into buf */ +size_t imv_keyboard_get_text(struct imv_keyboard *keyboard, int scancode, char *buf, size_t buflen); + +#endif |