summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2023-02-23 17:04:01 (EST)
committer P. J. McDermott <pj@pehjota.net>2023-02-23 17:04:01 (EST)
commitbfe96dd587b1133220e24f123f500379db1bef8b (patch)
tree2a33b1188fb1940cf24dbe1210724fc1cdafe96c
parentd6bb55fcf1fde4ed17f95cacd6021d765a4d3cfb (diff)
downloadoverworld-rpg-bfe96dd587b1133220e24f123f500379db1bef8b.zip
overworld-rpg-bfe96dd587b1133220e24f123f500379db1bef8b.tar.gz
overworld-rpg-bfe96dd587b1133220e24f123f500379db1bef8b.tar.bz2
demo: Exclude delay time from benchmark
-rw-r--r--src/demo.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/demo.c b/src/demo.c
index 24ebfc5..6ee46b0 100644
--- a/src/demo.c
+++ b/src/demo.c
@@ -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);
}
}