truelight@0: #ifndef GFX_H truelight@0: #define GFX_H truelight@0: tron@2062: typedef byte Pixel; truelight@0: truelight@0: typedef struct ColorList { truelight@0: byte unk0, unk1, unk2; truelight@0: byte window_color_1a, window_color_1b; truelight@0: byte window_color_bga, window_color_bgb; truelight@0: byte window_color_2; truelight@0: } ColorList; truelight@0: truelight@0: struct DrawPixelInfo { tron@2062: Pixel *dst_ptr; truelight@0: int left, top, width, height; truelight@0: int pitch; truelight@193: uint16 zoom; truelight@0: }; truelight@0: truelight@0: truelight@0: typedef struct CursorVars { truelight@0: Point pos, size, offs, delta; truelight@0: Point draw_pos, draw_size; Darkvater@1914: CursorID sprite; truelight@0: truelight@0: int wheel; // mouse wheel movement Darkvater@1914: const CursorID *animate_list, *animate_cur; truelight@0: uint animate_timeout; truelight@0: truelight@0: bool visible; truelight@0: bool dirty; truelight@0: bool fix_at; truelight@0: } CursorVars; truelight@0: truelight@0: truelight@0: void RedrawScreenRect(int left, int top, int right, int bottom); truelight@0: void GfxScroll(int left, int top, int width, int height, int xo, int yo); truelight@543: int DrawStringCentered(int x, int y, uint16 str, uint16 color); truelight@543: int DrawString(int x, int y, uint16 str, uint16 color); truelight@543: void DrawStringCenterUnderline(int x, int y, uint16 str, uint16 color); tron@1323: int DoDrawString(const char *string, int x, int y, uint16 color); truelight@543: void DrawStringRightAligned(int x, int y, uint16 str, uint16 color); truelight@193: void GfxFillRect(int left, int top, int right, int bottom, int color); truelight@193: void GfxDrawLine(int left, int top, int right, int bottom, int color); truelight@0: void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags); truelight@543: uint16 GetDrawStringPlayerColor(byte player); truelight@0: tron@1323: int GetStringWidth(const char *str); tron@1093: void LoadStringWidthTable(void); truelight@0: void DrawStringMultiCenter(int x, int y, uint16 str, int maxw); truelight@0: void DrawStringMultiLine(int x, int y, uint16 str, int maxw); tron@1093: void DrawDirtyBlocks(void); truelight@0: void SetDirtyBlocks(int left, int top, int right, int bottom); tron@1093: void MarkWholeScreenDirty(void); truelight@0: tron@1093: void GfxInitPalettes(void); truelight@0: truelight@0: bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, int width, int height); truelight@0: truelight@0: /* window.c */ truelight@0: void DrawOverlappedWindowForAll(int left, int top, int right, int bottom); truelight@0: truelight@0: void SetMouseCursor(uint cursor); Darkvater@1914: void SetAnimatedMouseCursor(const CursorID *table); tron@1093: void CursorTick(void); tron@1093: void DrawMouseCursor(void); tron@1093: void ScreenSizeChanged(void); tron@1093: void UndrawMouseCursor(void); truelight@0: bool ChangeResInGame(int w, int h); Darkvater@1806: void SortResolutions(int count); Darkvater@1829: void ToggleFullScreen(bool fs); truelight@0: truelight@0: /* gfx.c */ Darkvater@1390: #define ASCII_LETTERSTART 32 truelight@0: VARDEF int _stringwidth_base; truelight@0: VARDEF byte _stringwidth_table[0x2A0]; Darkvater@1391: static inline byte GetCharacterWidth(uint key) Darkvater@1391: { Darkvater@1391: assert(key >= ASCII_LETTERSTART && key - ASCII_LETTERSTART < lengthof(_stringwidth_table)); Darkvater@1391: return _stringwidth_table[key - ASCII_LETTERSTART]; Darkvater@1391: } truelight@0: truelight@0: VARDEF DrawPixelInfo _screen; truelight@0: VARDEF DrawPixelInfo *_cur_dpi; truelight@0: VARDEF ColorList _color_list[16]; truelight@0: VARDEF CursorVars _cursor; truelight@0: truelight@0: VARDEF int _pal_first_dirty; truelight@0: VARDEF int _pal_last_dirty; truelight@0: dominik@614: VARDEF bool _use_dos_palette; dominik@614: truelight@0: /* spritecache.c */ truelight@0: //enum { NUM_SPRITES = 0x1320 }; truelight@0: //enum { NUM_SPRITES = 0x1500 }; truelight@0: enum { NUM_SPRITES = 0x3500 }; // 1500 + space for custom GRF sets truelight@0: tron@1991: typedef struct Colour { tron@1991: byte r; tron@1991: byte g; tron@1991: byte b; tron@1991: } Colour; tron@1991: tron@1991: extern Colour _cur_palette[256]; truelight@0: dominik@657: dominik@657: typedef enum StringColorFlags { dominik@657: IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor dominik@657: } StringColorFlags; dominik@657: truelight@0: #endif