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