summaryrefslogtreecommitdiff
path: root/src/keyboard.h
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2022-11-02 22:20:04 +0100
committerAlbert Cervin <albert@acervin.com>2022-11-16 23:33:49 +0100
commit2f4cb88d5c60f725323739300bb49dfa8923e7d5 (patch)
tree6ec22c2be92eff05f18e5919e747faab56e555ad /src/keyboard.h
downloaddged-2f4cb88d5c60f725323739300bb49dfa8923e7d5.tar.gz
dged-2f4cb88d5c60f725323739300bb49dfa8923e7d5.tar.xz
dged-2f4cb88d5c60f725323739300bb49dfa8923e7d5.zip
🎉 And so it begins
Diffstat (limited to 'src/keyboard.h')
-rw-r--r--src/keyboard.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/keyboard.h b/src/keyboard.h
new file mode 100644
index 0000000..439e60d
--- /dev/null
+++ b/src/keyboard.h
@@ -0,0 +1,28 @@
+#include <stdbool.h>
+#include <stdint.h>
+
+enum modifiers {
+ Ctrl = 1 << 0,
+ Meta = 1 << 1,
+};
+
+// note that unicode chars are split over multiple keypresses
+// TODO: make unicode chars nicer to deal with
+struct key {
+ uint8_t c;
+ uint8_t mod;
+};
+
+struct keyboard {};
+
+struct keyboard_update {
+ struct key keys[32];
+ uint32_t nkeys;
+};
+
+struct keyboard keyboard_create();
+
+struct keyboard_update keyboard_begin_frame(struct keyboard *kbd);
+void keyboard_end_frame(struct keyboard *kbd);
+
+bool key_equal(struct key *key, uint8_t mod, uint8_t c);