|
OpenTTD Source
14.0-beta3
|
Go to the documentation of this file.
52 extern bool _fullscreen;
53 extern byte _support8bpp;
73 void HandleTextInput(
const char *str,
bool marked =
false,
const char *caret =
nullptr,
const char *insert_location =
nullptr,
const char *replacement_end =
nullptr);
77 void ChangeGameSpeed(
bool enable_fast_forward);
79 void DrawMouseCursor();
80 void ScreenSizeChanged();
83 void UndrawMouseCursor();
86 void GfxScroll(
int left,
int top,
int width,
int height,
int xo,
int yo);
104 void GfxDrawLine(
int left,
int top,
int right,
int bottom,
int colour,
int width = 1,
int dash = 0);
105 void DrawBox(
int x,
int y,
int dx1,
int dy1,
int dx2,
int dy2,
int dx3,
int dy3);
111 return DrawString(r.left, r.right, r.top, str, colour, align, underline, fontsize);
116 return DrawString(r.left, r.right, r.top, str, colour, align, underline, fontsize);
121 return DrawStringMultiLine(r.left, r.right, r.top, r.bottom, str, colour, align, underline, fontsize);
126 return DrawStringMultiLine(r.left, r.right, r.top, r.bottom, str, colour, align, underline, fontsize);
131 GfxFillRect(r.left, r.top, r.right, r.bottom, colour, mode);
147 void AddDirtyBlock(
int left,
int top,
int right,
int bottom);
168 return (min + max - size + 1) / 2;
179 bool ChangeResInGame(
int w,
int h);
180 void SortResolutions();
181 bool ToggleFullScreen(
bool fs);
Palette _cur_palette
Current palette.
void SetMouseCursorBusy(bool busy)
Set or unset the ZZZ cursor.
void SetMouseCursor(CursorID cursor, PaletteID pal)
Assign a single non-animated sprite to the cursor.
bool _left_button_clicked
Is left mouse button clicked?
byte _dirkeys
1 = left, 2 = up, 4 = right, 8 = down
int Height() const
Get height of Rect.
Collection of variables for cursor-display and -animation.
bool _left_button_down
Is left mouse button pressed?
std::unique_ptr< uint32_t[]> DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel zoom=ZOOM_LVL_GUI)
Draws a sprite to a new RGBA buffer (see Colour union) instead of drawing to the screen.
void AddDirtyBlock(int left, int top, int right, int bottom)
Extend the internal _invalid_rect rectangle to contain the rectangle defined by the given parameters.
bool _right_button_down
Is right mouse button pressed?
void DrawSpriteViewport(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub=nullptr)
Draw a sprite in a viewport.
Dimensions (a width and height) of a rectangle in 2D.
void HandleTextInput(const char *str, bool marked=false, const char *caret=nullptr, const char *insert_location=nullptr, const char *replacement_end=nullptr)
Handle text input.
void HandleKeypress(uint keycode, char32_t key)
Handle keyboard input.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
void GfxFillPolygon(const std::vector< Point > &shape, int colour, FillRectMode mode=FILLRECT_OPAQUE)
Fill a polygon with colour.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
ZoomLevel
All zoom levels we know.
int DrawStringMultiLine(int left, int right, int top, int bottom, std::string_view str, TextColour colour=TC_FROMSTRING, StringAlignment align=(SA_TOP|SA_LEFT), bool underline=false, FontSize fontsize=FS_NORMAL)
Draw string, possibly over multiple lines.
StringAlignment
How to align the to-be drawn text.
FillRectMode
Define the operation GfxFillRect performs.
Dimension GetSpriteSize(SpriteID sprid, Point *offset=nullptr, ZoomLevel zoom=ZOOM_LVL_GUI)
Get the size of a sprite.
int GetStringHeight(std::string_view str, int maxw, FontSize fontsize=FS_NORMAL)
Calculates height of string (in pixels).
bool _screen_disable_anim
Disable palette animation (important for 32bpp-anim blitter during giant screenshot)
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize=FS_NORMAL)
Return the string dimension in pixels.
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode=FILLRECT_OPAQUE)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
Used to only draw a part of the sprite.
uint32_t PaletteID
The number of the palette.
Dimension _cur_resolution
The current resolution.
uint GetStringListWidth(const StringID *list, FontSize fontsize=FS_NORMAL)
Get maximum width of a list of strings.
void UpdateWindows()
Update the continuously changing contents of the windows, such as the viewports.
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
From a rectangle that needs redrawing, find the windows that intersect with the rectangle.
uint16_t _game_speed
Current game-speed; 100 is 1x, 0 is infinite.
void SetAnimatedMouseCursor(const AnimCursor *table)
Assign an animation to the cursor.
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
@ FS_NORMAL
Index of the normal font in the font tables.
@ SA_TOP
Top align the text.
void HandleMouseEvents()
Handle a mouse event from the video driver.
bool _right_button_clicked
Is right mouse button clicked?
void UpdateCursorSize()
Update cursor dimension.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub=nullptr, ZoomLevel zoom=ZOOM_LVL_GUI)
Draw a sprite, not in a viewport.
uint32_t CursorID
The number of the cursor (sprite)
void RedrawScreenRect(int left, int top, int right, int bottom)
Repaints a specific rectangle of the screen.
void DrawDirtyBlocks()
Repaints the rectangle blocks which are marked as 'dirty'.
int GetStringLineCount(StringID str, int maxw)
Calculates number of lines of string.
Coordinates of a point in 2D.
void CheckBlitter()
Check whether we still use the right blitter, or use another (better) one.
int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
void DrawRectOutline(const Rect &r, int colour, int width=1, int dash=0)
Draw the outline of a Rect.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
std::vector< Dimension > _resolutions
List of resolutions.
int DrawString(int left, int right, int top, std::string_view str, TextColour colour=TC_FROMSTRING, StringAlignment align=SA_LEFT, bool underline=false, FontSize fontsize=FS_NORMAL)
Draw string, possibly truncated to make it fit in its allocated space.
Point GetCharPosInString(std::string_view str, const char *ch, FontSize start_fontsize=FS_NORMAL)
Get the leading corner of a character in a single-line string relative to the start of the string.
@ FILLRECT_OPAQUE
Fill rectangle with a single colour.
void GetBroadestDigit(uint *front, uint *next, FontSize size=FS_NORMAL)
Determine the broadest digits for guessing the maximum width of a n-digit number.
void DrawCharCentered(char32_t c, const Rect &r, TextColour colour)
Draw single character horizontally centered around (x,y)
bool _ctrl_pressed
Is Ctrl pressed?
byte GetDigitWidth(FontSize size=FS_NORMAL)
Return the maximum width of single digit.
void LoadStringWidthTable(bool monospace=false)
Initialize _stringwidth_table cache.
byte GetCharacterWidth(FontSize size, char32_t key)
Return width of character glyph.
void HandleToolbarHotkey(int hotkey)
Handle Toolbar hotkey events - can come from a source like the MacBook Touch Bar.
A single sprite of a list of animated cursors.
@ SA_LEFT
Left align the text.
void GameSizeChanged()
Size of the application screen changed.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
void HandleCtrlChanged()
State of CONTROL key has changed.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3)
Draws the projection of a parallelepiped.
bool AdjustGUIZoom(bool automatic)
Resolve GUI zoom level and adjust GUI to new zoom, if auto-suggestion is requested.
bool _shift_pressed
Is Shift pressed?
FontSize
Available font sizes.
int Width() const
Get width of Rect.
Dimension GetScaledSpriteSize(SpriteID sprid)
Scale sprite size for GUI.
Specification of a rectangle with absolute coordinates of all edges.
Information about the currently used palette.
ptrdiff_t GetCharAtPosition(std::string_view str, int x, FontSize start_fontsize=FS_NORMAL)
Get the character from a string that is drawn at a specific position.
Data about how and where to blit pixels.