diff options
-rw-r--r-- | projects/openttd_vs100.vcxproj | 1 | ||||
-rw-r--r-- | projects/openttd_vs100.vcxproj.filters | 3 | ||||
-rw-r--r-- | projects/openttd_vs140.vcxproj | 1 | ||||
-rw-r--r-- | projects/openttd_vs140.vcxproj.filters | 3 | ||||
-rw-r--r-- | projects/openttd_vs141.vcxproj | 1 | ||||
-rw-r--r-- | projects/openttd_vs141.vcxproj.filters | 3 | ||||
-rw-r--r-- | projects/openttd_vs80.vcproj | 4 | ||||
-rw-r--r-- | projects/openttd_vs90.vcproj | 4 | ||||
-rw-r--r-- | source.list | 1 | ||||
-rw-r--r-- | src/framerate_gui.cpp | 18 | ||||
-rw-r--r-- | src/script/api/game/game_window.hpp.sq | 12 | ||||
-rw-r--r-- | src/script/api/script_window.hpp | 32 | ||||
-rw-r--r-- | src/script/api/template/template_window.hpp.sq | 4 | ||||
-rw-r--r-- | src/widgets/framerate_widget.h | 33 | ||||
-rw-r--r-- | src/window_type.h | 2 |
15 files changed, 105 insertions, 17 deletions
diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj index 6fbd5e3f0..e400081df 100644 --- a/projects/openttd_vs100.vcxproj +++ b/projects/openttd_vs100.vcxproj @@ -794,6 +794,7 @@ <ClInclude Include="..\src\widgets\engine_widget.h" /> <ClInclude Include="..\src\widgets\error_widget.h" /> <ClInclude Include="..\src\widgets\fios_widget.h" /> + <ClInclude Include="..\src\widgets\framerate_widget.h" /> <ClInclude Include="..\src\widgets\genworld_widget.h" /> <ClInclude Include="..\src\widgets\goal_widget.h" /> <ClInclude Include="..\src\widgets\graph_widget.h" /> diff --git a/projects/openttd_vs100.vcxproj.filters b/projects/openttd_vs100.vcxproj.filters index 7eee89731..47f431e55 100644 --- a/projects/openttd_vs100.vcxproj.filters +++ b/projects/openttd_vs100.vcxproj.filters @@ -1539,6 +1539,9 @@ <ClInclude Include="..\src\widgets\fios_widget.h"> <Filter>Widgets</Filter> </ClInclude> + <ClInclude Include="..\src\widgets\framerate_widget.h"> + <Filter>Widgets</Filter> + </ClInclude> <ClInclude Include="..\src\widgets\genworld_widget.h"> <Filter>Widgets</Filter> </ClInclude> diff --git a/projects/openttd_vs140.vcxproj b/projects/openttd_vs140.vcxproj index fdc1fd411..9fac7685a 100644 --- a/projects/openttd_vs140.vcxproj +++ b/projects/openttd_vs140.vcxproj @@ -815,6 +815,7 @@ <ClInclude Include="..\src\widgets\engine_widget.h" /> <ClInclude Include="..\src\widgets\error_widget.h" /> <ClInclude Include="..\src\widgets\fios_widget.h" /> + <ClInclude Include="..\src\widgets\framerate_widget.h" /> <ClInclude Include="..\src\widgets\genworld_widget.h" /> <ClInclude Include="..\src\widgets\goal_widget.h" /> <ClInclude Include="..\src\widgets\graph_widget.h" /> diff --git a/projects/openttd_vs140.vcxproj.filters b/projects/openttd_vs140.vcxproj.filters index 7eee89731..47f431e55 100644 --- a/projects/openttd_vs140.vcxproj.filters +++ b/projects/openttd_vs140.vcxproj.filters @@ -1539,6 +1539,9 @@ <ClInclude Include="..\src\widgets\fios_widget.h"> <Filter>Widgets</Filter> </ClInclude> + <ClInclude Include="..\src\widgets\framerate_widget.h"> + <Filter>Widgets</Filter> + </ClInclude> <ClInclude Include="..\src\widgets\genworld_widget.h"> <Filter>Widgets</Filter> </ClInclude> diff --git a/projects/openttd_vs141.vcxproj b/projects/openttd_vs141.vcxproj index 0b450cbfd..ae3d7be78 100644 --- a/projects/openttd_vs141.vcxproj +++ b/projects/openttd_vs141.vcxproj @@ -815,6 +815,7 @@ <ClInclude Include="..\src\widgets\engine_widget.h" /> <ClInclude Include="..\src\widgets\error_widget.h" /> <ClInclude Include="..\src\widgets\fios_widget.h" /> + <ClInclude Include="..\src\widgets\framerate_widget.h" /> <ClInclude Include="..\src\widgets\genworld_widget.h" /> <ClInclude Include="..\src\widgets\goal_widget.h" /> <ClInclude Include="..\src\widgets\graph_widget.h" /> diff --git a/projects/openttd_vs141.vcxproj.filters b/projects/openttd_vs141.vcxproj.filters index 7eee89731..47f431e55 100644 --- a/projects/openttd_vs141.vcxproj.filters +++ b/projects/openttd_vs141.vcxproj.filters @@ -1539,6 +1539,9 @@ <ClInclude Include="..\src\widgets\fios_widget.h"> <Filter>Widgets</Filter> </ClInclude> + <ClInclude Include="..\src\widgets\framerate_widget.h"> + <Filter>Widgets</Filter> + </ClInclude> <ClInclude Include="..\src\widgets\genworld_widget.h"> <Filter>Widgets</Filter> </ClInclude> diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj index 2ea6fdcd6..c5e41e925 100644 --- a/projects/openttd_vs80.vcproj +++ b/projects/openttd_vs80.vcproj @@ -2375,6 +2375,10 @@ > </File> <File + RelativePath=".\..\src\widgets\framerate_widget.h" + > + </File> + <File RelativePath=".\..\src\widgets\genworld_widget.h" > </File> diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj index 174677586..d2e5744a2 100644 --- a/projects/openttd_vs90.vcproj +++ b/projects/openttd_vs90.vcproj @@ -2372,6 +2372,10 @@ > </File> <File + RelativePath=".\..\src\widgets\framerate_widget.h" + > + </File> + <File RelativePath=".\..\src\widgets\genworld_widget.h" > </File> diff --git a/source.list b/source.list index ee8e69ef5..5dec0e861 100644 --- a/source.list +++ b/source.list @@ -527,6 +527,7 @@ widgets/dropdown_widget.h widgets/engine_widget.h widgets/error_widget.h widgets/fios_widget.h +widgets/framerate_widget.h widgets/genworld_widget.h widgets/goal_widget.h widgets/graph_widget.h diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index 0d6cc55c5..021958d32 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -19,6 +19,8 @@ #include "console_func.h" #include "console_type.h" +#include "widgets/framerate_widget.h" + namespace { @@ -233,17 +235,6 @@ void PerformanceAccumulator::Reset(PerformanceElement elem) void ShowFrametimeGraphWindow(PerformanceElement elem); -enum FramerateWindowWidgets { - WID_FRW_CAPTION, - WID_FRW_RATE_GAMELOOP, - WID_FRW_RATE_DRAWING, - WID_FRW_RATE_FACTOR, - WID_FRW_INFO_DATA_POINTS, - WID_FRW_TIMES_NAMES, - WID_FRW_TIMES_CURRENT, - WID_FRW_TIMES_AVERAGE, -}; - static const NWidgetPart _framerate_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), @@ -487,11 +478,6 @@ static WindowDesc _framerate_display_desc( ); -enum FrametimeGraphWindowWidgets { - WID_FGW_CAPTION, - WID_FGW_GRAPH, -}; - static const NWidgetPart _frametime_graph_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), diff --git a/src/script/api/game/game_window.hpp.sq b/src/script/api/game/game_window.hpp.sq index aa0b34b1e..7ce2c7029 100644 --- a/src/script/api/game/game_window.hpp.sq +++ b/src/script/api/game/game_window.hpp.sq @@ -138,6 +138,8 @@ void SQGSWindow_Register(Squirrel *engine) SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SPRITE_ALIGNER, "WC_SPRITE_ALIGNER"); SQGSWindow.DefSQConst(engine, ScriptWindow::WC_LINKGRAPH_LEGEND, "WC_LINKGRAPH_LEGEND"); SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SAVE_PRESET, "WC_SAVE_PRESET"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WC_FRAMERATE_DISPLAY, "WC_FRAMERATE_DISPLAY"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WC_FRAMETIME_GRAPH, "WC_FRAMETIME_GRAPH"); SQGSWindow.DefSQConst(engine, ScriptWindow::WC_INVALID, "WC_INVALID"); SQGSWindow.DefSQConst(engine, ScriptWindow::TC_BLUE, "TC_BLUE"); SQGSWindow.DefSQConst(engine, ScriptWindow::TC_SILVER, "TC_SILVER"); @@ -450,6 +452,16 @@ void SQGSWindow_Register(Squirrel *engine) SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_NEWGRF_INFO, "WID_SL_NEWGRF_INFO"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_LOAD_BUTTON, "WID_SL_LOAD_BUTTON"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_MISSING_NEWGRFS, "WID_SL_MISSING_NEWGRFS"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FRW_CAPTION, "WID_FRW_CAPTION"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FRW_RATE_GAMELOOP, "WID_FRW_RATE_GAMELOOP"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FRW_RATE_DRAWING, "WID_FRW_RATE_DRAWING"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FRW_RATE_FACTOR, "WID_FRW_RATE_FACTOR"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FRW_INFO_DATA_POINTS, "WID_FRW_INFO_DATA_POINTS"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FRW_TIMES_NAMES, "WID_FRW_TIMES_NAMES"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FRW_TIMES_CURRENT, "WID_FRW_TIMES_CURRENT"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FRW_TIMES_AVERAGE, "WID_FRW_TIMES_AVERAGE"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FGW_CAPTION, "WID_FGW_CAPTION"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_FGW_GRAPH, "WID_FGW_GRAPH"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_TEMPERATE, "WID_GL_TEMPERATE"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_ARCTIC, "WID_GL_ARCTIC"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_TROPICAL, "WID_GL_TROPICAL"); diff --git a/src/script/api/script_window.hpp b/src/script/api/script_window.hpp index c2b6662fb..9dcf58e05 100644 --- a/src/script/api/script_window.hpp +++ b/src/script/api/script_window.hpp @@ -32,6 +32,7 @@ #include "../../widgets/engine_widget.h" #include "../../widgets/error_widget.h" #include "../../widgets/fios_widget.h" +#include "../../widgets/framerate_widget.h" #include "../../widgets/genworld_widget.h" #include "../../widgets/goal_widget.h" #include "../../widgets/graph_widget.h" @@ -764,6 +765,18 @@ public: */ WC_SAVE_PRESET = ::WC_SAVE_PRESET, + /** + * Framerate display; %Window numbers: + * - 0 = #FramerateDisplayWidgets + */ + WC_FRAMERATE_DISPLAY = ::WC_FRAMERATE_DISPLAY, + + /** + * Frame time graph; %Window numbers: + * - 0 = #FrametimeGraphWindowWidgets + */ + WC_FRAMETIME_GRAPH = ::WC_FRAMETIME_GRAPH, + WC_INVALID = ::WC_INVALID, ///< Invalid window. }; @@ -1275,6 +1288,25 @@ public: WID_SL_MISSING_NEWGRFS = ::WID_SL_MISSING_NEWGRFS, ///< Button to find missing NewGRFs online. }; + /* automatically generated from ../../widgets/framerate_widget.h */ + /** Widgets of the #FramerateWindow class. */ + enum FramerateWindowWidgets { + WID_FRW_CAPTION = ::WID_FRW_CAPTION, + WID_FRW_RATE_GAMELOOP = ::WID_FRW_RATE_GAMELOOP, + WID_FRW_RATE_DRAWING = ::WID_FRW_RATE_DRAWING, + WID_FRW_RATE_FACTOR = ::WID_FRW_RATE_FACTOR, + WID_FRW_INFO_DATA_POINTS = ::WID_FRW_INFO_DATA_POINTS, + WID_FRW_TIMES_NAMES = ::WID_FRW_TIMES_NAMES, + WID_FRW_TIMES_CURRENT = ::WID_FRW_TIMES_CURRENT, + WID_FRW_TIMES_AVERAGE = ::WID_FRW_TIMES_AVERAGE, + }; + + /** Widgets of the #FrametimeGraphWindow class. */ + enum FrametimeGraphWindowWidgets { + WID_FGW_CAPTION = ::WID_FGW_CAPTION, + WID_FGW_GRAPH = ::WID_FGW_GRAPH, + }; + /* automatically generated from ../../widgets/genworld_widget.h */ /** Widgets of the #GenerateLandscapeWindow class. */ enum GenerateLandscapeWidgets { diff --git a/src/script/api/template/template_window.hpp.sq b/src/script/api/template/template_window.hpp.sq index a21a75ab8..3077215ec 100644 --- a/src/script/api/template/template_window.hpp.sq +++ b/src/script/api/template/template_window.hpp.sq @@ -77,6 +77,10 @@ namespace SQConvert { template <> inline int Return<ScriptWindow::ErrorMessageWidgets>(HSQUIRRELVM vm, ScriptWindow::ErrorMessageWidgets res) { sq_pushinteger(vm, (int32)res); return 1; } template <> inline ScriptWindow::SaveLoadWidgets GetParam(ForceType<ScriptWindow::SaveLoadWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::SaveLoadWidgets)tmp; } template <> inline int Return<ScriptWindow::SaveLoadWidgets>(HSQUIRRELVM vm, ScriptWindow::SaveLoadWidgets res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptWindow::FramerateWindowWidgets GetParam(ForceType<ScriptWindow::FramerateWindowWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::FramerateWindowWidgets)tmp; } + template <> inline int Return<ScriptWindow::FramerateWindowWidgets>(HSQUIRRELVM vm, ScriptWindow::FramerateWindowWidgets res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptWindow::FrametimeGraphWindowWidgets GetParam(ForceType<ScriptWindow::FrametimeGraphWindowWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::FrametimeGraphWindowWidgets)tmp; } + template <> inline int Return<ScriptWindow::FrametimeGraphWindowWidgets>(HSQUIRRELVM vm, ScriptWindow::FrametimeGraphWindowWidgets res) { sq_pushinteger(vm, (int32)res); return 1; } template <> inline ScriptWindow::GenerateLandscapeWidgets GetParam(ForceType<ScriptWindow::GenerateLandscapeWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::GenerateLandscapeWidgets)tmp; } template <> inline int Return<ScriptWindow::GenerateLandscapeWidgets>(HSQUIRRELVM vm, ScriptWindow::GenerateLandscapeWidgets res) { sq_pushinteger(vm, (int32)res); return 1; } template <> inline ScriptWindow::CreateScenarioWidgets GetParam(ForceType<ScriptWindow::CreateScenarioWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::CreateScenarioWidgets)tmp; } diff --git a/src/widgets/framerate_widget.h b/src/widgets/framerate_widget.h new file mode 100644 index 000000000..388599537 --- /dev/null +++ b/src/widgets/framerate_widget.h @@ -0,0 +1,33 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. + */ + +/** @file framerate_widget.h Types related to the framerate windows widgets. */ + +#ifndef WIDGETS_FRAMERATE_WIDGET_H +#define WIDGETS_FRAMERATE_WIDGET_H + +/** Widgets of the #FramerateWindow class. */ +enum FramerateWindowWidgets { + WID_FRW_CAPTION, + WID_FRW_RATE_GAMELOOP, + WID_FRW_RATE_DRAWING, + WID_FRW_RATE_FACTOR, + WID_FRW_INFO_DATA_POINTS, + WID_FRW_TIMES_NAMES, + WID_FRW_TIMES_CURRENT, + WID_FRW_TIMES_AVERAGE, +}; + +/** Widgets of the #FrametimeGraphWindow class. */ +enum FrametimeGraphWindowWidgets { + WID_FGW_CAPTION, + WID_FGW_GRAPH, +}; + +#endif /* WIDGETS_FRAMERATE_WIDGET_H */ diff --git a/src/window_type.h b/src/window_type.h index c90ef51b6..7185bfcb4 100644 --- a/src/window_type.h +++ b/src/window_type.h @@ -689,7 +689,7 @@ enum WindowClass { /** * Frame time graph; %Window numbers: - * - 0 = #FramerateDisplayWidgets + * - 0 = #FrametimeGraphWindowWidgets */ WC_FRAMETIME_GRAPH, |