1
/* $Id: gfx_type.h 14269 2008-09-07 22:14:48Z rubidium $ */
1
/* $Id: gfx_type.h 15428 2009-02-09 02:57:15Z rubidium $ */
3
3
/** @file gfx_type.h Types related to the graphics and/or input devices. */
8
#include "core/endian_type.hpp"
8
9
#include "core/enum_type.hpp"
9
10
#include "core/geometry_type.hpp"
10
11
#include "zoom_type.h"
12
typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colortables
13
typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colourtables
15
/** Combination of a palette sprite and a 'real' sprite */
13
16
struct PalSpriteID {
17
SpriteID sprite; ///< The 'real' sprite
18
SpriteID pal; ///< The palette (use \c PAL_NONE) if not needed)
17
20
typedef int32 CursorID;
99
102
byte display_time; ///< Amount of ticks this sprite will be shown
105
/** Collection of variables for cursor-display and -animation */
102
106
struct CursorVars {
103
107
Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
104
108
Point draw_pos, draw_size; ///< position and size bounding-box for drawing
121
125
bool dirty; ///< the rect occupied by the mouse is dirty (redraw)
122
126
bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling)
123
127
bool in_window; ///< mouse inside this window, determines drawing logic
129
bool vehchain; ///< vehicle chain is dragged
126
132
struct DrawPixelInfo {
140
#if TTD_ENDIAN == TTD_BIG_ENDIAN
141
uint8 a, r, g, b; ///< colour channels in BE order
143
uint8 b, g, r, a; ///< colour channels in LE order
144
#endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
146
operator uint32 () const { return *(uint32 *)this; }
149
/** Available font sizes */
193
206
TC_DARK_BLUE = 0x0F,
197
enum StringColorFlags {
198
IS_PALETTE_COLOR = 0x100, ///< color value is already a real palette color index, not an index of a StringColor
210
IS_PALETTE_COLOUR = 0x100, ///< colour value is already a real palette colour index, not an index of a StringColour
212
DECLARE_ENUM_AS_BIT_SET(TextColour);
214
/** Defines a few values that are related to animations using palette changes */
215
enum PaletteAnimationSizes {
216
PALETTE_ANIM_SIZE_WIN = 28, ///< number of animated colours in Windows palette
217
PALETTE_ANIM_SIZE_DOS = 38, ///< number of animated colours in DOS palette
218
PALETTE_ANIM_SIZE_START = 217, ///< Index in the _palettes array from which all animations are taking places (table/palettes.h)
221
/** Define the operation GfxFillRect performs */
223
FILLRECT_OPAQUE, ///< Fill rectangle with a single colour
224
FILLRECT_CHECKER, ///< Draw only every second pixel, used for greying-out
225
FILLRECT_RECOLOUR, ///< Apply a recolour sprite to the screen content
228
/** Palettes OpenTTD supports. */
230
PAL_DOS, ///< Use the DOS palette.
231
PAL_WINDOWS, ///< Use the Windows palette.
232
PAL_AUTODETECT, ///< Automatically detect the palette based on the graphics pack.
233
MAX_PAL = 2, ///< The number of palettes.
236
/** Types of sprites that might be loaded */
238
ST_NORMAL = 0, ///< The most basic (normal) sprite
239
ST_MAPGEN = 1, ///< Special sprite for the map generator
240
ST_FONT = 2, ///< A sprite used for fonts
241
ST_RECOLOUR = 3, ///< Recolour sprite
242
ST_INVALID = 4, ///< Pseudosprite or other unusable sprite, used only internally
201
245
#endif /* GFX_TYPE_H */