From 5b95289440ab2285bebb4ab88b4dc1f21abdd56c Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 22 Oct 2019 21:06:55 +0200 Subject: [PATCH] Render FPS count using ingame font --- Source/scrollrt.cpp | 15 ++++++++------- SourceS/miniwin/misc.h | 2 -- SourceS/miniwin/misc_macro.h | 2 -- SourceX/miniwin/misc_dx.cpp | 14 -------------- 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 886b6e1c1..15373b6dd 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -951,7 +951,7 @@ static void DrawFPS() char String[12]; HDC hdc; - if (frameflag && gbActive) { + if (frameflag && gbActive && pPanelText) { frameend++; tc = GetTickCount(); frames = tc - framestart; @@ -962,8 +962,8 @@ static void DrawFPS() } if (framerate > 99) framerate = 99; - wsprintf(String, "%2d", framerate); - TextOut(hdc, 0, 400, String, strlen(String)); + wsprintf(String, "%2d FPS", framerate); + PrintGameStr(8, 65, String, COL_RED); } } #endif @@ -1029,10 +1029,6 @@ static void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BO DoBlitScreen(sgdwCursX, sgdwCursY, sgdwCursWdt, sgdwCursHgt); } } - -#ifdef _DEBUG - DrawFPS(); -#endif } void scrollrt_draw_game_screen(BOOL draw_cursor) @@ -1108,6 +1104,11 @@ void DrawAndBlit() hgt = SCREEN_HEIGHT; } scrollrt_draw_cursor_item(); + +#ifdef _DEBUG + DrawFPS(); +#endif + unlock_buf(0); DrawMain(hgt, ddsdesc, drawhpflag, drawmanaflag, drawsbarflag, drawbtnflag); diff --git a/SourceS/miniwin/misc.h b/SourceS/miniwin/misc.h index cf1f25d1f..7710dd048 100644 --- a/SourceS/miniwin/misc.h +++ b/SourceS/miniwin/misc.h @@ -212,8 +212,6 @@ DWORD WINAPI GetCurrentThreadId(); WINBOOL WINAPI SetThreadPriority(HANDLE hThread, int nPriority); void WINAPI Sleep(DWORD dwMilliseconds); -WINBOOL WINAPI TextOutA(HDC hdc, int x, int y, LPCSTR lpString, int c); - int WINAPIV wsprintfA(LPSTR, LPCSTR, ...); int WINAPIV wvsprintfA(LPSTR dest, LPCSTR format, va_list arglist); int __cdecl _strcmpi(const char *_Str1, const char *_Str2); diff --git a/SourceS/miniwin/misc_macro.h b/SourceS/miniwin/misc_macro.h index 573fdf3da..f03878da9 100644 --- a/SourceS/miniwin/misc_macro.h +++ b/SourceS/miniwin/misc_macro.h @@ -29,8 +29,6 @@ #define THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX #define THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST - 1) -#define TextOut TextOutA - #define NUMRESERVED 106 #define _snprintf snprintf diff --git a/SourceX/miniwin/misc_dx.cpp b/SourceX/miniwin/misc_dx.cpp index c25948bac..82c9fe940 100644 --- a/SourceX/miniwin/misc_dx.cpp +++ b/SourceX/miniwin/misc_dx.cpp @@ -27,18 +27,4 @@ WINBOOL SetCursorPos(int X, int Y) return true; } -WINBOOL TextOutA(HDC hdc, int x, int y, LPCSTR lpString, int c) -{ - DUMMY_ONCE(); - - assert(window); -#ifdef USE_SDL1 - SDL_WM_SetCaption(lpString, WINDOW_ICON_NAME); -#else - SDL_SetWindowTitle(window, lpString); -#endif - - return true; -} - } // namespace dvl