aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sdl/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sdl/main.c b/src/sdl/main.c
index 882eefb..12f296b 100644
--- a/src/sdl/main.c
+++ b/src/sdl/main.c
@@ -59,6 +59,7 @@ int main(int argc, char *argv[]) {
die("SDL_Init(): %s", SDL_GetError());
}
+ // register exit handler
if (atexit(SDL_Quit)) {
die("atexit(): %s", strerror(errno));
exit(EXIT_FAILURE);
@@ -83,9 +84,12 @@ int main(int argc, char *argv[]) {
bool done = false;
SDL_Event ev;
while (!done) {
+ // read events
while (SDL_PollEvent(&ev)) {
+ // get action
const action_t action = get_action(&ev);
+ // handle action
switch (action.type) {
case ACTION_NONE:
// do nothing
@@ -183,6 +187,7 @@ int main(int argc, char *argv[]) {
}
}
+ // draw
draw(&draw_ctx);
}