16 #if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE) 30 #include "table/strings.h" 46 _background_widgets,
lengthof(_background_widgets)
79 _nested_boostrap_download_status_window_widgets,
lengthof(_nested_boostrap_download_status_window_widgets)
124 _bootstrap_query_widgets,
lengthof(_bootstrap_query_widgets)
148 if (this->button_size.width == 0) {
157 size->width = this->button_size.width * 2;
163 *size = this->button_size;
170 if (widget != 0)
return;
223 #if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(WIN32) || defined(__APPLE__)) 227 _game_mode = GM_BOOTSTRAP;
237 static const int offsets[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0, 0, 0, 0x04, 0x08 };
238 for (uint i = 0; i != 16; i++) {
239 for (
int j = 0; j < 8; j++) {
254 _exit_game = _game_mode == GM_BOOTSTRAP;
255 if (_exit_game)
return false;
261 _game_mode = GM_MENU;
267 usererror(
"Failed to find a graphics set. Please acquire a graphics set for OpenTTD. See section 4.1 of readme.txt.");
Functions related to OTTD's strings.
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
The content consists of base graphics.
void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
Check whether the currently loaded language pack uses characters that the currently loaded font does ...
Base of all video drivers.
ResizeInfo resize
Resize information.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
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...
bool HandleBootstrap()
Handle all procedures for bootstrapping OpenTTD without a base graphics set.
High level window description.
Bootstrap; Window numbers:
WindowFlags flags
Window flags.
Offset at top to draw the frame rectangular area.
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
Callbacks for notifying others about incoming data.
void Connect()
Connect with the content server.
BootstrapAskForDownloadWindow()
Start listening to the content client events.
BootstrapContentDownloadStatusWindow()
Simple call the constructor of the superclass.
static const NWidgetPart _bootstrap_query_widgets[]
The widgets for the query.
int GetStringHeight(const char *str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
virtual void OnConnect(bool success)
Callback for when the connection has finished.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Dimension button_size
The dimension of the button.
#define CLRBITS(x, y)
Clears several bits in a variable.
ContentID
Unique identifier for the content.
static void InitializeUnicodeGlyphMap()
Initialize the glyph map.
The window for the query.
bool _network_available
is network mode available?
Data structure for an opened window.
The background for the game.
Functions to read fonts from files and cache them.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Bottom offset of the text of the frame.
void AddCallback(ContentCallback *cb)
Add a callback to this class.
Fill rectangle with a single colour.
static WindowDesc _bootstrap_query_desc(WDP_CENTER, NULL, 0, 0, WC_CONFIRM_POPUP_QUERY, WC_NONE, 0, _bootstrap_query_widgets, lengthof(_bootstrap_query_widgets))
The window description for the query.
Functions related to the gfx engine.
static WindowDesc _background_desc(WDP_MANUAL, NULL, 0, 0, WC_BOOTSTRAP, WC_NONE, 0, _background_widgets, lengthof(_background_widgets))
Window description for the background window to prevent smearing.
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
Definition of base types and functions in a cross-platform compatible way.
Center both horizontally and vertically.
void CDECL usererror(const char *s,...)
Error handling for fatal user errors.
A number of safeguards to prevent using unsafe methods.
ContentID id
Unique (server side) ID for the content.
Query popup confirm for bootstrap.
void RequestContentList(ContentType type)
Request the content list for the given type.
Background of the window.
Offset at bottom to draw the frame rectangular area.
Basic functions/variables used all over the place.
Right offset of the text of the frame.
#define lengthof(x)
Return the length of an fixed size array.
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
Top offset of the text of the frame.
Left offset of the text of the frame.
static const NWidgetPart _nested_boostrap_download_status_window_widgets[]
Nested widgets for the download window.
The window is a modal child of some other window, meaning the parent is 'inactive'.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Network status window; Window numbers:
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Draw only every second pixel, used for greying-out.
No window, redirects to WC_MAIN_WINDOW.
void Select(ContentID cid)
Select a specific content id.
User interface for downloading files.
void RemoveCallback(ContentCallback *cb)
Remove a callback.
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
static WindowDesc _bootstrap_download_status_window_desc(WDP_CENTER, NULL, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, WDF_MODAL, _nested_boostrap_download_status_window_widgets, lengthof(_nested_boostrap_download_status_window_widgets))
Window description for the download window.
virtual void OnReceiveContentInfo(const ContentInfo *ci)
We received a content info.
virtual void MainLoop()=0
Perform the actual drawing.
Window for showing the download status of content.
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Coordinates of a point in 2D.
Popup with confirm question; Window numbers:
~BootstrapAskForDownloadWindow()
Stop listening to the content client events.
Specification of a rectangle with absolute coordinates of all edges.
Window functions not directly related to making/drawing windows.
Base window for showing the download status of content.
Manually align the window (so no automatic location finding)
static const struct NWidgetPart _background_widgets[]
Widgets for the background window to prevent smearing.
virtual void OnDownloadComplete(ContentID cid)
We have finished downloading a file.
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
Resize the window.
Window white border counter bit mask.
Dimensions (a width and height) of a rectangle in 2D.
Container for all important information about a piece of content.
Factory to 'query' all available blitters.
ClientNetworkContentSocketHandler _network_content_client
The client we use to connect to the server.
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.