aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2019-01-13 09:25:20 -0500
committerPaul Duncan <pabs@pablotron.org>2019-01-13 09:25:20 -0500
commit3441e42dd23f7b951e83a902cb2a3fa758341638 (patch)
tree0f0da1bbfcfe91fb7055b01a5cd43dfc941171da
parentcd0f70f86d1cedffcd1bacf57d9250fdff1f7af3 (diff)
downloadsok-3441e42dd23f7b951e83a902cb2a3fa758341638.tar.bz2
sok-3441e42dd23f7b951e83a902cb2a3fa758341638.zip
add comments
-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);
}