1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-25 07:29:10 +00:00

Feature: Framerate display window (#6822)

Frame rate and various game loop/graphics timing measurements and graphs. Accessible via the Help menu, and can print some stats in the console via the fps command.
This commit is contained in:
Niels Martin Hansen
2018-07-19 21:17:07 +02:00
committed by Patric Stout
parent a3d1950b65
commit 2a868b9f3b
33 changed files with 1194 additions and 11 deletions

View File

@@ -1895,6 +1895,37 @@ static void IConsoleDebugLibRegister()
}
#endif
DEF_CONSOLE_CMD(ConFramerate)
{
extern void ConPrintFramerate(); // framerate_gui.cpp
if (argc == 0) {
IConsoleHelp("Show frame rate and game speed information");
return true;
}
ConPrintFramerate();
return true;
}
DEF_CONSOLE_CMD(ConFramerateWindow)
{
extern void ShowFramerateWindow();
if (argc == 0) {
IConsoleHelp("Open the frame rate window");
return true;
}
if (_network_dedicated) {
IConsoleError("Can not open frame rate window on a dedicated server");
return false;
}
ShowFramerateWindow();
return true;
}
/*******************************
* console command registration
*******************************/
@@ -2025,6 +2056,8 @@ void IConsoleStdLibRegister()
#ifdef _DEBUG
IConsoleDebugLibRegister();
#endif
IConsoleCmdRegister("fps", ConFramerate);
IConsoleCmdRegister("fps_wnd", ConFramerateWindow);
/* NewGRF development stuff */
IConsoleCmdRegister("reload_newgrfs", ConNewGRFReload, ConHookNewGRFDeveloperTool);