25#include "slider_func.h"
58#include "table/strings.h"
65#if defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA)
66# define HAS_TRUETYPE_FONT
69static const StringID _autosave_dropdown[] = {
70 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF,
71 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_10_MINUTES,
72 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_30_MINUTES,
73 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_60_MINUTES,
74 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_120_MINUTES,
108 this->ConstructWindow();
115 return GetString(stringid, this->content_type, this->name);
128template <
class TBaseSet>
132 new BaseSetTextfileWindow(parent, file_type, baseset->name, *baseset->GetTextfile(file_type), content_type);
141template <
typename TBaseSet>
144 if (baseset->GetNumInvalid() == 0)
return GetString(STR_JUST_RAW_STRING, baseset->name);
145 return GetString(STR_BASESET_STATUS, baseset->name, baseset->GetNumInvalid());
151 int n = T::GetNumSets();
152 *selected_index = T::GetIndexOfUsedSet();
154 for (
int i = 0; i < n; i++) {
155 list.push_back(MakeDropDownListStringItem(
GetListLabel(T::GetSet(i)), i));
160std::set<int> _refresh_rates = { 30, 60, 75, 90, 100, 120, 144, 240 };
173 std::copy(monitor_rates.begin(), monitor_rates.end(), std::inserter(_refresh_rates, _refresh_rates.end()));
176static const int SCALE_NMARKS = (MAX_INTERFACE_SCALE - MIN_INTERFACE_SCALE) / 25 + 1;
177static const int VOLUME_NMARKS = 9;
179static std::optional<std::string> ScaleMarkFunc(
int,
int,
int value)
182 if (value % 100 != 0)
return std::string{};
184 return GetString(STR_GAME_OPTIONS_GUI_SCALE_MARK, value / 100, 0);
187static std::optional<std::string> VolumeMarkFunc(
int,
int mark,
int value)
190 if (mark % 2 != 0)
return std::string{};
193 return GetString(STR_GAME_OPTIONS_VOLUME_MARK, value / 31 * 25);
207static constexpr NWidgetPart _nested_social_plugins_widgets[] = {
222static constexpr NWidgetPart _nested_social_plugins_none_widgets[] = {
234 if (this->plugins.empty()) {
235 auto widget =
MakeNWidgets(_nested_social_plugins_none_widgets,
nullptr);
236 this->
Add(std::move(widget));
238 for (
size_t i = 0; i < this->plugins.size(); i++) {
239 auto widget =
MakeNWidgets(_nested_social_plugins_widgets,
nullptr);
240 this->
Add(std::move(widget));
255 this->current_index = -1;
265 template <
typename T>
268 std::string *longest = &(this->plugins[0]->*member);
269 int longest_length = 0;
271 for (
auto *plugin : this->plugins) {
273 if (length > longest_length) {
274 longest_length = length;
275 longest = &(plugin->*member);
287 if (this->current_index < 0) {
291 if (this->plugins[this->current_index]->name.empty()) {
292 return this->plugins[this->current_index]->basepath;
295 return GetString(STR_GAME_OPTIONS_SOCIAL_PLUGIN_TITLE, this->plugins[this->current_index]->name, this->plugins[this->current_index]->version);
299 if (this->current_index < 0) {
303 return this->plugins[this->current_index]->social_platform;
306 static const std::pair<SocialIntegrationPlugin::State, StringID> state_to_string[] = {
317 if (this->current_index < 0) {
322 int longest_length = 0;
323 for (
const auto &[state,
string] : state_to_string) {
325 if (length > longest_length) {
326 longest_length = length;
331 return GetString(longest, longest_plugin);
334 const auto plugin = this->plugins[this->current_index];
337 for (
const auto &[state,
string] : state_to_string) {
338 if (plugin->state == state) {
339 return GetString(
string, plugin->social_platform);
344 return GetString(STR_GAME_OPTIONS_SOCIAL_PLUGIN_STATE_FAILED, plugin->social_platform);
347 default: NOT_REACHED();
353 this->current_index = 0;
357 this->current_index++;
362 int current_index = -1;
363 std::vector<SocialIntegrationPlugin *> plugins{};
369 return std::make_unique<NWidgetSocialPlugins>();
374static const StringID _game_settings_restrict_dropdown[] = {
375 STR_CONFIG_SETTING_RESTRICT_BASIC,
376 STR_CONFIG_SETTING_RESTRICT_ADVANCED,
377 STR_CONFIG_SETTING_RESTRICT_ALL,
378 STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_DEFAULT,
379 STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_NEW,
381static_assert(
lengthof(_game_settings_restrict_dropdown) ==
RM_END);
422 static constexpr uint NUM_DESCRIPTION_LINES = 5;
446 this->vscroll_description->
SetCapacity(NUM_DESCRIPTION_LINES);
454 this->SetTab(GameOptionsWindow::active_tab);
456 if constexpr (!NetworkSurveyHandler::IsSurveyPossible()) this->GetWidget<NWidgetStacked>(
WID_GO_SURVEY_SEL)->SetDisplayedPlane(
SZSP_NONE);
464 void Close([[maybe_unused]]
int data = 0)
override
464 void Close([[maybe_unused]]
int data = 0)
override {
…}
483 uint64_t disabled = _game_mode == GM_MENU ? 0LL : ~GetMaskOfAllowedCurrencies();
489 if (currency.code.empty()) {
490 list.push_back(MakeDropDownListStringItem(currency.name, i,
HasBit(disabled, i)));
492 list.push_back(MakeDropDownListStringItem(
GetString(STR_GAME_OPTIONS_CURRENCY_CODE, currency.name, currency.code), i,
HasBit(disabled, i)));
498 list.push_back(MakeDropDownListDividerItem());
509 *selected_index = index - 1;
511 const StringID *items = _autosave_dropdown;
513 list.push_back(MakeDropDownListStringItem(*items, i));
519 for (uint i = 0; i <
_languages.size(); i++) {
520 bool hide_language = IsReleasedVersion() && !
_languages[i].IsReasonablyFinished();
521 if (hide_language)
continue;
535 if (hide_percentage) {
536 list.push_back(MakeDropDownListStringItem(std::move(name), i));
538 int percentage = (LANGUAGE_TOTAL_STRINGS -
_languages[i].missing) * 100 / LANGUAGE_TOTAL_STRINGS;
539 list.push_back(MakeDropDownListStringItem(
GetString(STR_GAME_OPTIONS_LANGUAGE_PERCENTAGE, std::move(name), percentage), i));
556 for (
auto it = _refresh_rates.begin(); it != _refresh_rates.end(); it++) {
557 auto i = std::distance(_refresh_rates.begin(), it);
559 list.push_back(MakeDropDownListStringItem(
GetString(STR_GAME_OPTIONS_REFRESH_RATE_ITEM, *it), i));
564 list = BuildSetDropDownList<BaseGraphics>(selected_index);
568 list = BuildSetDropDownList<BaseSounds>(selected_index);
572 list = BuildSetDropDownList<BaseMusic>(selected_index);
576 for (
int mode = 0; mode !=
RM_END; mode++) {
581 list.push_back(MakeDropDownListStringItem(_game_settings_restrict_dropdown[mode], mode, disabled));
586 list.push_back(MakeDropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL,
ST_ALL));
587 list.push_back(MakeDropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME,
ST_GAME));
588 list.push_back(MakeDropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME,
ST_COMPANY));
589 list.push_back(MakeDropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_CLIENT,
ST_CLIENT));
598 return GetString(STR_GAME_OPTIONS_SETTING, stringid, this->
IsWidgetLowered(state_widget) ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
607 return GetString(STR_GAME_OPTIONS_CURRENCY_CODE, currency.name, currency.
code);
616 return GetString(_autosave_dropdown[index - 1]);
628 return GetString(STR_GAME_OPTIONS_RESOLUTION_OTHER);
637 assert(plugin !=
nullptr);
639 return plugin->GetWidgetString(widget, stringid);
647 case ST_GAME:
return GetString(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME);
648 case ST_COMPANY:
return GetString(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME);
650 default:
return GetString(STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL);
719 this->vscroll->GetPosition(), last_row, this->last_clicked);
720 if (next_row == 0)
DrawString(tr, STR_CONFIG_SETTINGS_NONE);
725 if (this->last_clicked !=
nullptr) {
731 case ST_COMPANY: str =
GetString(STR_CONFIG_SETTING_TYPE, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_COMPANY_INGAME);
break;
732 case ST_CLIENT: str =
GetString(STR_CONFIG_SETTING_TYPE, STR_CONFIG_SETTING_TYPE_CLIENT);
break;
733 case ST_GAME: str =
GetString(STR_CONFIG_SETTING_TYPE, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_GAME_MENU : STR_CONFIG_SETTING_TYPE_GAME_INGAME);
break;
734 default: NOT_REACHED();
745 if (this->last_clicked !=
nullptr) {
768 if (this->last_clicked != pe) this->
SetDirty();
769 this->last_clicked = pe;
770 UpdateHelpTextSize();
773 void UpdateHelpTextSize()
783 GameOptionsWindow::active_tab = widget;
792 default: NOT_REACHED();
803 UpdateHelpTextSize();
805 bool changed =
false;
845 d.width += padding.width;
846 d.height += padding.height;
872 static const StringID setting_types[] = {
873 STR_CONFIG_SETTING_TYPE_CLIENT,
874 STR_CONFIG_SETTING_TYPE_COMPANY_MENU, STR_CONFIG_SETTING_TYPE_COMPANY_INGAME,
875 STR_CONFIG_SETTING_TYPE_GAME_MENU, STR_CONFIG_SETTING_TYPE_GAME_INGAME,
877 for (
const auto &setting_type : setting_types) {
905 if (this->closing_dropdown) {
906 this->closing_dropdown =
false;
907 assert(this->valuedropdown_entry !=
nullptr);
909 this->valuedropdown_entry =
nullptr;
916 if (this->warn_missing ==
WHR_NONE) {
921 if (this->warn_lines != new_warn_lines) {
922 this->vscroll->
SetCount(this->vscroll->
GetCount() - this->warn_lines + new_warn_lines);
923 this->warn_lines = new_warn_lines;
929 if (this->warn_missing !=
WHR_NONE) {
962 this->SetTab(widget);
986 ShowSurveyResultTextfileWindow(
this);
991 if (!ToggleFullScreen(!_fullscreen)) {
1037#ifdef HAS_TRUETYPE_FONT
1065 if (
ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE,
_ctrl_pressed ? 0 : SCALE_NMARKS, this->gui_scale)) {
1090 if (used_set ==
nullptr || !used_set->IsConfigurable())
break;
1091 GRFConfig &extra_cfg = used_set->GetOrCreateExtraConfig();
1093 OpenGRFParameterWindow(
true, extra_cfg, _game_mode == GM_MENU);
1094 if (_game_mode == GM_MENU) this->reload =
true;
1101 if (
ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, 0, INT8_MAX, 0, vol)) {
1105 SetEffectVolume(vol);
1157 if (!list.empty()) {
1166 this->manually_changed_folding =
true;
1172 this->manually_changed_folding =
true;
1179 GetEncodedString(STR_CONFIG_SETTING_RESET_ALL_CONFIRMATION_DIALOG_CAPTION),
1189 if (!list.empty()) {
1198 if (!list.empty()) {
1205 OptionsPanelClick(pt);
1210 void OptionsPanelClick(
Point pt)
1213 if (btn == INT32_MAX || btn < this->
warn_lines)
return;
1226 if (clicked_page !=
nullptr) {
1230 this->manually_changed_folding =
true;
1237 assert(pe !=
nullptr);
1246 auto [min_val, max_val] = sd->
GetRange();
1253 if (this->valuedropdown_entry == pe) {
1256 this->closing_dropdown =
false;
1258 this->valuedropdown_entry =
nullptr;
1260 if (this->valuedropdown_entry !=
nullptr) this->valuedropdown_entry->
SetButtons({});
1261 this->closing_dropdown =
false;
1272 if (pt.y >= wi_rect.top && pt.y <= wi_rect.bottom) {
1273 this->valuedropdown_entry = pe;
1277 for (int32_t i = min_val; i <= static_cast<int32_t>(max_val); i++) {
1279 list.push_back(MakeDropDownListStringItem(
GetString(STR_JUST_STRING1, param1, param2), i));
1288 int32_t oldvalue = value;
1297 uint32_t step = (sd->
interval == 0) ? ((max_val - min_val) / 50) : sd->interval;
1298 if (step == 0) step = 1;
1310 assert(
static_cast<int32_t
>(max_val) >= 0);
1311 if (value >
static_cast<int32_t
>(max_val)) value =
static_cast<int32_t
>(max_val);
1313 if (
static_cast<uint32_t
>(value) > max_val) value =
static_cast<int32_t
>(max_val);
1315 if (value < min_val) value = min_val;
1322 if (value != oldvalue) {
1323 if (this->clicked_entry !=
nullptr) {
1324 this->clicked_entry->SetButtons({});
1326 this->clicked_entry = pe;
1333 if (value != oldvalue) {
1340 int64_t value64 = value;
1347 this->valuewindow_entry = pe;
1357 if (this->clicked_entry !=
nullptr) {
1358 this->clicked_entry->SetButtons({});
1359 this->clicked_entry =
nullptr;
1367 if (!str.has_value())
return;
1369 assert(this->valuewindow_entry !=
nullptr);
1373 if (!str->empty()) {
1374 auto llvalue = ParseInteger<int64_t>(*str, 10,
true);
1375 if (!llvalue.has_value())
return;
1380 value = ClampTo<int32_t>(*llvalue);
1421 ClearAllCachedNames();
1444 if (_game_mode == GM_MENU) {
1448 this->reload =
true;
1466 if (!this->manually_changed_folding) {
1485 assert(this->valuedropdown_entry !=
nullptr);
1508 assert(this->valuedropdown_entry !=
nullptr);
1509 this->closing_dropdown =
true;
1519 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
1521 if (!gui_scope)
return;
1534#ifdef HAS_TRUETYPE_FONT
1548 for (
TextfileType tft = TFT_CONTENT_BEGIN; tft < TFT_CONTENT_END; tft++) {
1571 if (this->last_clicked !=
nullptr && !
GetSettingsTree().IsVisible(this->last_clicked)) {
1575 bool all_folded =
true;
1576 bool all_unfolded =
true;
1519 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override {
…}
1596static constexpr NWidgetPart _nested_game_options_widgets[] = {
1604 NWidget(
WWT_TEXTBTN,
GAME_OPTIONS_BUTTON,
WID_GO_TAB_GENERAL),
SetMinimalTextLines(2, 0),
SetStringTip(STR_GAME_OPTIONS_TAB_GENERAL, STR_GAME_OPTIONS_TAB_GENERAL_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1605 NWidget(
WWT_TEXTBTN,
GAME_OPTIONS_BUTTON,
WID_GO_TAB_GRAPHICS),
SetMinimalTextLines(2, 0),
SetStringTip(STR_GAME_OPTIONS_TAB_GRAPHICS, STR_GAME_OPTIONS_TAB_GRAPHICS_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1606 NWidget(
WWT_TEXTBTN,
GAME_OPTIONS_BUTTON,
WID_GO_TAB_SOUND),
SetMinimalTextLines(2, 0),
SetStringTip(STR_GAME_OPTIONS_TAB_SOUND, STR_GAME_OPTIONS_TAB_SOUND_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1607 NWidget(
WWT_TEXTBTN,
GAME_OPTIONS_BUTTON,
WID_GO_TAB_SOCIAL),
SetMinimalTextLines(2, 0),
SetStringTip(STR_GAME_OPTIONS_TAB_SOCIAL, STR_GAME_OPTIONS_TAB_SOCIAL_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1608 NWidget(
WWT_TEXTBTN,
GAME_OPTIONS_BUTTON,
WID_GO_TAB_ADVANCED),
SetMinimalTextLines(2, 0),
SetStringTip(STR_GAME_OPTIONS_TAB_ADVANCED, STR_GAME_OPTIONS_TAB_ADVANCED_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1651 NWidget(
WWT_EMPTY, INVALID_COLOUR,
WID_GO_GUI_SCALE),
SetMinimalTextLines(1, 12 +
WidgetDimensions::unscaled.vsep_normal,
FS_SMALL),
SetFill(1, 0),
SetResize(1, 0),
SetToolTip(STR_GAME_OPTIONS_GUI_SCALE_TOOLTIP),
1661#ifdef HAS_TRUETYPE_FONT
1732 NWidget(
WWT_EMPTY, INVALID_COLOUR,
WID_GO_BASE_SFX_VOLUME),
SetMinimalTextLines(1, 12 +
WidgetDimensions::unscaled.vsep_normal,
FS_SMALL),
SetFill(1, 0),
SetResize(1, 0),
SetToolTip(STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC),
1736 NWidget(
WWT_EMPTY, INVALID_COLOUR,
WID_GO_BASE_MUSIC_VOLUME),
SetMinimalTextLines(1, 12 +
WidgetDimensions::unscaled.vsep_normal,
FS_SMALL),
SetFill(1, 0),
SetResize(1, 0),
SetToolTip(STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC),
1745 NWidget(
WWT_EMPTY, INVALID_COLOUR,
WID_GO_BASE_SFX_DESCRIPTION),
SetMinimalTextLines(1, 0),
SetToolTip(STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1764 NWidget(
WWT_EMPTY, INVALID_COLOUR,
WID_GO_BASE_MUSIC_DESCRIPTION),
SetMinimalTextLines(1, 0),
SetToolTip(STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1838 _nested_game_options_widgets
1857void DrawArrowButtons(
int x,
int y, Colours button_colour, uint8_t state,
bool clickable_left,
bool clickable_right)
1860 Dimension dim = NWidgetScrollbar::GetHorizontalDimension();
1862 Rect lr = {x, y, x + (int)dim.width - 1, y + (
int)dim.height - 1};
1863 Rect rr = {x + (int)dim.width, y, x + (
int)dim.width * 2 - 1, y + (int)dim.height - 1};
1867 DrawSpriteIgnorePadding(SPR_ARROW_LEFT, PAL_NONE, lr,
SA_CENTER);
1868 DrawSpriteIgnorePadding(SPR_ARROW_RIGHT, PAL_NONE, rr,
SA_CENTER);
1872 if (rtl ? !clickable_right : !clickable_left) {
1875 if (rtl ? !clickable_left : !clickable_right) {
1857void DrawArrowButtons(
int x,
int y, Colours button_colour, uint8_t state,
bool clickable_left,
bool clickable_right) {
…}
1889void DrawUpDownButtons(
int x,
int y, Colours button_colour, uint8_t state,
bool clickable_up,
bool clickable_down)
1899 DrawSpriteIgnorePadding(SPR_ARROW_UP, PAL_NONE, ur,
SA_CENTER);
1900 DrawSpriteIgnorePadding(SPR_ARROW_DOWN, PAL_NONE, dr,
SA_CENTER);
1889void DrawUpDownButtons(
int x,
int y, Colours button_colour, uint8_t state,
bool clickable_up,
bool clickable_down) {
…}
1922 DrawSpriteIgnorePadding(SPR_ARROW_DOWN, PAL_NONE, r,
SA_CENTER);
1938void DrawBoolButton(
int x,
int y, Colours button_colour, Colours background,
bool state,
bool clickable)
1938void DrawBoolButton(
int x,
int y, Colours button_colour, Colours background,
bool state,
bool clickable) {
…}
1963 void SetButtonState()
1982 return GetString(STR_CURRENCY_PREVIEW, 10000);
2083 this->query_widget = line;
2084 ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1,
this, afilter, {});
2093 if (!str.has_value())
return;
2095 switch (this->query_widget) {
2098 if (!val.has_value())
return;
2117 if (!str->empty()) {
2119 if (!val.has_value())
return;
2136static constexpr NWidgetPart _nested_cust_currency_widgets[] = {
2172 SetToolTip(STR_CURRENCY_CUSTOM_CURRENCY_PREVIEW_TOOLTIP),
2181 _nested_cust_currency_widgets
void UpdateAllVirtCoords()
Update the viewport coordinates of all signs.
Base functions for all AIs.
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
static bool NatSortFunc(std::unique_ptr< const DropDownListItem > const &first, std::unique_ptr< const DropDownListItem > const &second)
Natural sorting comparator function for DropDownList::sort().
static MusicDriver * GetInstance()
Get the currently active instance of the music driver.
virtual void SetVolume(uint8_t vol)=0
Set the volume, if possible.
std::string social_platform
Social platform this plugin is for.
std::string name
Name of the plugin.
std::string version
Version of the plugin.
@ PLATFORM_NOT_RUNNING
The plugin failed to initialize because the Social Platform is not running.
@ UNSUPPORTED_API
The plugin does not support the current API version.
@ RUNNING
The plugin is successfully loaded and running.
@ FAILED
The plugin failed to initialize.
@ DUPLICATE
Another plugin of the same Social Platform is already loaded.
@ INVALID_SIGNATURE
The signature of the plugin is invalid.
@ UNLOADED
The plugin is unloaded upon request.
static std::vector< SocialIntegrationPlugin * > GetPlugins()
Get the list of loaded social integration plugins.
static constexpr TimerGame< struct Calendar >::Year MAX_YEAR
MAX_YEAR, nicely rounded value of the number of years that can be encoded in a single 32 bits date,...
virtual void ToggleVsync(bool vsync)
Change the vsync setting.
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
virtual std::vector< int > GetListOfMonitorRefreshRates()
Get a list of refresh rates of each available monitor.
Functions related to commands.
Definition of stuff that is very close to a company, like the company struct itself.
Functions related to companies.
Configuration options of the network stuff.
static const std::string NETWORK_SURVEY_DETAILS_LINK
Link with more details & privacy statement of the survey.
std::array< CurrencySpec, CURRENCY_END > _currency_specs
Array of currencies used by the system.
Functions to handle different currencies.
static constexpr TimerGameCalendar::Year MIN_EURO_YEAR
The earliest year custom currencies may switch to the Euro.
@ CURRENCY_CUSTOM
Custom currency.
CurrencySpec & GetCustomCurrency()
Get the custom currency.
static constexpr TimerGameCalendar::Year CF_NOEURO
Currency never switches to the Euro (as far as known).
const CurrencySpec & GetCurrency()
Get the currently selected currency.
std::vector< Dimension > _resolutions
List of resolutions.
void ShowDropDownList(Window *w, DropDownList &&list, int selected, WidgetID button, uint width, bool instant_close, bool persist)
Show a drop down list.
Dimension GetDropDownListDimension(const DropDownList &list)
Determine width and height required to fully display a DropDownList.
void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, WidgetID button, Rect wi_rect, Colours wi_colour, bool instant_close, bool persist)
Show a drop down list.
Common drop down list components.
Functions related to the drop down widget.
Types related to the drop down widget.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
Functions related to errors.
@ WL_ERROR
Errors (eg. saving/loading failed)
@ WL_INFO
Used for DoCommand-like (and some non-fatal AI GUI) errors/information.
void ShowErrorMessage(EncodedString &&summary_msg, int x, int y, CommandCost &cc)
Display an error message in a window.
Factory to 'query' all available blitters.
@ BASESET_DIR
Subdirectory for all base data (base sets, intro game)
void InitFontCache(bool monospace)
(Re)initialize the font cache related things, i.e.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Functions to read fonts from files and cache them.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
int GetStringHeight(std::string_view str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
int GetStringLineCount(std::string_view str, int maxw)
Calculates number of lines of string.
bool _left_button_down
Is left mouse button pressed?
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
int DrawString(int left, int right, int top, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
bool _ctrl_pressed
Is Ctrl pressed?
bool _left_button_clicked
Is left mouse button clicked?
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
int _gui_scale_cfg
GUI scale in config.
bool DrawStringMultiLineWithClipping(int left, int right, int top, int bottom, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw a multiline string, possibly over multiple lines, if the region is within the current display cl...
int DrawStringMultiLine(int left, int right, int top, int bottom, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
SwitchMode _switch_mode
The next mainloop command.
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
bool AdjustGUIZoom(bool automatic)
Resolve GUI zoom level and adjust GUI to new zoom, if auto-suggestion is requested.
int _gui_scale
GUI scale, 100 is 100%.
void CheckBlitter()
Check whether we still use the right blitter, or use another (better) one.
@ FS_SMALL
Index of the small font in the font tables.
@ FS_NORMAL
Index of the normal font in the font tables.
@ SA_RIGHT
Right align the text (must be a single bit).
@ SA_CENTER
Center both horizontally and vertically.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
@ FILLRECT_CHECKER
Draw only every second pixel, used for greying-out.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
GUI functions that shouldn't be here.
Declaration of functions and types defined in highscore.h and highscore_gui.h.
Information about languages and their files.
LanguageList _languages
The actual list of language meta data.
const LanguageMetadata * _current_language
The currently loaded language.
bool ReadLanguagePack(const LanguageMetadata *lang)
Read a particular language.
constexpr uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
void ShowQuery(EncodedString &&caption, EncodedString &&message, Window *parent, QueryCallbackProc *callback, bool focus)
Show a confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre o...
void ShowQueryString(std::string_view str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
Functions to mix sound samples.
Base for all music playback.
void ChangeMusicSet(int index)
Change the configured music set and reset playback.
bool _network_available
is network mode available?
Basic functions/variables used all over the place.
Part of the network protocol handling content distribution.
void ShowNetworkContentListWindow(ContentVector *cv=nullptr, ContentType type1=CONTENT_TYPE_END, ContentType type2=CONTENT_TYPE_END)
Show the content list window with a given set of content.
GUIs related to networking.
Part of the network protocol handling opt-in survey.
@ Length
Vehicle length (trains and road vehicles)
Functions to find and configure NewGRFs.
void ChangeAutosaveFrequency(bool reset)
Reset the interval of the autosave.
@ SM_MENU
Switch to game intro menu.
uint8_t GetColourGradient(Colours colour, ColourShade shade)
Get colour gradient palette index.
Base for the GUIs that have an edit box in them.
declaration of OTTD revision dependent variables
A number of safeguards to prevent using unsafe methods.
SettingsContainer & GetSettingsTree()
Construct settings tree.
Declarations of classes for handling display of individual configuration settings.
RestrictionMode
How the list of advanced settings is filtered.
@ RM_CHANGED_AGAINST_DEFAULT
Show only settings which are different compared to default values.
@ RM_ALL
List all settings regardless of the default/newgame/... values.
@ RM_CHANGED_AGAINST_NEW
Show only settings which are different compared to the user's new game setting values.
@ RM_END
End for iteration.
@ RM_BASIC
Display settings associated to the "basic" list.
SettingEntryFlag
Flags for SettingEntry.
@ LeftDepressed
Of a numeric setting entry, the left button is depressed.
@ RightDepressed
Of a numeric setting entry, the right button is depressed.
bool SetSettingValue(const IntSettingDesc *sd, int32_t value, bool force_newgame)
Top function to save the new value of an element of the Settings struct.
GameSettings _settings_newgame
Game settings for new games (updated from the intro screen).
ClientSettings _settings_client
The current settings for this game.
static constexpr TextColour GAME_OPTIONS_LABEL
Colour for label text of game options.
static constexpr Colours GAME_OPTIONS_BACKGROUND
Colour for background of game options.
WarnHiddenResult
Warnings about hidden search results.
@ WHR_CATEGORY_TYPE
Both category and type settings filtered matches away.
@ WHR_CATEGORY
Category setting filtered matches away.
@ WHR_NONE
Nothing was filtering matches away.
@ WHR_TYPE
Type setting filtered matches away.
void DrawArrowButtons(int x, int y, Colours button_colour, uint8_t state, bool clickable_left, bool clickable_right)
Draw [<][>] boxes.
static void ResetAllSettingsConfirmationCallback(Window *w, bool confirmed)
Callback function for the reset all settings button.
void DrawBoolButton(int x, int y, Colours button_colour, Colours background, bool state, bool clickable)
Draw a toggle button.
void DrawUpDownButtons(int x, int y, Colours button_colour, uint8_t state, bool clickable_up, bool clickable_down)
Draw [^][v] buttons.
void ShowBaseSetTextfileWindow(Window *parent, TextfileType file_type, const TBaseSet *baseset, StringID content_type)
Open the BaseSet version of the textfile window.
static const uint32_t _autosave_dropdown_to_minutes[]
Available settings for autosave intervals.
static std::string GetListLabel(const TBaseSet *baseset)
Get string to use when listing this set in the settings window.
static void AddCustomRefreshRates()
Add the refresh rate from the config and the refresh rates from all the monitors to our list of refre...
std::unique_ptr< NWidgetBase > MakeNWidgetSocialPlugins()
Construct nested container widget for managing the list of social plugins.
void DrawDropDownButton(int x, int y, Colours button_colour, bool state, bool clickable)
Draw a dropdown button.
int SETTING_HEIGHT
Height of a single setting in the tree view in pixels.
Dimension _setting_circle_size
Dimension of the circle +/- icon. This is here as not all users are within the class of the settings ...
static constexpr TextColour GAME_OPTIONS_FRAME
Colour for frame text of game options.
static uint GetCurrentResolutionIndex()
Get index of the current screen resolution.
static constexpr Colours GAME_OPTIONS_BUTTON
Colour for buttons of game options.
static void ShowCustCurrency()
Open custom currency window.
static constexpr TextColour GAME_OPTIONS_SELECTED
Colour for selected text of game options.
void ShowGameOptions()
Open the game options window.
Functions for setting GUIs.
#define SETTING_BUTTON_WIDTH
Width of setting buttons.
#define SETTING_BUTTON_HEIGHT
Height of setting buttons.
Functions and types used internally for the settings configurations.
@ GuiCurrency
The number represents money, so when reading value multiply by exchange rate.
@ GuiZeroIsSpecial
A value of zero is possible and has a custom string (the one after "strval").
@ GuiDropdown
The value represents a limited number of string-options (internally integer) presented as dropdown.
SettingType
Type of settings for filtering.
@ ST_CLIENT
Client setting.
@ ST_ALL
Used in setting filter to match all types.
@ ST_COMPANY
Company setting.
GameSettings & GetGameSettings()
Get the settings-object applicable for the current situation: the newgame settings when we're in the ...
void DrawSliderWidget(Rect r, Colours wedge_colour, Colours handle_colour, TextColour text_colour, int min_value, int max_value, int nmarks, int value, SliderMarkFunc *mark_func)
Draw a slider widget with knob at given value.
bool ClickSliderWidget(Rect r, Point pt, int min_value, int max_value, int nmarks, int &value)
Handle click on a slider widget to change the value.
Interface definitions for game to report/respond to social integration.
void ChangeSoundSet(int index)
Change the configured sound set and reset sounds.
Functions related to sound.
Definition of base types and functions in a cross-platform compatible way.
#define lengthof(array)
Return the length of an fixed size array.
static std::optional< T > ParseInteger(std::string_view arg, int base=10, bool clamp=false)
Change a string into its number representation.
Functions related to low-level strings.
CharSetFilter
Valid filter types for IsValidChar.
@ CS_NUMERAL
Only numeric ones.
@ CS_NUMERAL_SIGNED
Only numbers and '-' for negative values.
@ CS_ALPHANUMERAL
Both numeric and alphabetic and spaces and stuff.
Searching and filtering using a stringterm.
void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
Check whether the currently loaded language pack uses characters that the currently loaded font does ...
EncodedString GetEncodedString(StringID str)
Encode a string with no parameters into an encoded string.
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
std::string_view GetCurrentLanguageIsoCode()
Get the ISO language code of the currently loaded language.
TextDirection _current_text_dir
Text direction of the currently selected language.
Functions related to OTTD's strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
@ TD_RTL
Text is written right-to-left by default.
Class to backup a specific variable and restore it upon destruction of this object to prevent stack v...
Window for displaying the textfile of a BaseSet.
const std::string name
Name of the content.
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
const StringID content_type
STR_CONTENT_TYPE_xxx for title.
Data structure describing a single setting in a tab.
uint8_t level
Nesting level of this setting entry.
MusicSettings music
settings related to music/sound
NetworkSettings network
settings related to the network
GUISettings gui
settings related to the GUI
Specification of a currency.
std::string separator
The thousands separator for this currency.
std::string prefix
Prefix to apply when formatting money in this currency.
TimerGameCalendar::Year to_euro
Year of switching to the Euro. May also be CF_NOEURO or CF_ISEURO.
std::string suffix
Suffix to apply when formatting money in this currency.
std::string code
3 letter untranslated code to identify the currency.
uint16_t rate
The conversion rate compared to the base currency.
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
void OnTimeout() override
Called when this window's timeout has been reached.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
void OnQueryTextFinished(std::optional< std::string > str) override
The query window opened from this window has closed.
Dimensions (a width and height) of a rectangle in 2D.
Data about how and where to blit pixels.
bool prefer_sprite
Whether to prefer the built-in sprite font over resizable fonts.
bool global_aa
Whether to anti alias all font sizes.
Information about GRF, used in the game and (part of it) in savegames.
void SetParameterDefaults()
Set the default value for all parameters as specified by action14.
std::vector< uint32_t > param
GRF parameters.
uint8_t settings_restriction_mode
selected restriction mode in adv. settings GUI.
uint16_t refresh_rate
How often we refresh the screen (time between draw-ticks).
uint32_t autosave_interval
how often should we do autosaves?
uint8_t missing_strings_threshold
the number of missing strings before showing the warning
bool scale_bevels
bevels are scaled with GUI scale.
void OnResize() override
Called after the window got resized.
SettingFilter filter
Filter for the list.
bool closing_dropdown
True, if the dropdown list is currently closing.
void OnTimeout() override
Called when this window's timeout has been reached.
void OnDropdownClose(Point pt, WidgetID widget, int index, int click_result, bool instant_close) override
A dropdown window associated to this window has been closed.
SettingEntry * valuewindow_entry
If non-nullptr, pointer to setting for which a value-entering window has been opened.
void OnQueryTextFinished(std::optional< std::string > str) override
The query window opened from this window has closed.
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
void OnDropdownSelect(WidgetID widget, int index, int) override
A dropdown option associated to this window has been selected.
SettingEntry * valuedropdown_entry
If non-nullptr, pointer to the value for which a dropdown window is currently opened.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
void OnPaint() override
The window must be repainted.
SettingEntry * clicked_entry
If non-nullptr, pointer to a clicked numeric setting (with a depressed left or right button).
void OnEditboxChanged(WidgetID wid) override
The text in an editbox has been edited.
QueryString filter_editbox
Filter editbox;.
WarnHiddenResult warn_missing
Whether and how to warn about missing search results.
void OnMouseLoop() override
Called for every mouse loop run, which is at least once per (game) tick.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void Close(int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
void SetDisplayedHelpText(SettingEntry *pe)
Set the entry that should have its help text displayed, and mark the window dirty so it gets repainte...
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
int warn_lines
Number of lines used for warning about missing search results.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
bool manually_changed_folding
Whether the user expanded/collapsed something manually.
SettingEntry * last_clicked
If non-nullptr, pointer to the last clicked setting.
DropDownList BuildDropDownList(WidgetID widget, int *selected_index) const
Build the dropdown list for a specific widget.
void OnInit() override
Notification that the nested widget tree gets initialized.
static GameSettings * settings_ptr
Pointer to the game settings being displayed and modified.
All settings together for the game.
LocaleSettings locale
settings related to used currency/unit system in the current game
Base integer type, including boolean, settings.
std::tuple< int32_t, uint32_t > GetRange() const
Get the min/max range for the setting.
int32_t GetDefaultValue() const
Get the default value of the setting.
StringID GetHelp() const
Get the help text of the setting.
virtual bool IsBoolSetting() const
Check whether this setting is a boolean type setting.
std::pair< StringParameter, StringParameter > GetValueParams(int32_t value) const
Get parameters for drawing the value of the setting.
int32_t Read(const void *object) const
Read the integer from the the actual setting.
int32_t interval
the interval to use between settings in the 'settings' window. If interval is '0' the interval is dyn...
uint8_t currency
currency we currently use
uint8_t effect_vol
The requested effects volume.
uint8_t music_vol
The requested music volume.
ParticipateSurvey participate_survey
Participate in the automated survey.
Coordinates of a point in 2D.
Data stored about a string that can be modified in the GUI.
int cancel_button
Widget button of parent window to simulate when pressing CANCEL in OSK.
static const int ACTION_CLEAR
Clear editbox.
constexpr uint Vertical() const
Get total vertical padding of RectPadding.
Specification of a rectangle with absolute coordinates of all edges.
Rect WithWidth(int width, bool end) const
Copy Rect and set its width.
int Width() const
Get width of Rect.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Rect WithHeight(int height, bool end=false) const
Copy Rect and set its height.
int Height() const
Get height of Rect.
bool IsEditable(bool do_command=false) const
Check whether the setting is editable in the current gamemode.
SettingFlags flags
Handles how a setting would show up in the GUI (text/currency, etc.).
SettingType GetType() const
Return the type of the setting.
void SetButtons(SettingEntryFlags new_val)
Set the button-depressed flags (#SettingsEntryFlag::LeftDepressed and #SettingsEntryFlag::RightDepres...
uint GetMaxHelpHeight(int maxw) override
Get the biggest height of the help text(s), if the width is at least maxw.
const IntSettingDesc * setting
Setting description of the setting.
Filter for settings list.
SettingType type
Filter based on type.
bool type_hides
Whether the type hides filtered strings.
RestrictionMode mode
Filter based on category.
RestrictionMode min_cat
Minimum category needed to display all filtered strings (RM_BASIC, RM_ADVANCED, or RM_ALL).
StringFilter string
Filter string.
bool UpdateFilterState(SettingFilter &filter, bool force_visible)
Update the filter state.
void GetFoldingState(bool &all_folded, bool &all_unfolded) const
Recursively accumulate the folding state of the tree.
void ResetAll()
Resets all settings to their default values.
void FoldAll()
Recursively close all folds of sub-pages.
void UnFoldAll()
Recursively open all folds of sub-pages.
BaseSettingEntry * FindEntry(uint row, uint *cur_row)
Find the setting entry at row number row_num.
uint Draw(GameSettings *settings_ptr, int left, int right, int y, uint first_row, uint max_row, BaseSettingEntry *selected, uint cur_row=0, uint parent_last=0) const
Draw a row in the settings panel.
Data structure describing one page of settings in the settings window.
bool folded
Sub-page is folded (not visible except for its title)
bool IsEmpty() const
Check whether any filter words were entered.
void SetFilterTerm(std::string_view str)
Set the term to filter on.
Templated helper to make a type-safe 'typedef' representing a single POD value.
std::string_view GetText() const
Get the current text.
Window for displaying a textfile.
TextfileType file_type
Type of textfile to view.
virtual void LoadTextfile(const std::string &textfile, Subdirectory dir)
Loads the textfile text from file and setup lines.
High level window description.
Data structure for an opened window.
void ReInit(int rx=0, int ry=0, bool reposition=false)
Re-initialize a window, and optionally change its size.
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
std::map< WidgetID, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
void DrawWidgets() const
Paint all widgets of a window.
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing)
Window * parent
Parent window.
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
virtual std::string GetWidgetString(WidgetID widget, StringID stringid) const
Get the raw string for a widget.
WidgetID mouse_capture_widget
ID of current mouse capture widget (e.g. dragged scrollbar). -1 if no widget has mouse capture.
void CloseChildWindows(WindowClass wc=WC_INVALID) const
Close all children a window might have in a head-recursive manner.
ResizeInfo resize
Resize information.
void DisableWidget(WidgetID widget_index)
Sets a widget to disabled.
void SetWidgetsDisabledState(bool disab_stat, Args... widgets)
Sets the enabled/disabled status of a list of widgets.
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
void CloseChildWindowById(WindowClass wc, WindowNumber number) const
Close all children a window might have in a head-recursive manner.
bool SetFocusedWidget(WidgetID widget_index)
Set focus within this window to the given widget.
bool IsWidgetLowered(WidgetID widget_index) const
Gets the lowered state of a widget.
void SetWidgetsLoweredState(bool lowered_stat, Args... widgets)
Sets the lowered/raised status of a list of widgets.
void SetWidgetLoweredState(WidgetID widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
void EnableWidget(WidgetID widget_index)
Sets a widget to Enabled.
virtual void OnDropdownClose(Point pt, WidgetID widget, int index, int click_result, bool instant_close)
A dropdown window associated to this window has been closed.
void SetTimeout()
Set the timeout flag of the window and initiate the timer.
void LowerWidget(WidgetID widget_index)
Marks a widget as lowered.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
WindowFlags flags
Window flags.
const Scrollbar * GetScrollbar(WidgetID widnum) const
Return the Scrollbar to a widget index.
void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
int height
Height of the window (number of pixels down in y direction)
int width
width of the window (number of pixels to the right in x direction)
@ CONTENT_TYPE_BASE_SOUNDS
The content consists of base sounds.
@ CONTENT_TYPE_BASE_GRAPHICS
The content consists of base graphics.
@ CONTENT_TYPE_BASE_MUSIC
The content consists of base music.
Stuff related to the text buffer GUI.
@ EnableDefault
enable the 'Default' button ("\0" is returned)
std::optional< std::string > GetTextfile(TextfileType type, Subdirectory dir, std::string_view filename)
Search a textfile file next to the given content.
GUI functions related to textfiles.
TextfileType
Additional text files accompanying Tar archives.
@ TFT_LICENSE
Content license.
@ TFT_README
Content readme.
@ TFT_CHANGELOG
Content changelog.
bool _video_vsync
Whether we should use vsync (only if active video driver supports HW acceleration).
bool _video_hw_accel
Whether to consider hardware accelerated video drivers on startup.
Base of all video drivers.
Functions related to (drawing on) viewports.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
void ReInitAllWindows(bool zoom_changed)
Re-initialize all windows.
void CloseWindowByClass(WindowClass cls, int data)
Close all windows of a given class.
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
Window functions not directly related to making/drawing windows.
@ BorderOnly
Draw border only, no background.
@ Lowered
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
@ Centred
Window is centered and shall stay centered after ReInit.
@ Timeout
Window timeout counter.
@ WDP_CENTER
Center the window.
@ WN_GAME_OPTIONS_GAME_OPTIONS
Game options.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
@ WC_MUSIC_WINDOW
Music window; Window numbers:
@ WC_CUSTOM_CURRENCY
Custom currency; Window numbers:
@ WC_GAME_OPTIONS
Game options window; Window numbers:
@ WC_TEXTFILE
textfile; Window numbers:
@ WC_DROPDOWN_MENU
Drop down menu; Window numbers:
@ WC_QUERY_STRING
Query string window; Window numbers:
@ WC_GRF_PARAMETERS
NewGRF parameters; Window numbers:
Functions related to zooming.