1 /* $Id$ */ |
1 /* $Id$ */ |
2 |
2 |
3 #ifndef GFX_H |
3 #ifndef GFX_H |
4 #define GFX_H |
4 #define GFX_H |
5 |
5 |
6 typedef byte Pixel; |
6 #include "helpers.hpp" |
7 |
|
8 struct DrawPixelInfo { |
|
9 Pixel *dst_ptr; |
|
10 int left, top, width, height; |
|
11 int pitch; |
|
12 uint16 zoom; |
|
13 }; |
|
14 |
|
15 |
|
16 typedef struct CursorVars { |
|
17 Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement |
|
18 Point draw_pos, draw_size; ///< position and size bounding-box for drawing |
|
19 CursorID sprite; ///< current image of cursor |
|
20 |
|
21 int wheel; ///< mouse wheel movement |
|
22 const CursorID *animate_list, *animate_cur; ///< in case of animated cursor, list of frames |
|
23 uint animate_timeout; ///< current frame in list of animated cursor |
|
24 |
|
25 bool visible; ///< cursor is visible |
|
26 bool dirty; ///< the rect occupied by the mouse is dirty (redraw) |
|
27 bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling) |
|
28 bool in_window; ///< mouse inside this window, determines drawing logic |
|
29 } CursorVars; |
|
30 |
|
31 |
7 |
32 typedef enum FontSizes { |
8 typedef enum FontSizes { |
33 FS_NORMAL, |
9 FS_NORMAL, |
34 FS_SMALL, |
10 FS_SMALL, |
35 FS_LARGE, |
11 FS_LARGE, |
36 FS_END, |
12 FS_END, |
37 } FontSize; |
13 } FontSize; |
38 |
14 |
|
15 DECLARE_POSTFIX_INCREMENT(FontSize); |
39 |
16 |
40 void RedrawScreenRect(int left, int top, int right, int bottom); |
17 void RedrawScreenRect(int left, int top, int right, int bottom); |
41 void GfxScroll(int left, int top, int width, int height, int xo, int yo); |
18 void GfxScroll(int left, int top, int width, int height, int xo, int yo); |
42 |
19 |
43 |
20 |
81 bool FillDrawPixelInfo(DrawPixelInfo* n, int left, int top, int width, int height); |
58 bool FillDrawPixelInfo(DrawPixelInfo* n, int left, int top, int width, int height); |
82 |
59 |
83 /* window.c */ |
60 /* window.c */ |
84 void DrawOverlappedWindowForAll(int left, int top, int right, int bottom); |
61 void DrawOverlappedWindowForAll(int left, int top, int right, int bottom); |
85 |
62 |
86 void SetMouseCursor(uint cursor); |
63 void SetMouseCursor(CursorID cursor); |
87 void SetAnimatedMouseCursor(const CursorID *table); |
64 void SetAnimatedMouseCursor(const CursorID *table); |
88 void CursorTick(void); |
65 void CursorTick(void); |
89 void DrawMouseCursor(void); |
66 void DrawMouseCursor(void); |
90 void ScreenSizeChanged(void); |
67 void ScreenSizeChanged(void); |
91 void UndrawMouseCursor(void); |
68 void UndrawMouseCursor(void); |
92 bool ChangeResInGame(int w, int h); |
69 bool ChangeResInGame(int w, int h); |
93 void SortResolutions(int count); |
70 void SortResolutions(int count); |
94 void ToggleFullScreen(bool fs); |
71 extern "C" void ToggleFullScreen(bool fs); |
95 |
72 |
96 /* gfx.c */ |
73 /* gfx.c */ |
97 #define ASCII_LETTERSTART 32 |
74 #define ASCII_LETTERSTART 32 |
98 extern FontSize _cur_fontsize; |
75 extern FontSize _cur_fontsize; |
99 |
76 |
136 * All 16 colour gradients |
111 * All 16 colour gradients |
137 * 8 colours per gradient from darkest (0) to lightest (7) |
112 * 8 colours per gradient from darkest (0) to lightest (7) |
138 */ |
113 */ |
139 VARDEF byte _colour_gradient[16][8]; |
114 VARDEF byte _colour_gradient[16][8]; |
140 |
115 |
141 VARDEF int _pal_first_dirty; |
|
142 VARDEF int _pal_last_dirty; |
|
143 |
|
144 VARDEF bool _use_dos_palette; |
116 VARDEF bool _use_dos_palette; |
145 |
|
146 typedef struct Colour { |
|
147 byte r; |
|
148 byte g; |
|
149 byte b; |
|
150 } Colour; |
|
151 |
|
152 extern Colour _cur_palette[256]; |
|
153 |
|
154 |
117 |
155 typedef enum StringColorFlags { |
118 typedef enum StringColorFlags { |
156 IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor |
119 IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor |
157 } StringColorFlags; |
120 } StringColorFlags; |
158 |
121 |