summaryrefslogtreecommitdiff
path: root/in_practice/breakout/input.h
diff options
context:
space:
mode:
Diffstat (limited to 'in_practice/breakout/input.h')
-rw-r--r--in_practice/breakout/input.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/in_practice/breakout/input.h b/in_practice/breakout/input.h
new file mode 100644
index 0000000..d5b9306
--- /dev/null
+++ b/in_practice/breakout/input.h
@@ -0,0 +1,24 @@
+#ifndef INPUT_H
+#define INPUT_H
+
+#include "types.h"
+
+typedef struct {
+ i32 last;
+ i32 current;
+} key_state_t;
+
+typedef struct {
+ key_state_t escape;
+ key_state_t right;
+ key_state_t left;
+ key_state_t space;
+} input_t;
+
+extern input_t init_input(void);
+extern void update_input(input_t *input);
+extern i32 key_first_press(key_state_t key);
+extern i32 key_is_pressed(key_state_t key);
+extern i32 key_was_pressed(key_state_t key);
+
+#endif