author | bjarni |
Sat, 22 Jan 2005 23:55:45 +0000 | |
changeset 1099 | ad7522bd5c1c |
parent 1093 | 4fdc46eaf423 |
child 1323 | bac2e38e8b60 |
permissions | -rw-r--r-- |
0 | 1 |
#ifndef GFX_H |
2 |
#define GFX_H |
|
3 |
||
4 |
||
5 |
typedef struct ColorList { |
|
6 |
byte unk0, unk1, unk2; |
|
7 |
byte window_color_1a, window_color_1b; |
|
8 |
byte window_color_bga, window_color_bgb; |
|
9 |
byte window_color_2; |
|
10 |
} ColorList; |
|
11 |
||
12 |
struct DrawPixelInfo { |
|
13 |
byte *dst_ptr; |
|
14 |
int left, top, width, height; |
|
15 |
int pitch; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
0
diff
changeset
|
16 |
uint16 zoom; |
0 | 17 |
}; |
18 |
||
19 |
||
20 |
typedef struct SpriteHdr { |
|
21 |
byte info; |
|
22 |
byte height; |
|
23 |
uint16 width; |
|
24 |
int16 x_offs, y_offs; |
|
25 |
} SpriteHdr; |
|
26 |
assert_compile(sizeof(SpriteHdr) == 8); |
|
27 |
||
28 |
typedef struct CursorVars { |
|
29 |
Point pos, size, offs, delta; |
|
30 |
Point draw_pos, draw_size; |
|
31 |
uint32 sprite; |
|
32 |
||
33 |
int wheel; // mouse wheel movement |
|
34 |
const uint16 *animate_list, *animate_cur; |
|
35 |
uint animate_timeout; |
|
36 |
||
37 |
bool visible; |
|
38 |
bool dirty; |
|
39 |
bool fix_at; |
|
40 |
} CursorVars; |
|
41 |
||
42 |
||
43 |
void RedrawScreenRect(int left, int top, int right, int bottom); |
|
44 |
void GfxScroll(int left, int top, int width, int height, int xo, int yo); |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
298
diff
changeset
|
45 |
int DrawStringCentered(int x, int y, uint16 str, uint16 color); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
298
diff
changeset
|
46 |
int DrawString(int x, int y, uint16 str, uint16 color); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
298
diff
changeset
|
47 |
void DrawStringCenterUnderline(int x, int y, uint16 str, uint16 color); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
298
diff
changeset
|
48 |
int DoDrawString(const byte *string, int x, int y, uint16 color); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
298
diff
changeset
|
49 |
void DrawStringRightAligned(int x, int y, uint16 str, uint16 color); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
0
diff
changeset
|
50 |
void GfxFillRect(int left, int top, int right, int bottom, int color); |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
0
diff
changeset
|
51 |
void GfxDrawLine(int left, int top, int right, int bottom, int color); |
0 | 52 |
void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
298
diff
changeset
|
53 |
uint16 GetDrawStringPlayerColor(byte player); |
0 | 54 |
|
55 |
int GetStringWidth(const byte *str); |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
657
diff
changeset
|
56 |
void LoadStringWidthTable(void); |
0 | 57 |
void DrawStringMultiCenter(int x, int y, uint16 str, int maxw); |
58 |
void DrawStringMultiLine(int x, int y, uint16 str, int maxw); |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
657
diff
changeset
|
59 |
void DrawDirtyBlocks(void); |
0 | 60 |
void SetDirtyBlocks(int left, int top, int right, int bottom); |
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
657
diff
changeset
|
61 |
void MarkWholeScreenDirty(void); |
0 | 62 |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
657
diff
changeset
|
63 |
void GfxInitPalettes(void); |
0 | 64 |
|
65 |
bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, int width, int height); |
|
66 |
||
67 |
/* window.c */ |
|
68 |
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom); |
|
69 |
||
70 |
/* spritecache.c */ |
|
71 |
byte *GetSpritePtr(uint sprite); |
|
72 |
void GfxInitSpriteMem(byte *ptr, uint32 size); |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
657
diff
changeset
|
73 |
void GfxLoadSprites(void); |
0 | 74 |
|
75 |
void SetMouseCursor(uint cursor); |
|
76 |
void SetAnimatedMouseCursor(const uint16 *table); |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
657
diff
changeset
|
77 |
void CursorTick(void); |
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
657
diff
changeset
|
78 |
void DrawMouseCursor(void); |
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
657
diff
changeset
|
79 |
void ScreenSizeChanged(void); |
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
657
diff
changeset
|
80 |
void UndrawMouseCursor(void); |
0 | 81 |
bool ChangeResInGame(int w, int h); |
298
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
82 |
void ToggleFullScreen(const bool full_screen); |
0 | 83 |
|
84 |
typedef struct { |
|
85 |
int xoffs, yoffs; |
|
86 |
int xsize, ysize; |
|
87 |
} SpriteDimension; |
|
88 |
||
89 |
const SpriteDimension *GetSpriteDimension(uint sprite); |
|
90 |
||
91 |
/* gfx.c */ |
|
92 |
VARDEF int _stringwidth_base; |
|
93 |
VARDEF byte _stringwidth_table[0x2A0]; |
|
94 |
||
95 |
VARDEF DrawPixelInfo _screen; |
|
96 |
VARDEF DrawPixelInfo *_cur_dpi; |
|
97 |
VARDEF ColorList _color_list[16]; |
|
98 |
VARDEF CursorVars _cursor; |
|
99 |
||
100 |
VARDEF int _pal_first_dirty; |
|
101 |
VARDEF int _pal_last_dirty; |
|
102 |
||
614
b96f987dbf80
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
543
diff
changeset
|
103 |
VARDEF bool _use_dos_palette; |
b96f987dbf80
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
543
diff
changeset
|
104 |
|
0 | 105 |
/* spritecache.c */ |
106 |
//enum { NUM_SPRITES = 0x1320 }; |
|
107 |
//enum { NUM_SPRITES = 0x1500 }; |
|
108 |
enum { NUM_SPRITES = 0x3500 }; // 1500 + space for custom GRF sets |
|
109 |
||
110 |
/* tables.h */ |
|
111 |
extern byte _palettes[4][256 * 3]; |
|
112 |
VARDEF byte _cur_palette[768]; |
|
113 |
||
657
d4d36b4853ec
(svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents:
614
diff
changeset
|
114 |
|
d4d36b4853ec
(svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents:
614
diff
changeset
|
115 |
typedef enum StringColorFlags { |
d4d36b4853ec
(svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents:
614
diff
changeset
|
116 |
IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor |
d4d36b4853ec
(svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents:
614
diff
changeset
|
117 |
} StringColorFlags; |
d4d36b4853ec
(svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents:
614
diff
changeset
|
118 |
|
0 | 119 |
#endif |