annotate src/gfx_type.h @ 11426:38844e2f76fd draft

(svn r15784) -Fix (r15779): TextAlignment and TA_* already exist on windows
author glx <glx@openttd.org>
date Sat, 21 Mar 2009 20:06:00 +0000
parents 8da1855e9f14
children 98caf4f386d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
3 /** @file gfx_type.h Types related to the graphics and/or input devices. */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
4
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
5 #ifndef GFX_TYPE_H
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
6 #define GFX_TYPE_H
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
7
9551
8849c20f82c0 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz <smatz@openttd.org>
parents: 9044
diff changeset
8 #include "core/endian_type.hpp"
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
9 #include "core/enum_type.hpp"
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
10 #include "core/geometry_type.hpp"
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
11 #include "zoom_type.h"
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
12
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11082
diff changeset
13 typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colourtables
9773
fcce76c3bb3d (svn r13910) -Document: string drawing related functions and types (Alberth)
rubidium <rubidium@openttd.org>
parents: 9670
diff changeset
14
10233
63a58f4b2607 (svn r14461) -Document: add some doxygen comments (Albert)
rubidium <rubidium@openttd.org>
parents: 10084
diff changeset
15 /** Combination of a palette sprite and a 'real' sprite */
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
16 struct PalSpriteID {
10233
63a58f4b2607 (svn r14461) -Document: add some doxygen comments (Albert)
rubidium <rubidium@openttd.org>
parents: 10084
diff changeset
17 SpriteID sprite; ///< The 'real' sprite
63a58f4b2607 (svn r14461) -Document: add some doxygen comments (Albert)
rubidium <rubidium@openttd.org>
parents: 10084
diff changeset
18 SpriteID pal; ///< The palette (use \c PAL_NONE) if not needed)
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
19 };
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
20 typedef int32 CursorID;
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
21
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
22 enum WindowKeyCodes {
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
23 WKC_SHIFT = 0x8000,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
24 WKC_CTRL = 0x4000,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
25 WKC_ALT = 0x2000,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
26 WKC_META = 0x1000,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
27
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
28 /* Special ones */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
29 WKC_NONE = 0,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
30 WKC_ESC = 1,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
31 WKC_BACKSPACE = 2,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
32 WKC_INSERT = 3,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
33 WKC_DELETE = 4,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
34
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
35 WKC_PAGEUP = 5,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
36 WKC_PAGEDOWN = 6,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
37 WKC_END = 7,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
38 WKC_HOME = 8,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
39
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
40 /* Arrow keys */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
41 WKC_LEFT = 9,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
42 WKC_UP = 10,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
43 WKC_RIGHT = 11,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
44 WKC_DOWN = 12,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
45
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
46 /* Return & tab */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
47 WKC_RETURN = 13,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
48 WKC_TAB = 14,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
49
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
50 /* Space */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
51 WKC_SPACE = 32,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
52
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
53 /* Function keys */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
54 WKC_F1 = 33,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
55 WKC_F2 = 34,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
56 WKC_F3 = 35,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
57 WKC_F4 = 36,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
58 WKC_F5 = 37,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
59 WKC_F6 = 38,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
60 WKC_F7 = 39,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
61 WKC_F8 = 40,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
62 WKC_F9 = 41,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
63 WKC_F10 = 42,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
64 WKC_F11 = 43,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
65 WKC_F12 = 44,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
66
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
67 /* Backquote is the key left of "1"
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
68 * we only store this key here, no matter what character is really mapped to it
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
69 * on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
70 WKC_BACKQUOTE = 45,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
71 WKC_PAUSE = 46,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
72
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
73 /* 0-9 are mapped to 48-57
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
74 * A-Z are mapped to 65-90
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
75 * a-z are mapped to 97-122 */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
76
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
77 /* Numerical keyboard */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
78 WKC_NUM_DIV = 138,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
79 WKC_NUM_MUL = 139,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
80 WKC_NUM_MINUS = 140,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
81 WKC_NUM_PLUS = 141,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
82 WKC_NUM_ENTER = 142,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
83 WKC_NUM_DECIMAL = 143,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
84
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
85 /* Other keys */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
86 WKC_SLASH = 144, ///< / Forward slash
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
87 WKC_SEMICOLON = 145, ///< ; Semicolon
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
88 WKC_EQUALS = 146, ///< = Equals
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
89 WKC_L_BRACKET = 147, ///< [ Left square bracket
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
90 WKC_BACKSLASH = 148, ///< \ Backslash
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
91 WKC_R_BRACKET = 149, ///< ] Right square bracket
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
92 WKC_SINGLEQUOTE = 150, ///< ' Single quote
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
93 WKC_COMMA = 151, ///< , Comma
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
94 WKC_PERIOD = 152, ///< . Period
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
95 WKC_MINUS = 153, ///< - Minus
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
96 };
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
97
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
98 /** A single sprite of a list of animated cursors */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
99 struct AnimCursor {
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
100 static const CursorID LAST = MAX_UVALUE(CursorID);
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
101 CursorID sprite; ///< Must be set to LAST_ANIM when it is the last sprite of the loop
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
102 byte display_time; ///< Amount of ticks this sprite will be shown
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
103 };
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
104
9773
fcce76c3bb3d (svn r13910) -Document: string drawing related functions and types (Alberth)
rubidium <rubidium@openttd.org>
parents: 9670
diff changeset
105 /** Collection of variables for cursor-display and -animation */
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
106 struct CursorVars {
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
107 Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
108 Point draw_pos, draw_size; ///< position and size bounding-box for drawing
9670
cbf60a2ecf07 (svn r13759) -Fix [FS#2147]: selecting non-full length vehicles in the depot gui would place the "mouse pointer" out of the center of the vehicle making it hard to "aim".
rubidium <rubidium@openttd.org>
parents: 9607
diff changeset
109 int short_vehicle_offset; ///< offset of the X for short vehicles
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
110 SpriteID sprite; ///< current image of cursor
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
111 SpriteID pal;
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
112
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
113 int wheel; ///< mouse wheel movement
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
114
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
115 /* We need two different vars to keep track of how far the scrollwheel moved.
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
116 * OSX uses this for scrolling around the map. */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
117 int v_wheel;
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
118 int h_wheel;
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
119
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
120 const AnimCursor *animate_list; ///< in case of animated cursor, list of frames
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
121 const AnimCursor *animate_cur; ///< in case of animated cursor, current frame
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
122 uint animate_timeout; ///< in case of animated cursor, number of ticks to show the current cursor
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
124 bool visible; ///< cursor is visible
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
125 bool dirty; ///< the rect occupied by the mouse is dirty (redraw)
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
126 bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling)
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
127 bool in_window; ///< mouse inside this window, determines drawing logic
8828
f8c143a8cd90 (svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz <smatz@openttd.org>
parents: 8123
diff changeset
128
f8c143a8cd90 (svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz <smatz@openttd.org>
parents: 8123
diff changeset
129 bool vehchain; ///< vehicle chain is dragged
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
130 };
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
131
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
132 struct DrawPixelInfo {
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
133 void *dst_ptr;
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
134 int left, top, width, height;
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
135 int pitch;
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
136 ZoomLevel zoom;
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
137 };
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
138
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
139 struct Colour {
9551
8849c20f82c0 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz <smatz@openttd.org>
parents: 9044
diff changeset
140 #if TTD_ENDIAN == TTD_BIG_ENDIAN
8849c20f82c0 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz <smatz@openttd.org>
parents: 9044
diff changeset
141 uint8 a, r, g, b; ///< colour channels in BE order
8849c20f82c0 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz <smatz@openttd.org>
parents: 9044
diff changeset
142 #else
8849c20f82c0 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz <smatz@openttd.org>
parents: 9044
diff changeset
143 uint8 b, g, r, a; ///< colour channels in LE order
8849c20f82c0 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz <smatz@openttd.org>
parents: 9044
diff changeset
144 #endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
8849c20f82c0 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz <smatz@openttd.org>
parents: 9044
diff changeset
145
9597
5c76c311cd7d (svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz <smatz@openttd.org>
parents: 9551
diff changeset
146 operator uint32 () const { return *(uint32 *)this; }
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
147 };
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
148
9773
fcce76c3bb3d (svn r13910) -Document: string drawing related functions and types (Alberth)
rubidium <rubidium@openttd.org>
parents: 9670
diff changeset
149 /** Available font sizes */
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
150 enum FontSize {
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
151 FS_NORMAL,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
152 FS_SMALL,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
153 FS_LARGE,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
154 FS_END,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
155 };
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
156 DECLARE_POSTFIX_INCREMENT(FontSize);
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
157
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
158 /**
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
159 * Used to only draw a part of the sprite.
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
160 * Draw the subsprite in the rect (sprite_x_offset + left, sprite_y_offset + top) to (sprite_x_offset + right, sprite_y_offset + bottom).
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
161 * Both corners are included in the drawing area.
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
162 */
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
163 struct SubSprite {
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
164 int left, top, right, bottom;
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
165 };
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
166
9044
a684adb26c57 (svn r12863) -Codechange: rewrite GeneratePlayerColour to be better understandable.
rubidium <rubidium@openttd.org>
parents: 8828
diff changeset
167 enum Colours {
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
168 COLOUR_DARK_BLUE,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
169 COLOUR_PALE_GREEN,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
170 COLOUR_PINK,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
171 COLOUR_YELLOW,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
172 COLOUR_RED,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
173 COLOUR_LIGHT_BLUE,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
174 COLOUR_GREEN,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
175 COLOUR_DARK_GREEN,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
176 COLOUR_BLUE,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
177 COLOUR_CREAM,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
178 COLOUR_MAUVE,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
179 COLOUR_PURPLE,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
180 COLOUR_ORANGE,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
181 COLOUR_BROWN,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
182 COLOUR_GREY,
9044
a684adb26c57 (svn r12863) -Codechange: rewrite GeneratePlayerColour to be better understandable.
rubidium <rubidium@openttd.org>
parents: 8828
diff changeset
183 COLOUR_WHITE,
a684adb26c57 (svn r12863) -Codechange: rewrite GeneratePlayerColour to be better understandable.
rubidium <rubidium@openttd.org>
parents: 8828
diff changeset
184 COLOUR_END,
9870
3f5460dfb6ea (svn r14016) -Codechange: Remove some magical numbers
belugas <belugas@openttd.org>
parents: 9773
diff changeset
185 INVALID_COLOUR = 0xFF,
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
186 };
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
187
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11082
diff changeset
188 /** Colour of the strings, see _string_colourmap in table/palettes.h or docs/ottd-colourtext-palette.png */
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
189 enum TextColour {
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
190 TC_FROMSTRING = 0x00,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
191 TC_BLUE = 0x00,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
192 TC_SILVER = 0x01,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
193 TC_GOLD = 0x02,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
194 TC_RED = 0x03,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
195 TC_PURPLE = 0x04,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
196 TC_LIGHT_BROWN = 0x05,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
197 TC_ORANGE = 0x06,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
198 TC_GREEN = 0x07,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
199 TC_YELLOW = 0x08,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
200 TC_DARK_GREEN = 0x09,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
201 TC_CREAM = 0x0A,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
202 TC_BROWN = 0x0B,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
203 TC_WHITE = 0x0C,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
204 TC_LIGHT_BLUE = 0x0D,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
205 TC_GREY = 0x0E,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
206 TC_DARK_BLUE = 0x0F,
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
207 TC_BLACK = 0x10,
9879
8347c718c756 (svn r14027) -Codechange: Document a bit the DoDrawString function while removing yet som more magic numbers and one "false" colour
belugas <belugas@openttd.org>
parents: 9870
diff changeset
208 TC_INVALID = 0xFF,
11082
9ec1f7eac0a0 (svn r15425) -Codechange: some color->colour changes and type safety.
rubidium <rubidium@openttd.org>
parents: 10685
diff changeset
209
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11082
diff changeset
210 IS_PALETTE_COLOUR = 0x100, ///< colour value is already a real palette colour index, not an index of a StringColour
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
211 };
11082
9ec1f7eac0a0 (svn r15425) -Codechange: some color->colour changes and type safety.
rubidium <rubidium@openttd.org>
parents: 10685
diff changeset
212 DECLARE_ENUM_AS_BIT_SET(TextColour);
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
213
9870
3f5460dfb6ea (svn r14016) -Codechange: Remove some magical numbers
belugas <belugas@openttd.org>
parents: 9773
diff changeset
214 /** Defines a few values that are related to animations using palette changes */
3f5460dfb6ea (svn r14016) -Codechange: Remove some magical numbers
belugas <belugas@openttd.org>
parents: 9773
diff changeset
215 enum PaletteAnimationSizes {
3f5460dfb6ea (svn r14016) -Codechange: Remove some magical numbers
belugas <belugas@openttd.org>
parents: 9773
diff changeset
216 PALETTE_ANIM_SIZE_WIN = 28, ///< number of animated colours in Windows palette
3f5460dfb6ea (svn r14016) -Codechange: Remove some magical numbers
belugas <belugas@openttd.org>
parents: 9773
diff changeset
217 PALETTE_ANIM_SIZE_DOS = 38, ///< number of animated colours in DOS palette
3f5460dfb6ea (svn r14016) -Codechange: Remove some magical numbers
belugas <belugas@openttd.org>
parents: 9773
diff changeset
218 PALETTE_ANIM_SIZE_START = 217, ///< Index in the _palettes array from which all animations are taking places (table/palettes.h)
3f5460dfb6ea (svn r14016) -Codechange: Remove some magical numbers
belugas <belugas@openttd.org>
parents: 9773
diff changeset
219 };
3f5460dfb6ea (svn r14016) -Codechange: Remove some magical numbers
belugas <belugas@openttd.org>
parents: 9773
diff changeset
220
9607
3d6213e95b9a (svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch <frosch@openttd.org>
parents: 9597
diff changeset
221 /** Define the operation GfxFillRect performs */
3d6213e95b9a (svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch <frosch@openttd.org>
parents: 9597
diff changeset
222 enum FillRectMode {
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11082
diff changeset
223 FILLRECT_OPAQUE, ///< Fill rectangle with a single colour
9607
3d6213e95b9a (svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch <frosch@openttd.org>
parents: 9597
diff changeset
224 FILLRECT_CHECKER, ///< Draw only every second pixel, used for greying-out
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11082
diff changeset
225 FILLRECT_RECOLOUR, ///< Apply a recolour sprite to the screen content
9607
3d6213e95b9a (svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch <frosch@openttd.org>
parents: 9597
diff changeset
226 };
3d6213e95b9a (svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch <frosch@openttd.org>
parents: 9597
diff changeset
227
9989
10fd2a3a4a1c (svn r14146) -Codechange: allow palette override in both ways and remove some unneeded '(x == 0) ? 0 : 1' constructs.
rubidium <rubidium@openttd.org>
parents: 9879
diff changeset
228 /** Palettes OpenTTD supports. */
9995
a5aaa00e55ae (svn r14152) -Fix (r14146): Apple decided to use a name I wanted to use... thus making compilation fail on OSX (planetmaker)
rubidium <rubidium@openttd.org>
parents: 9989
diff changeset
229 enum PaletteType {
9989
10fd2a3a4a1c (svn r14146) -Codechange: allow palette override in both ways and remove some unneeded '(x == 0) ? 0 : 1' constructs.
rubidium <rubidium@openttd.org>
parents: 9879
diff changeset
230 PAL_DOS, ///< Use the DOS palette.
10fd2a3a4a1c (svn r14146) -Codechange: allow palette override in both ways and remove some unneeded '(x == 0) ? 0 : 1' constructs.
rubidium <rubidium@openttd.org>
parents: 9879
diff changeset
231 PAL_WINDOWS, ///< Use the Windows palette.
10fd2a3a4a1c (svn r14146) -Codechange: allow palette override in both ways and remove some unneeded '(x == 0) ? 0 : 1' constructs.
rubidium <rubidium@openttd.org>
parents: 9879
diff changeset
232 PAL_AUTODETECT, ///< Automatically detect the palette based on the graphics pack.
10fd2a3a4a1c (svn r14146) -Codechange: allow palette override in both ways and remove some unneeded '(x == 0) ? 0 : 1' constructs.
rubidium <rubidium@openttd.org>
parents: 9879
diff changeset
233 MAX_PAL = 2, ///< The number of palettes.
10fd2a3a4a1c (svn r14146) -Codechange: allow palette override in both ways and remove some unneeded '(x == 0) ? 0 : 1' constructs.
rubidium <rubidium@openttd.org>
parents: 9879
diff changeset
234 };
10fd2a3a4a1c (svn r14146) -Codechange: allow palette override in both ways and remove some unneeded '(x == 0) ? 0 : 1' constructs.
rubidium <rubidium@openttd.org>
parents: 9879
diff changeset
235
10056
7867701f63e4 (svn r14223) -Codechange: make GetSprite aware of the 4 different types of sprites: fonts, recolour, mapgen and normal sprites.
rubidium <rubidium@openttd.org>
parents: 9995
diff changeset
236 /** Types of sprites that might be loaded */
7867701f63e4 (svn r14223) -Codechange: make GetSprite aware of the 4 different types of sprites: fonts, recolour, mapgen and normal sprites.
rubidium <rubidium@openttd.org>
parents: 9995
diff changeset
237 enum SpriteType {
7867701f63e4 (svn r14223) -Codechange: make GetSprite aware of the 4 different types of sprites: fonts, recolour, mapgen and normal sprites.
rubidium <rubidium@openttd.org>
parents: 9995
diff changeset
238 ST_NORMAL = 0, ///< The most basic (normal) sprite
7867701f63e4 (svn r14223) -Codechange: make GetSprite aware of the 4 different types of sprites: fonts, recolour, mapgen and normal sprites.
rubidium <rubidium@openttd.org>
parents: 9995
diff changeset
239 ST_MAPGEN = 1, ///< Special sprite for the map generator
7867701f63e4 (svn r14223) -Codechange: make GetSprite aware of the 4 different types of sprites: fonts, recolour, mapgen and normal sprites.
rubidium <rubidium@openttd.org>
parents: 9995
diff changeset
240 ST_FONT = 2, ///< A sprite used for fonts
7867701f63e4 (svn r14223) -Codechange: make GetSprite aware of the 4 different types of sprites: fonts, recolour, mapgen and normal sprites.
rubidium <rubidium@openttd.org>
parents: 9995
diff changeset
241 ST_RECOLOUR = 3, ///< Recolour sprite
10685
a8145d4c4a05 (svn r14997) -Fix [FS#2524](r14223): when handling invalid sprites, entry in spritecache data could lose its parent
smatz <smatz@openttd.org>
parents: 10233
diff changeset
242 ST_INVALID = 4, ///< Pseudosprite or other unusable sprite, used only internally
10056
7867701f63e4 (svn r14223) -Codechange: make GetSprite aware of the 4 different types of sprites: fonts, recolour, mapgen and normal sprites.
rubidium <rubidium@openttd.org>
parents: 9995
diff changeset
243 };
7867701f63e4 (svn r14223) -Codechange: make GetSprite aware of the 4 different types of sprites: fonts, recolour, mapgen and normal sprites.
rubidium <rubidium@openttd.org>
parents: 9995
diff changeset
244
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
diff changeset
245 #endif /* GFX_TYPE_H */