better timers
This commit is contained in:
parent
1567cf0d15
commit
f182582d7b
15
maze.c
15
maze.c
@ -13,7 +13,7 @@
|
||||
// Performance options
|
||||
#define DOLIGHTING
|
||||
// #define FASTTRIS
|
||||
#define DITHERSTART 1
|
||||
#define DITHERSTART -1
|
||||
#define DITHEREND 8
|
||||
#define TARGETFPS 60
|
||||
#define SECPERFRAME 1.0 / TARGETFPS
|
||||
@ -49,8 +49,9 @@ int main() { // int argc, char **argv) {
|
||||
#endif
|
||||
eprintf("Initialized renderer\n");
|
||||
|
||||
haloo3d_easytimer frametimer;
|
||||
haloo3d_easytimer frametimer, sdltimer;
|
||||
haloo3d_easytimer_init(&frametimer, AVGWEIGHT);
|
||||
haloo3d_easytimer_init(&sdltimer, AVGWEIGHT);
|
||||
|
||||
// Load the junk + generate stuff
|
||||
haloo3d_obj *flooro = haloo3d_easystore_addobj(&storage, "floor");
|
||||
@ -130,15 +131,21 @@ int main() { // int argc, char **argv) {
|
||||
}
|
||||
|
||||
haloo3d_print(&render.tprint,
|
||||
"Last frame: %05.2f (%05.2f)\nTris: %d / %d\nVerts: %d\n",
|
||||
frametimer.last * 1000, frametimer.sum * 1000, totaldrawn,
|
||||
"Last frame: %05.2f (%05.2f)\nLast SDLFl: %05.2f "
|
||||
"(%05.2f)\nTris: %d / %d\nVerts: %d\n",
|
||||
frametimer.last * 1000, frametimer.sum * 1000,
|
||||
sdltimer.last * 1000, sdltimer.sum * 1000, totaldrawn,
|
||||
render.totalfaces, render.totalverts);
|
||||
|
||||
unigi_graphics_blit(0, (unigi_type_color *)render.window.buffer,
|
||||
res.width * res.height);
|
||||
|
||||
haloo3d_easytimer_start(&sdltimer);
|
||||
unigi_graphics_flush();
|
||||
haloo3d_easytimer_end(&sdltimer);
|
||||
|
||||
haloo3d_easytimer_end(&frametimer);
|
||||
|
||||
float waittime = SECPERFRAME - frametimer.last;
|
||||
if (waittime > 0) {
|
||||
unigi_time_sleep(waittime * unigi_time_clocks_per_s);
|
||||
|
Loading…
Reference in New Issue
Block a user