From 482ea0261cb9f0def49ce3df542b2a7f811262d1 Mon Sep 17 00:00:00 2001 From: Daniel Hader Date: Sun, 14 Jun 2026 12:58:14 -0500 Subject: build and test environment using makefile and basic SDL3 setup --- src/input.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/input.c (limited to 'src/input.c') 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 + +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; +} -- cgit v1.2.3