Go to the documentation of this file.
52 extern bool _fullscreen;
53 extern byte _support8bpp;
72 void HandleTextInput(
const char *str,
bool marked =
false,
const char *caret =
nullptr,
const char *insert_location =
nullptr,
const char *replacement_end =
nullptr);
76 void ChangeGameSpeed(
bool enable_fast_forward);
78 void DrawMouseCursor();
79 void ScreenSizeChanged();
82 void UndrawMouseCursor();
88 void GfxScroll(
int left,
int top,
int width,
int height,
int xo,
int yo);
121 void GfxDrawLine(
int left,
int top,
int right,
int bottom,
int colour,
int width = 1,
int dash = 0);
122 void DrawBox(
int x,
int y,
int dx1,
int dy1,
int dx2,
int dy2,
int dx3,
int dy3);
136 void AddDirtyBlock(
int left,
int top,
int right,
int bottom);
139 void GfxInitPalettes();
153 return min + (max - min - size + 1) / 2;
164 bool ChangeResInGame(
int w,
int h);
165 void SortResolutions();
166 bool ToggleFullScreen(
bool fs);
176 #define FONT_HEIGHT_SMALL (GetCharacterHeight(FS_SMALL))
179 #define FONT_HEIGHT_NORMAL (GetCharacterHeight(FS_NORMAL))
182 #define FONT_HEIGHT_LARGE (GetCharacterHeight(FS_LARGE))
185 #define FONT_HEIGHT_MONO (GetCharacterHeight(FS_MONO))
204 #define GREY_SCALE(level) (level)
Palette _cur_palette
Current palette.
void SetMouseCursorBusy(bool busy)
Set or unset the ZZZ cursor.
static const uint8 PC_WHITE
White palette colour.
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
@ SA_HOR_MASK
Mask for horizontal alignment.
Collection of variables for cursor-display and -animation.
bool _left_button_down
Is left mouse button pressed?
char32_t WChar
Type for wide characters, i.e.
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 UpdateGUIZoom()
Resolve GUI zoom level, if auto-suggestion is requested.
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.
static const uint8 PC_YELLOW
Yellow palette colour.
static const uint8 PC_DARK_RED
Dark red palette colour.
void HandleKeypress(uint keycode, WChar key)
Handle keyboard input.
@ SA_RIGHT
Right align the text (must be a single bit).
static const uint8 PC_ORANGE
Orange palette colour.
static const uint8 PC_RED
Red palette colour.
void GfxFillPolygon(const std::vector< Point > &shape, int colour, FillRectMode mode=FILLRECT_OPAQUE)
Fill a polygon with colour.
@ SA_LEFT
Left align the text.
static const uint8 PC_RAINFOREST
Pale green palette colour for rainforest.
int GetStringHeight(const char *str, int maxw, FontSize fontsize=FS_NORMAL)
Calculates height of string (in pixels).
StringAlignment
How to align the to-be drawn text.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
ZoomLevel
All zoom levels we know.
FillRectMode
Define the operation GfxFillRect performs.
Dimension GetSpriteSize(SpriteID sprid, Point *offset=nullptr, ZoomLevel zoom=ZOOM_LVL_GUI)
Get the size of a sprite.
@ SA_BOTTOM
Bottom align the text.
@ SA_CENTER
Center both horizontally and vertically.
bool _screen_disable_anim
Disable palette animation (important for 32bpp-anim blitter during giant screenshot)
@ SA_FORCE
Force the alignment, i.e. don't swap for RTL languages.
@ SA_HOR_CENTER
Horizontally center the text.
static const uint8 PC_GRASS_LAND
Dark green palette colour for grass land.
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.
Dimension _cur_resolution
The current resolution.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
@ SA_TOP
Top align the text.
void UpdateWindows()
Update the continuously changing contents of the windows, such as the viewports.
static const uint8 PC_VERY_LIGHT_YELLOW
Almost-white yellow palette colour.
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
From a rectangle that needs redrawing, find the windows that intersect with the rectangle.
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.
static const int DRAW_STRING_BUFFER
Size of the buffer used for drawing strings.
uint32 CursorID
The number of the cursor (sprite)
@ FS_NORMAL
Index of the normal font in the font tables.
int DrawString(int left, int right, int top, const char *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.
void HandleMouseEvents()
Handle a mouse event from the video driver.
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour=TC_FROMSTRING, StringAlignment align=(SA_TOP|SA_LEFT), bool underline=false, FontSize fontsize=FS_NORMAL)
Draw string, possibly over multiple lines.
Point GetCharPosInString(const char *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.
bool _right_button_clicked
Is right mouse button clicked?
@ SA_VERT_CENTER
Vertically center the text.
byte GetCharacterWidth(FontSize size, WChar key)
Return width of character glyph.
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.
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.
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
static const uint8 PC_BLACK
Black palette colour.
TextColour GetContrastColour(uint8 background, uint8 threshold=128)
Determine a contrasty text colour for a coloured background.
static const uint8 PC_TREES
Green palette colour for trees.
std::vector< Dimension > _resolutions
List of resolutions.
static const uint8 PC_GREY
Grey palette colour.
static const uint8 PC_FIELDS
Light brown palette colour for fields.
@ FILLRECT_OPAQUE
Fill rectangle with a single colour.
static const uint8 PC_VERY_DARK_BROWN
Almost-black brown palette colour.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void GetBroadestDigit(uint *front, uint *next, FontSize size=FS_NORMAL)
Determine the broadest digits for guessing the maximum width of a n-digit number.
static const uint8 PC_VERY_DARK_RED
Almost-black red palette colour.
@ SA_VERT_MASK
Mask for vertical alignment.
static const uint8 PC_LIGHT_YELLOW
Light yellow palette colour.
bool _ctrl_pressed
Is Ctrl pressed?
static const uint8 PC_ROUGH_LAND
Dark green palette colour for rough land.
static const uint8 PC_DARK_BLUE
Dark blue palette colour.
uint32 PaletteID
The number of the palette.
byte GetDigitWidth(FontSize size=FS_NORMAL)
Return the maximum width of single digit.
void LoadStringWidthTable(bool monospace=false)
Initialize _stringwidth_table cache.
const char * GetCharAtPosition(const char *str, int x, FontSize start_fontsize=FS_NORMAL)
Get the character from a string that is drawn at a specific position.
static const uint8 PC_VERY_DARK_BLUE
Almost-black blue palette colour.
A single sprite of a list of animated cursors.
static const uint8 PC_WATER
Dark blue palette colour for water.
bool _palette_remap_grf[]
Whether the given NewGRFs must get a palette remap from windows to DOS or not.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
void GameSizeChanged()
Size of the application screen changed.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize=FS_NORMAL)
Return the string dimension in pixels.
static int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
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 _shift_pressed
Is Shift pressed?
FontSize
Available font sizes.
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
#define GREY_SCALE(level)
Return the colour for a particular greyscale level.
static const uint8 PC_DARK_GREY
Dark grey palette colour.
static const uint8 PC_LIGHT_BLUE
Light blue palette colour.
void DrawCharCentered(WChar c, int x, int y, TextColour colour)
Draw single character horizontally centered around (x,y)
Information about the currently used palette.
uint16 _game_speed
Current game-speed; 100 is 1x, 0 is infinite.
static const uint8 PC_GREEN
Green palette colour.
static const uint8 PC_BARE_LAND
Brown palette colour for bare land.
Data about how and where to blit pixels.