diff options
Diffstat (limited to 'src/demo.c')
-rw-r--r-- | src/demo.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -27,6 +27,7 @@ #define DEMO() \ do { \ + start = SDL_GetTicks(); \ vp->x = x + map->tilewidth / 2 - vp->w / 2; \ vp->y = y + map->tileheight / 2 - vp->h / 2; \ /* \ @@ -75,8 +76,10 @@ } \ render_area_to_viewport(a, vp); \ SDL_Flip(vp->screen); \ - SDL_Delay(10); \ ++i; \ + end = SDL_GetTicks(); \ + total += end - start; \ + SDL_Delay(10); \ } while (0) void @@ -116,7 +119,7 @@ demo(void) /* Demo */ { - Uint32 start, end; + Uint32 total, start, end; int i, i_max, t_max; int x, y; SDL_Palette *pal_start, *pal_end; @@ -127,7 +130,7 @@ demo(void) i = 0; i_max = 1440; - start = SDL_GetTicks(); + total = 0; x = 9 * map->tilewidth ; y = 58 * map->tileheight; for (; y > 50 * map->tileheight; y -= 1) DEMO(); /* Up */ @@ -145,7 +148,6 @@ demo(void) for (; y > 5 * map->tileheight; y -= 1) DEMO(); /* Up */ for (; x < 17 * map->tilewidth ; x += 1) DEMO(); /* Right */ for (; y > 1 * map->tileheight; y -= 1) DEMO(); /* Up */ - end = SDL_GetTicks(); - debug("Rendered %d frames in %d milliseconds", i, end - start); + debug("Rendered %d frames in %d milliseconds", i, total); } } |