summaryrefslogtreecommitdiff
path: root/life.c
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2022-08-13 20:42:28 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2022-08-13 20:42:28 -0300
commit21f71be7e7872176d7aac102f5da2614d8c9b287 (patch)
tree8a49ac4036f5c28789c510da13620d5ac08b56e8 /life.c
parente7307d06c5c90d9a02ba2d9c107491347983c14e (diff)
downloadlife-21f71be7e7872176d7aac102f5da2614d8c9b287.tar.gz
life-21f71be7e7872176d7aac102f5da2614d8c9b287.zip
Fix bug making program unable to quitHEADmaster
Diffstat (limited to 'life.c')
-rw-r--r--[-rwxr-xr-x]life.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/life.c b/life.c
index de8e1b8..b9a4971 100755..100644
--- a/life.c
+++ b/life.c
@@ -1,4 +1,3 @@
-#define SDL_DISABLE_IMMINTRIN_H
#include <stdlib.h>
#include <time.h>
#include "SDL2/SDL.h"
@@ -67,8 +66,9 @@ int main(int argc, char **argv) {
int rendertime = 0;
char cells[WIDTH * HEIGHT];
init(cells, 1);
- SDL_Event e;
- while (e.type != SDL_QUIT) {
+ SDL_Event e = {0};
+ int exit = 0;
+ while (!exit) {
SDL_Delay(SPF);
while (SDL_PollEvent(&e)) {
if (e.window.event == SDL_WINDOWEVENT_RESIZED)
@@ -87,6 +87,9 @@ int main(int argc, char **argv) {
if (e.key.keysym.sym == SDLK_g) {
grid ^= 1;
}
+ if (e.key.keysym.sym == SDLK_q) {
+ exit = 1;
+ }
}
int mx, my;
int mstate = SDL_GetMouseState(&mx, &my);