Fix 2a868b9f3b: Expose widgets and windows to scripts and fix documentation.

This commit is contained in:
J0an Josep
2018-07-23 14:39:13 +02:00
committed by Michael Lutz
parent 0bca1c53c9
commit 8975318286
15 changed files with 105 additions and 17 deletions

View File

@@ -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");

View File

@@ -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 {

View File

@@ -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; }