2004-08-09 17:04:08 +00:00
|
|
|
#ifndef GFX_H
|
|
|
|
#define GFX_H
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct ColorList {
|
|
|
|
byte unk0, unk1, unk2;
|
|
|
|
byte window_color_1a, window_color_1b;
|
|
|
|
byte window_color_bga, window_color_bgb;
|
|
|
|
byte window_color_2;
|
|
|
|
} ColorList;
|
|
|
|
|
|
|
|
struct DrawPixelInfo {
|
|
|
|
byte *dst_ptr;
|
|
|
|
int left, top, width, height;
|
|
|
|
int pitch;
|
2004-09-10 19:02:27 +00:00
|
|
|
uint16 zoom;
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct CursorVars {
|
|
|
|
Point pos, size, offs, delta;
|
|
|
|
Point draw_pos, draw_size;
|
2005-06-06 13:47:06 +00:00
|
|
|
CursorID sprite;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
int wheel; // mouse wheel movement
|
2005-06-06 13:47:06 +00:00
|
|
|
const CursorID *animate_list, *animate_cur;
|
2004-08-09 17:04:08 +00:00
|
|
|
uint animate_timeout;
|
|
|
|
|
|
|
|
bool visible;
|
|
|
|
bool dirty;
|
|
|
|
bool fix_at;
|
|
|
|
} CursorVars;
|
|
|
|
|
|
|
|
|
|
|
|
void RedrawScreenRect(int left, int top, int right, int bottom);
|
|
|
|
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
|
2004-12-04 17:54:56 +00:00
|
|
|
int DrawStringCentered(int x, int y, uint16 str, uint16 color);
|
|
|
|
int DrawString(int x, int y, uint16 str, uint16 color);
|
|
|
|
void DrawStringCenterUnderline(int x, int y, uint16 str, uint16 color);
|
2005-02-06 18:30:45 +00:00
|
|
|
int DoDrawString(const char *string, int x, int y, uint16 color);
|
2004-12-04 17:54:56 +00:00
|
|
|
void DrawStringRightAligned(int x, int y, uint16 str, uint16 color);
|
2004-09-10 19:02:27 +00:00
|
|
|
void GfxFillRect(int left, int top, int right, int bottom, int color);
|
|
|
|
void GfxDrawLine(int left, int top, int right, int bottom, int color);
|
2004-08-09 17:04:08 +00:00
|
|
|
void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags);
|
2004-12-04 17:54:56 +00:00
|
|
|
uint16 GetDrawStringPlayerColor(byte player);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-02-06 18:30:45 +00:00
|
|
|
int GetStringWidth(const char *str);
|
2005-01-22 20:23:18 +00:00
|
|
|
void LoadStringWidthTable(void);
|
2004-08-09 17:04:08 +00:00
|
|
|
void DrawStringMultiCenter(int x, int y, uint16 str, int maxw);
|
|
|
|
void DrawStringMultiLine(int x, int y, uint16 str, int maxw);
|
2005-01-22 20:23:18 +00:00
|
|
|
void DrawDirtyBlocks(void);
|
2004-08-09 17:04:08 +00:00
|
|
|
void SetDirtyBlocks(int left, int top, int right, int bottom);
|
2005-01-22 20:23:18 +00:00
|
|
|
void MarkWholeScreenDirty(void);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-01-22 20:23:18 +00:00
|
|
|
void GfxInitPalettes(void);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, int width, int height);
|
|
|
|
|
|
|
|
/* window.c */
|
|
|
|
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
|
|
|
|
|
|
|
|
void SetMouseCursor(uint cursor);
|
2005-06-06 13:47:06 +00:00
|
|
|
void SetAnimatedMouseCursor(const CursorID *table);
|
2005-01-22 20:23:18 +00:00
|
|
|
void CursorTick(void);
|
|
|
|
void DrawMouseCursor(void);
|
|
|
|
void ScreenSizeChanged(void);
|
|
|
|
void UndrawMouseCursor(void);
|
2004-08-09 17:04:08 +00:00
|
|
|
bool ChangeResInGame(int w, int h);
|
2005-05-14 21:01:57 +00:00
|
|
|
void SortResolutions(int count);
|
2005-05-16 16:19:32 +00:00
|
|
|
void ToggleFullScreen(bool fs);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
/* gfx.c */
|
2005-02-21 18:59:54 +00:00
|
|
|
#define ASCII_LETTERSTART 32
|
2004-08-09 17:04:08 +00:00
|
|
|
VARDEF int _stringwidth_base;
|
|
|
|
VARDEF byte _stringwidth_table[0x2A0];
|
2005-02-21 19:14:16 +00:00
|
|
|
static inline byte GetCharacterWidth(uint key)
|
|
|
|
{
|
|
|
|
assert(key >= ASCII_LETTERSTART && key - ASCII_LETTERSTART < lengthof(_stringwidth_table));
|
|
|
|
return _stringwidth_table[key - ASCII_LETTERSTART];
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
VARDEF DrawPixelInfo _screen;
|
|
|
|
VARDEF DrawPixelInfo *_cur_dpi;
|
|
|
|
VARDEF ColorList _color_list[16];
|
|
|
|
VARDEF CursorVars _cursor;
|
|
|
|
|
|
|
|
VARDEF int _pal_first_dirty;
|
|
|
|
VARDEF int _pal_last_dirty;
|
|
|
|
|
2004-12-12 20:36:24 +00:00
|
|
|
VARDEF bool _use_dos_palette;
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
/* spritecache.c */
|
|
|
|
//enum { NUM_SPRITES = 0x1320 };
|
|
|
|
//enum { NUM_SPRITES = 0x1500 };
|
|
|
|
enum { NUM_SPRITES = 0x3500 }; // 1500 + space for custom GRF sets
|
|
|
|
|
|
|
|
/* tables.h */
|
|
|
|
extern byte _palettes[4][256 * 3];
|
|
|
|
VARDEF byte _cur_palette[768];
|
|
|
|
|
2004-12-14 20:54:01 +00:00
|
|
|
|
|
|
|
typedef enum StringColorFlags {
|
|
|
|
IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor
|
|
|
|
} StringColorFlags;
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
#endif
|