54 extern bool _fullscreen;
55 extern byte _support8bpp;
59 extern byte _fast_forward;
75 void HandleTextInput(
const char *str,
bool marked =
false,
const char *caret = NULL,
const char *insert_location = NULL,
const char *replacement_end = NULL);
78 void CSleep(
int milliseconds);
81 void DrawMouseCursor();
82 void ScreenSizeChanged();
84 void UndrawMouseCursor();
89 void RedrawScreenRect(
int left,
int top,
int right,
int bottom);
90 void GfxScroll(
int left,
int top,
int width,
int height,
int xo,
int yo);
122 void GfxDrawLine(
int left,
int top,
int right,
int bottom,
int colour,
int width = 1,
int dash = 0);
123 void DrawBox(
int x,
int y,
int dx1,
int dy1,
int dx2,
int dy2,
int dx3,
int dy3);
140 void GfxInitPalettes();
154 return min + (max - min - size + 1) / 2;
165 bool ChangeResInGame(
int w,
int h);
166 void SortResolutions(
int count);
167 bool ToggleFullScreen(
bool fs);
177 #define FONT_HEIGHT_SMALL (GetCharacterHeight(FS_SMALL)) 180 #define FONT_HEIGHT_NORMAL (GetCharacterHeight(FS_NORMAL)) 183 #define FONT_HEIGHT_LARGE (GetCharacterHeight(FS_LARGE)) 186 #define FONT_HEIGHT_MONO (GetCharacterHeight(FS_MONO)) 205 #define GREY_SCALE(level) (level) TextColour GetContrastColour(uint8 background)
Determine a contrasty text colour for a coloured background.
bool _ctrl_pressed
Is Ctrl pressed?
bool _right_button_clicked
Is right mouse button clicked?
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize=FS_NORMAL)
Return the string dimension in pixels.
void HandleTextInput(const char *str, bool marked=false, const char *caret=NULL, const char *insert_location=NULL, const char *replacement_end=NULL)
Handle text input.
uint32 PaletteID
The number of the palette.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub=NULL, ZoomLevel zoom=ZOOM_LVL_GUI)
Draw a sprite, not in a viewport.
Data about how and where to blit pixels.
static const uint8 PC_WHITE
White palette colour.
Horizontally center the text.
Information about the currently used palette.
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_down
Is right mouse button pressed?
byte GetCharacterWidth(FontSize size, uint32 key)
Return width of character glyph.
StringAlignment
How to align the to-be drawn text.
Mask for horizontal alignment.
void SetMouseCursorBusy(bool busy)
Set or unset the ZZZ cursor.
int _num_resolutions
The number of resolutions.
static const uint8 PC_LIGHT_BLUE
Light blue palette colour.
static const int DRAW_STRING_BUFFER
Size of the buffer used for drawing strings.
void DrawDirtyBlocks()
Repaints the rectangle blocks which are marked as 'dirty'.
void SetMouseCursor(CursorID cursor, PaletteID pal)
Assign a single non-animated sprite to the cursor.
void UpdateCursorSize()
Update cursor dimension.
static const uint8 PC_LIGHT_YELLOW
Light yellow palette colour.
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
void DrawSpriteViewport(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub=NULL)
Draw a sprite in a viewport.
static T max(const T a, const T b)
Returns the maximum of two values.
#define GREY_SCALE(level)
Return the colour for a particular greyscale level.
FillRectMode
Define the operation GfxFillRect performs.
void SetAnimatedMouseCursor(const AnimCursor *table)
Assign an animation to the cursor.
Force the alignment, i.e. don't swap for RTL languages.
static const uint8 PC_GREEN
Green palette colour.
Collection of variables for cursor-display and -animation.
static const uint8 PC_DARK_GREY
Dark grey palette colour.
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...
int GetStringHeight(const char *str, int maxw, FontSize fontsize=FS_NORMAL)
Calculates height of string (in pixels).
Fill rectangle with a single colour.
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.
Dimension GetSpriteSize(SpriteID sprid, Point *offset=NULL, ZoomLevel zoom=ZOOM_LVL_GUI)
Get the size of a sprite.
Center both horizontally and vertically.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
Palette _cur_palette
Current palette.
int GetStringLineCount(StringID str, int maxw)
Calculates number of lines of string.
void HandleKeypress(uint keycode, WChar key)
Handle keyboard input.
bool _palette_remap_grf[]
Whether the given NewGRFs must get a palette remap from windows to DOS or not.
void LoadStringWidthTable(bool monospace=false)
Initialize _stringwidth_table cache.
A single sprite of a list of animated cursors.
void HandleMouseEvents()
Handle a mouse event from the video driver.
Mask for vertical alignment.
bool _screen_disable_anim
Disable palette animation (important for 32bpp-anim blitter during giant screenshot) ...
static T min(const T a, const T b)
Returns the minimum of two values.
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3)
Draws the projection of a parallelepiped.
Dimension _resolutions[32]
List of resolutions.
static const uint8 PC_BLACK
Black 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.
byte _dirkeys
1 = left, 2 = up, 4 = right, 8 = down
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.
bool _shift_pressed
Is Shift pressed?
void DrawCharCentered(uint32 c, int x, int y, TextColour colour)
Draw single character horizontally centered around (x,y)
static const uint8 PC_VERY_DARK_RED
Almost-black red palette colour.
static int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
static const uint8 PC_GREY
Grey palette colour.
static const uint8 PC_DARK_BLUE
Dark blue palette colour.
static const uint8 PC_YELLOW
Yellow palette colour.
void HandleCtrlChanged()
State of CONTROL key has changed.
static const uint8 PC_DARK_RED
Dark red palette colour.
ZoomLevel
All zoom levels we know.
byte GetDigitWidth(FontSize size=FS_NORMAL)
Return the maximum width of single digit.
bool _left_button_down
Is left mouse button pressed?
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
static const uint8 PC_ORANGE
Orange palette colour.
static const uint8 PC_VERY_DARK_BROWN
Almost-black brown palette colour.
static const uint8 PC_RED
Red palette colour.
FontSize
Available font sizes.
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.
Index of the normal font in the font tables.
Used to only draw a part of the sprite.
void GetBroadestDigit(uint *front, uint *next, FontSize size=FS_NORMAL)
Determine the broadest digits for guessing the maximum width of a n-digit number. ...
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
uint32 CursorID
The number of the cursor (sprite)
Coordinates of a point in 2D.
Types related to strings.
void GameSizeChanged()
Size of the application screen changed.
bool _left_button_clicked
Is left mouse button clicked?
Right align the text (must be a single bit).
Dimension _cur_resolution
The current resolution.
Vertically center the text.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
void SetDirtyBlocks(int left, int top, int right, int bottom)
This function extends the internal _invalid_rect rectangle as it now contains the rectangle defined b...
uint32 WChar
Type for wide characters, i.e.
static const uint8 PC_VERY_LIGHT_YELLOW
Almost-white yellow palette colour.
Dimensions (a width and height) of a rectangle in 2D.
void CheckBlitter()
Check whether we still use the right blitter, or use another (better) one.
Types related to the graphics and/or input devices.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
void UpdateWindows()
Update the continuously changing contents of the windows, such as the viewports.