From 1ec5afe3509e9258bf59ddda46402fab276c4667 Mon Sep 17 00:00:00 2001 From: leflores Date: Fri, 17 Feb 2023 17:19:33 -0500 Subject: [PATCH] Use stdbool --- main.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index a3f79bc..19a910d 100644 --- a/main.c +++ b/main.c @@ -2,10 +2,11 @@ #include #include #include +#include #include #include -#include +#include #include "./digits.h" @@ -155,14 +156,14 @@ int main(int argc, char **argv) { Mode mode = MODE_ASCENDING; float displayed_time = 0.0f; - int paused = 0; - int exit_after_countdown = 0; + bool paused = false; + bool exit_after_countdown = false; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-p") == 0) { - paused = 1; + paused = true; } else if (strcmp(argv[i], "-e") == 0) { - exit_after_countdown = 1; + exit_after_countdown = true; } else if (strcmp(argv[i], "clock") == 0) { mode = MODE_CLOCK; } else { @@ -195,7 +196,7 @@ int main(int argc, char **argv) secc(SDL_SetTextureColorMod(digits, MAIN_COLOR_R, MAIN_COLOR_G, MAIN_COLOR_B)); } - int quit = 0; + bool quit = false; size_t wiggle_index = 0; float wiggle_cooldown = WIGGLE_DURATION; float user_scale = 1.0f; @@ -206,7 +207,7 @@ int main(int argc, char **argv) while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: { - quit = 1; + quit = true; } break; case SDL_KEYDOWN: { @@ -237,10 +238,10 @@ int main(int argc, char **argv) case SDLK_F5: { displayed_time = 0.0f; - paused = 0; + paused = false; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-p") == 0) { - paused = 1; + paused = true; } else { displayed_time = parse_time(argv[i]); }