mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
on screen debug
This commit is contained in:
parent
fa54189259
commit
7108f2af7a
2
ddraw.rc
2
ddraw.rc
@ -2,7 +2,7 @@
|
||||
#define vxstr(a,b,c,d) str(a##.##b##.##c##.##d)
|
||||
#define str(s) #s
|
||||
|
||||
#define VERSION 1,1,7,1
|
||||
#define VERSION 1,1,7,3
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION VERSION
|
||||
|
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();
|
||||
|
@ -87,13 +87,26 @@ DWORD WINAPI render_soft_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
|
||||
|
||||
@ -164,6 +177,10 @@ DWORD WINAPI render_soft_main(void)
|
||||
|
||||
LeaveCriticalSection(&ddraw->cs);
|
||||
|
||||
#if _DEBUG
|
||||
if (frame_count == 1) frameTime = CounterStop();
|
||||
#endif
|
||||
|
||||
if(maxfps > 0)
|
||||
{
|
||||
tick_end = timeGetTime();
|
||||
|
@ -508,6 +508,12 @@ HRESULT __stdcall ddraw_CreateSurface(IDirectDrawImpl *This, LPDDSURFACEDESC lpD
|
||||
Surface->bmi->bmiColors[i].rgbReserved = 0;
|
||||
}
|
||||
|
||||
#if _DEBUG
|
||||
Surface->bmi->bmiColors[255].rgbRed = 250;
|
||||
Surface->bmi->bmiColors[255].rgbGreen = 250;
|
||||
Surface->bmi->bmiColors[255].rgbBlue = 250;
|
||||
#endif
|
||||
|
||||
Surface->lXPitch = Surface->bpp / 8;
|
||||
Surface->lPitch = Surface->width * Surface->lXPitch;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user