93 WKC_NUM_DECIMAL = 143,
159 int left, top, width, height;
168#if defined(__EMSCRIPTEN__)
170#elif TTD_ENDIAN == TTD_BIG_ENDIAN
184 Colour(uint8_t r, uint8_t g, uint8_t
b, uint8_t a = 0xFF) :
185#if defined(__EMSCRIPTEN__)
186 r(r), g(g),
b(
b), a(a)
188 a(a), r(r), g(g),
b(
b)
190 b(
b), g(g), r(r), a(a)
204static_assert(
sizeof(
Colour) ==
sizeof(uint32_t));
219inline const char *FontSizeToName(
FontSize fs)
221 static const char *SIZE_TO_NAME[] = {
"medium",
"small",
"large",
"mono" };
223 return SIZE_TO_NAME[fs];
232 int left, top, right, bottom;
235enum Colours : uint8_t {
237 COLOUR_DARK_BLUE = COLOUR_BEGIN,
254 INVALID_COLOUR = 0xFF,
262 TC_FROMSTRING = 0x00,
268 TC_LIGHT_BROWN = 0x05,
272 TC_DARK_GREEN = 0x09,
276 TC_LIGHT_BLUE = 0x0D,
Container with information about a font.
Definition of various endian-dependant macros.
#define TTD_BIG_ENDIAN
Big endian builds use this for TTD_ENDIAN.
Type (helpers) for enums.
#define DECLARE_ENUM_AS_BIT_SET(enum_type)
Operators to allow to work with enum as with type safe bit set in C++.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
#define DECLARE_ENUM_AS_ADDABLE(EnumType)
Operator that allows this enumeration to be added to any other enumeration.
All geometry types in OpenTTD.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
SpriteType
Types of sprites that might be loaded.
@ Recolour
Recolour sprite.
@ MapGen
Special sprite for the map generator.
@ Invalid
Pseudosprite or other unusable sprite, used only internally.
@ Normal
The most basic (normal) sprite.
StringAlignment
How to align the to-be drawn text.
@ SA_TOP
Top align the text.
@ SA_LEFT
Left align the text.
@ SA_HOR_MASK
Mask for horizontal alignment.
@ SA_RIGHT
Right align the text (must be a single bit).
@ SA_HOR_CENTER
Horizontally center the text.
@ SA_VERT_MASK
Mask for vertical alignment.
@ SA_FORCE
Force the alignment, i.e. don't swap for RTL languages.
@ SA_BOTTOM
Bottom align the text.
@ SA_CENTER
Center both horizontally and vertically.
@ SA_VERT_CENTER
Vertically center the text.
static constexpr uint8_t PALETTE_ANIM_SIZE
number of animated colours
PaletteType
Palettes OpenTTD supports.
@ MAX_PAL
The number of palettes.
@ PAL_AUTODETECT
Automatically detect the palette based on the graphics pack.
@ PAL_DOS
Use the DOS palette.
@ PAL_WINDOWS
Use the Windows palette.
uint32_t CursorID
The number of the cursor (sprite)
FontSize
Available font sizes.
@ FS_MONO
Index of the monospaced font in the font tables.
@ FS_SMALL
Index of the small font in the font tables.
@ FS_NORMAL
Index of the normal font in the font tables.
@ FS_LARGE
Index of the large font in the font tables.
uint32_t PaletteID
The number of the palette.
static constexpr uint8_t PALETTE_ANIM_START
Index in the _palettes array from which all animations are taking places (table/palettes....
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
@ TC_FORCED
Ignore colour changes from strings.
@ TC_FLAGS_MASK
Mask to test if TextColour (with flags) is within limits.
@ TC_NO_SHADE
Do not add shading to this text colour.
@ TC_IS_PALETTE_COLOUR
Colour value is already a real palette colour index, not an index of a StringColour.
@ TC_COLOUR_MASK
Mask to test if TextColour (without flags) is within limits.
Support8bpp
Modes for 8bpp support.
@ S8BPP_HARDWARE
Full 8bpp support by OS and hardware.
@ S8BPP_NONE
No support for 8bpp by OS or hardware, force 32bpp blitters.
@ S8BPP_SYSTEM
No 8bpp support by hardware, do not try to use 8bpp video modes or hardware palettes.
@ WKC_BACKSLASH
\ Backslash
@ WKC_SLASH
/ Forward slash
@ WKC_SINGLEQUOTE
' Single quote
@ WKC_R_BRACKET
] Right square bracket
@ WKC_L_BRACKET
[ Left square bracket
@ WKC_GLOBAL_HOTKEY
Fake keycode bit to indicate global hotkeys.
@ WKC_SEMICOLON
; Semicolon
FillRectMode
Define the operation GfxFillRect performs.
@ FILLRECT_CHECKER
Draw only every second pixel, used for greying-out.
@ FILLRECT_OPAQUE
Fill rectangle with a single colour.
@ FILLRECT_RECOLOUR
Apply a recolour sprite to the screen content.
static const uint MILLISECONDS_PER_TICK
The number of milliseconds per game tick.
#define MAX_UVALUE(type)
The largest value that can be entered in a variable.
A single sprite of a list of animated cursors.
uint8_t display_time
Amount of ticks this sprite will be shown.
CursorID sprite
Must be set to LAST_ANIM when it is the last sprite of the loop.
Point pos
Relative position.
Collection of variables for cursor-display and -animation.
bool visible
cursor is visible
bool UpdateCursorPosition(int x, int y)
Update cursor position on mouse movement.
uint animate_timeout
in case of animated cursor, number of ticks to show the current cursor
std::vector< CursorSprite > sprites
Sprites comprising cursor.
bool fix_at
mouse is moving, but cursor is not (used for scrolling)
const AnimCursor * animate_list
in case of animated cursor, list of frames
Point pos
logical mouse position
void UpdateCursorPositionRelative(int delta_x, int delta_y)
Update cursor position based on a relative change.
bool vehchain
vehicle chain is dragged
bool in_window
mouse inside this window, determines drawing logic
int wheel
mouse wheel movement
const AnimCursor * animate_cur
in case of animated cursor, current frame
Point total_size
union of sprite properties
bool dirty
the rect occupied by the mouse is dirty (redraw)
Point draw_size
position and size bounding-box for drawing
Point delta
relative mouse movement in this tick
Data about how and where to blit pixels.
Combination of a palette sprite and a 'real' sprite.
SpriteID sprite
The 'real' sprite.
PaletteID pal
The palette (use PAL_NONE) if not needed)
Information about the currently used palette.
int first_dirty
The first dirty element.
int count_dirty
The number of dirty elements.
Colour palette[256]
Current palette. Entry 0 has to be always fully transparent!
Coordinates of a point in 2D.
Used to only draw a part of the sprite.
Structure to access the alpha, red, green, and blue channels from a 32 bit number.
Colour(uint8_t r, uint8_t g, uint8_t b, uint8_t a=0xFF)
Create a new colour.
uint32_t data
Conversion of the channel information to a 32 bit number.
Colour(uint data=0)
Create a new colour.
uint8_t b
colour channels in BE order
Types related to zooming in and out.
ZoomLevel
All zoom levels we know.