31 #include "table/strings.h" 52 if (!gui_scope)
return;
89 str = STR_INTRO_BASESET;
94 str = STR_INTRO_TRANSLATION;
104 textdim.width -= textdim.width / 2;
105 *size =
maxdim(*size, textdim);
107 size->height = height + padding.height;
136 ShowNetworkGameWindow();
162 static const NWidgetPart _nested_select_game_widgets[] = {
201 SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
204 SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
207 SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
210 SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
217 NWidget(
WWT_EMPTY, COLOUR_ORANGE,
WID_SGI_BASESET),
SetMinimalSize(316, 12),
SetFill(1, 0),
SetPadding(0, 10, 7, 10),
222 NWidget(
WWT_EMPTY, COLOUR_ORANGE,
WID_SGI_TRANSLATION),
SetMinimalSize(316, 12),
SetFill(1, 0),
SetPadding(0, 10, 7, 10),
260 SetDataTip(STR_INTRO_QUIT, STR_INTRO_TOOLTIP_QUIT),
273 _nested_select_game_widgets,
lengthof(_nested_select_game_widgets)
276 void ShowSelectGameWindow()
281 static void AskExitGameCallback(
Window *w,
bool confirmed)
283 if (confirmed) _exit_game =
true;
290 #elif defined(__APPLE__) 292 #elif defined(__HAIKU__) 294 #elif defined(__OS2__) 303 STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD,
310 static void AskExitToGameMenuCallback(
Window *w,
bool confirmed)
318 void AskExitToGameMenu()
321 STR_ABANDON_GAME_CAPTION,
322 (_game_mode != GM_EDITOR) ? STR_ABANDON_GAME_QUERY : STR_ABANDON_SCENARIO_QUERY,
324 AskExitToGameMenuCallback
void OnInit() override
Notification that the nested widget tree gets initialized.
Functions related to OTTD's strings.
ResizeInfo resize
Resize information.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
byte landscape
the landscape we're currently in
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
High level window description.
GRFConfig * _grfconfig_newgame
First item in list of default GRF set up.
Switch to game intro menu.
GUIs related to networking.
Window for configuring the AIs
uint _missing_extra_graphics
Number of sprites provided by the fallback extra GRF, i.e. missing in the baseset.
const LanguageMetadata * _current_language
The currently loaded language.
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x=0, int y=0, const GRFFile *textref_stack_grffile=nullptr, uint textref_stack_size=0, const uint32 *textref_stack=nullptr)
Display an error message in a window.
int GetStringHeight(const char *str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
void ShowAIConfigWindow()
Open the AI config window.
Functions related to world/map generation.
Stuff related to the text buffer GUI.
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Functions, definitions and such used only by the GUI.
static const uint32 GENERATE_NEW_SEED
Create a new random seed.
bool _network_available
is network mode available?
Data structure for an opened window.
bool _ctrl_pressed
Is Ctrl pressed?
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
void StartNewGameWithoutGUI(uint32 seed)
Start a normal game without the GUI.
bool _is_network_server
Does this client wants to be a network-server?
Functions related to errors.
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
Show a modal confirmation window with standard 'yes' and 'no' buttons The window is aligned to the ce...
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Functions related to the gfx engine.
ClientSettings _settings_client
The current settings for this game.
Definition of base types and functions in a cross-platform compatible way.
Center both horizontally and vertically.
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_newgame
Game settings for new games (updated from the intro screen).
Information about languages and their files.
void ShowGenerateLandscape()
Start with a normal game.
Basic functions/variables used all over the place.
Part of the network protocol handling content distribution.
void StartScenarioEditor()
Start with a scenario editor.
#define lengthof(x)
Return the length of an fixed size array.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void ShowHighscoreTable(int difficulty=SP_CUSTOM, int8 rank=-1)
Show the highscore table for a given difficulty.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Select game window; Window numbers:
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
No window, redirects to WC_MAIN_WINDOW.
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config)
Setup the NewGRF gui.
Declaration of functions and types defined in highscore.h and highscore_gui.h.
GUISettings gui
settings related to the GUI
byte missing_strings_threshold
the number of missing strings before showing the warning
void ClearErrorMessages()
Clear all errors from the queue.
Declarations for savegames operations.
Types related to the landscape.
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop)
Launch save/load dialog in the given mode.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
SwitchMode _switch_mode
The next mainloop command.
Coordinates of a point in 2D.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
void ShowGameSettings()
Open advanced settings window.
declaration of OTTD revision dependent variables
GameCreationSettings game_creation
settings used during the creation of a game (map)
Specification of a rectangle with absolute coordinates of all edges.
void ShowGameOptions()
Open the game options window.
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
void SetNewLandscapeType(byte landscape)
Changes landscape type and sets genworld window dirty.
GUI functions that shouldn't be here.
Errors (eg. saving/loading failed)
Dimensions (a width and height) of a rectangle in 2D.
This file contains all sprite-related enums and defines.
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.
int height
Height of the window (number of pixels down in y direction)
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.