From 730cb70b39aae3974cae4a7a59567c0aeccd8d46 Mon Sep 17 00:00:00 2001 From: ktyl Date: Sat, 7 Aug 2021 03:56:42 +0100 Subject: [PATCH] extract input to file --- src/input.c | 10 ++++++++++ src/input.h | 5 +++++ src/main.c | 14 -------------- 3 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 src/input.c create mode 100644 src/input.h diff --git a/src/input.c b/src/input.c new file mode 100644 index 0000000..b0ac944 --- /dev/null +++ b/src/input.c @@ -0,0 +1,10 @@ +#include "input.h" + +int checkQuit() +{ + SDL_Event event; + + if (SDL_PollEvent(&event) && event.type == SDL_QUIT) return 1; + + return 0; +} diff --git a/src/input.h b/src/input.h new file mode 100644 index 0000000..c361356 --- /dev/null +++ b/src/input.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +int checkQuit(); diff --git a/src/main.c b/src/main.c index 056aad0..bbf88ba 100644 --- a/src/main.c +++ b/src/main.c @@ -8,10 +8,6 @@ const int WIDTH = 420; const int HEIGHT = 420; // forward declarations - -// input -int checkQuit(); - void updateUniforms(GLuint shaderProgram); void updateCameraUniforms(GLuint shaderProgram); @@ -166,13 +162,3 @@ void updateCameraUniforms(GLuint shaderProgram) int camllLocation = glGetUniformLocation(shaderProgram, "_camll"); glUniform3f(camllLocation, camll[0], camll[1], camll[2]); } - -int checkQuit() -{ - SDL_Event event; - - if (SDL_PollEvent(&event) && event.type == SDL_QUIT) return 1; - - return 0; -} -