Mercurial > hg > dmlib
diff tests/blittest.c @ 2586:9807ae37ad69
Require stdbool.h, we require C11 now.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 Dec 2022 15:59:22 +0200 |
parents | b7cd5dd0b82e |
children |
line wrap: on
line diff
--- a/tests/blittest.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tests/blittest.c Thu Dec 08 15:59:22 2022 +0200 @@ -8,7 +8,7 @@ #define DM_COLORS (256) char *optFontFile = "font.ttf"; -BOOL optBenchmark = FALSE; +bool optBenchmark = false; int optVFlags = SDL_SWSURFACE | SDL_HWPALETTE; int optScrWidth = 640, optScrHeight = 480, optFontSize = 20, optScrDepth = 32; int optBenchmarkLen = 20; @@ -33,7 +33,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { case 0: @@ -62,7 +62,7 @@ if (w < 320 || h < 200 || w > 3200 || h > 3200) { dmErrorMsg("Invalid width or height: %d x %d\n", w, h); - return FALSE; + return false; } optScrWidth = w; optScrHeight = h; @@ -70,21 +70,21 @@ else { dmErrorMsg("Invalid size argument '%s'.\n", optArg); - return FALSE; + return false; } } break; case 7: - optBenchmark = TRUE; + optBenchmark = true; break; default: dmErrorMsg("Unknown option '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } @@ -110,13 +110,13 @@ r->x, r->y, r->w, r->h); } -BOOL DM_InitializeVideo(SDL_Surface **screen) +bool DM_InitializeVideo(SDL_Surface **screen) { *screen = SDL_SetVideoMode(optScrWidth, optScrHeight, optScrDepth, optVFlags | SDL_RESIZABLE); if (*screen == NULL) { dmErrorMsg("Can't SDL_SetVideoMode(): %s\n", SDL_GetError()); - return FALSE; + return false; } #if 0 @@ -131,7 +131,7 @@ DM_PrintRect(stderr, &((*screen)->clip_rect)); #endif - return TRUE; + return true; } void DM_Random(SDL_Surface *screen, int q) @@ -184,7 +184,7 @@ DMVector vr, vl, va; DMFloat vrayLen, vfactor; int vlen; - BOOL wasHit; + bool wasHit; // Perform shadow occlusion via simplistic raytracing vr.x = i; @@ -203,7 +203,7 @@ dm_vector_copy(&vr, light); vlen = 0; - wasHit = FALSE; + wasHit = false; do { float h; @@ -216,7 +216,7 @@ // Check for hits if (h > vr.z) - wasHit = TRUE; + wasHit = true; else { // Move forwards @@ -286,7 +286,7 @@ SDL_Color fontcol={255,155,155,0}; SDL_Event event; int mouseX, mouseY; - BOOL initSDL = FALSE, initTTF = FALSE, exitFlag, showMap = FALSE; + bool initSDL = false, initTTF = false, exitFlag, showMap = false; dmInitProg("blittest", "dmlib blittest", "0.2", NULL, NULL); if (!dmArgsProcess(argc, argv, optList, optListN, @@ -298,7 +298,7 @@ dmErrorMsg("Could not initialize SDL: %s\n", SDL_GetError()); goto error_exit; } - initSDL = TRUE; + initSDL = true; if (TTF_Init() < 0) @@ -306,7 +306,7 @@ dmErrorMsg("Could not initialize FreeType/TTF: %s\n", SDL_GetError()); goto error_exit; } - initTTF = TRUE; + initTTF = true; font = TTF_OpenFont(optFontFile, optFontSize); if (font == NULL) @@ -351,7 +351,7 @@ int numFrames = 0, startTime = SDL_GetTicks(), endTime = 0; - exitFlag = FALSE; + exitFlag = false; if (optBenchmark) dmMsg(0, "Starting benchmark, running for %d seconds.\n", optBenchmarkLen); @@ -367,7 +367,7 @@ case SDL_KEYDOWN: switch (event.key.keysym.sym) { - case SDLK_ESCAPE: exitFlag = TRUE; break; + case SDLK_ESCAPE: exitFlag = true; break; case SDLK_F5: showMap = !showMap; @@ -432,7 +432,7 @@ if (optBenchmark) { if (endTime - startTime > optBenchmarkLen * 1000) - exitFlag = TRUE; + exitFlag = true; } }