summaryrefslogtreecommitdiff
path: root/src/input.c
diff options
context:
space:
mode:
authorDaniel Hader <[email protected]>2026-06-14 12:58:14 -0500
committerDaniel Hader <[email protected]>2026-06-14 12:58:14 -0500
commit482ea0261cb9f0def49ce3df542b2a7f811262d1 (patch)
tree3bb961316b2ca856409b9f3b2145036ae9f5d704 /src/input.c
build and test environment using makefile and basic SDL3 setup
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/input.c b/src/input.c
new file mode 100644
index 0000000..ab7768c
--- /dev/null
+++ b/src/input.c
@@ -0,0 +1,35 @@
+#include "input.h"
+#include <SDL3/SDL_events.h>
+
+struct LEO_InputManager {
+ bool quit;
+};
+
+static struct LEO_InputManager *LEO_InputManager_singleton()
+{
+ static struct LEO_InputManager manager;
+ static bool initialized = false;
+
+ if (!initialized) {
+ manager.quit = false;
+ initialized = true;
+ }
+
+ return &manager;
+}
+
+void LEO_Input_update(const SDL_Event event)
+{
+ struct LEO_InputManager *manager = LEO_InputManager_singleton();
+
+ switch (event.type) {
+ case SDL_EVENT_QUIT:
+ manager->quit = true;
+ }
+}
+
+bool LEO_Input_quit()
+{
+ struct LEO_InputManager *manager = LEO_InputManager_singleton();
+ return manager->quit;
+}