summaryrefslogtreecommitdiff
path: root/src/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/input.c b/src/input.c
new file mode 100644
index 0000000..68722e7
--- /dev/null
+++ b/src/input.c
@@ -0,0 +1,22 @@
+#include "input.h"
+#include "pthread.h"
+
+pthread_t input_init(struct engine* engine) {
+ pthread_t thread;
+ pthread_create(&thread, NULL, (void*)input_handle, engine);
+ return thread;
+}
+void input_join(pthread_t thread, struct engine* engine) {
+ pthread_join(thread, NULL);
+}
+void input_handle(struct engine *engine) {
+ SDL_Event event;
+ while (engine->game_loop) {
+ // Quit game
+ // TODO: Locks?
+ SDL_PollEvent(&event);
+ if (event.type == SDL_QUIT) {
+ engine->game_loop = 0;
+ }
+ }
+}