on screen debug
This commit is contained in:
parent
fa54189259
commit
7108f2af7a
4 changed files with 43 additions and 3 deletions
19
src/render.c
19
src/render.c
|
@ -418,13 +418,26 @@ DWORD WINAPI render_main(void)
|
|||
#if _DEBUG
|
||||
static DWORD tick_fps = 0;
|
||||
static DWORD frame_count = 0;
|
||||
static char debugText[512] = { 0 };
|
||||
static double frameTime = 0;
|
||||
RECT debugrc = { 0, 0, ddraw->width, ddraw->height };
|
||||
tick_start = timeGetTime();
|
||||
if (tick_start >= tick_fps)
|
||||
{
|
||||
printf("Frames: %lu - Elapsed: %lu ms\n", frame_count, (tick_start - tick_fps) + 1000);
|
||||
snprintf(
|
||||
debugText, sizeof(debugText),
|
||||
"FPS: %lu | Time: %2.2f ms",
|
||||
frame_count, frameTime);
|
||||
|
||||
frame_count = 0;
|
||||
tick_fps = tick_start + 1000;
|
||||
|
||||
CounterStart();
|
||||
}
|
||||
|
||||
if (ddraw->primary && ddraw->primary->palette)
|
||||
DrawText(ddraw->primary->hDC, debugText, -1, &debugrc, DT_NOCLIP);
|
||||
|
||||
frame_count++;
|
||||
#endif
|
||||
|
||||
|
@ -595,6 +608,10 @@ DWORD WINAPI render_main(void)
|
|||
|
||||
SwapBuffers(ddraw->render.hDC);
|
||||
|
||||
#if _DEBUG
|
||||
if (frame_count == 1) frameTime = CounterStop();
|
||||
#endif
|
||||
|
||||
if (maxfps > 0)
|
||||
{
|
||||
tick_end = timeGetTime();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue