From 7c7dc660e587eac1aa3c8b3405eba95ba558e682 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Sat, 15 Jun 2019 14:28:29 +0100 Subject: 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. --- src/keyboard.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/keyboard.h (limited to 'src/keyboard.h') 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 +#include + +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 -- cgit v1.2.3