Skip to content

Commit

Permalink
Use stdbool
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloose committed Feb 17, 2023
1 parent eb3a37c commit 1ec5afe
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>

#include <SDL.h>
#include <SDL2/SDL.h>

#include "./digits.h"

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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: {
Expand Down Expand Up @@ -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]);
}
Expand Down

0 comments on commit 1ec5afe

Please sign in to comment.