summaryrefslogtreecommitdiff
path: root/platformer/src/controls.h
diff options
context:
space:
mode:
Diffstat (limited to 'platformer/src/controls.h')
-rw-r--r--platformer/src/controls.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/platformer/src/controls.h b/platformer/src/controls.h
index dbbe936..fc2ac4d 100644
--- a/platformer/src/controls.h
+++ b/platformer/src/controls.h
@@ -43,4 +43,21 @@
#ifndef CONTROLS_H
#define CONTROLS_H
+#include <stdbool.h>
+
+#include "math3d.h"
+
+typedef struct Input {
+ Vec2 move; /* left stick after deadzone, length 0..1. +x = right, +y = forward */
+ Vec2 look; /* right stick after deadzone, length 0..1. +x = orbit right, +y = tilt up */
+ bool jump_held; /* A is down this tick */
+ bool jump_pressed; /* A went down THIS tick (one tick only) */
+ bool reset_pressed; /* Back/Select went down this tick (one tick only) */
+ bool quit_pressed; /* Start (or Esc) went down this tick (one tick only) */
+ bool using_gamepad; /* true if a gamepad produced this Input (debug info) */
+} Input;
+
+void controls_init(void);
+void controls_poll(Input *out);
+
#endif /* CONTROLS_H */