extract input to file

This commit is contained in:
ktyl 2021-08-07 03:56:42 +01:00
parent 4700579877
commit 730cb70b39
3 changed files with 15 additions and 14 deletions

10
src/input.c Normal file
View File

@ -0,0 +1,10 @@
#include "input.h"
int checkQuit()
{
SDL_Event event;
if (SDL_PollEvent(&event) && event.type == SDL_QUIT) return 1;
return 0;
}

5
src/input.h Normal file
View File

@ -0,0 +1,5 @@
#pragma once
#include <SDL2/SDL.h>
int checkQuit();

View File

@ -8,10 +8,6 @@ const int WIDTH = 420;
const int HEIGHT = 420; const int HEIGHT = 420;
// forward declarations // forward declarations
// input
int checkQuit();
void updateUniforms(GLuint shaderProgram); void updateUniforms(GLuint shaderProgram);
void updateCameraUniforms(GLuint shaderProgram); void updateCameraUniforms(GLuint shaderProgram);
@ -166,13 +162,3 @@ void updateCameraUniforms(GLuint shaderProgram)
int camllLocation = glGetUniformLocation(shaderProgram, "_camll"); int camllLocation = glGetUniformLocation(shaderProgram, "_camll");
glUniform3f(camllLocation, camll[0], camll[1], camll[2]); 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;
}