tron@2186: /* $Id$ */ tron@2186: truelight@0: #ifndef GFX_H truelight@0: #define GFX_H truelight@0: celestar@5650: #include "helpers.hpp" truelight@0: peter1138@3798: typedef enum FontSizes { peter1138@3798: FS_NORMAL, peter1138@3798: FS_SMALL, peter1138@3798: FS_LARGE, peter1138@3798: FS_END, peter1138@3798: } FontSize; peter1138@3798: celestar@5650: DECLARE_POSTFIX_INCREMENT(FontSize); peter1138@3798: 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); Darkvater@2097: tron@2406: tron@2406: // XXX doesn't really belong here, but the only tron@2406: // consumers always use it in conjunction with DoDrawString() peter1138@5108: #define UPARROW "\xEE\x8A\x80" peter1138@5108: #define DOWNARROW "\xEE\x8A\xAA" tron@2406: tron@2406: Darkvater@2097: int DrawStringCentered(int x, int y, StringID str, uint16 color); Darkvater@2113: int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color); Darkvater@2134: int DoDrawStringCentered(int x, int y, const char *str, uint16 color); Darkvater@2097: Darkvater@2097: int DrawString(int x, int y, StringID str, uint16 color); Darkvater@2097: int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw); Darkvater@2097: tron@1323: int DoDrawString(const char *string, int x, int y, uint16 color); Darkvater@2097: int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw); Darkvater@2097: Darkvater@2097: void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color); Darkvater@2113: void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color); Darkvater@2097: rubidium@4314: int DrawStringRightAligned(int x, int y, StringID str, uint16 color); Darkvater@2097: void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw); rubidium@4314: void DrawStringRightAlignedUnderline(int x, int y, StringID str, uint16 color); Darkvater@2097: 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: Darkvater@4609: BoundingRect GetStringBoundingBox(const char *str); Darkvater@4954: uint32 FormatStringLinebreaks(char *str, int maxw); tron@1093: void LoadStringWidthTable(void); tron@2634: void DrawStringMultiCenter(int x, int y, StringID str, int maxw); peter1138@4928: uint DrawStringMultiLine(int x, int y, StringID 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: tron@4429: bool FillDrawPixelInfo(DrawPixelInfo* n, 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: celestar@5650: void SetMouseCursor(CursorID 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); celestar@5650: extern "C" void ToggleFullScreen(bool fs); truelight@0: truelight@0: /* gfx.c */ Darkvater@1390: #define ASCII_LETTERSTART 32 peter1138@3798: extern FontSize _cur_fontsize; peter1138@3798: peter1138@5108: byte GetCharacterWidth(FontSize size, uint32 key); peter1138@3798: peter1138@3798: static inline byte GetCharacterHeight(FontSize size) peter1138@3798: { peter1138@3798: switch (size) { peter1138@3798: default: NOT_REACHED(); peter1138@3798: case FS_NORMAL: return 10; peter1138@3798: case FS_SMALL: return 6; peter1138@3798: case FS_LARGE: return 18; peter1138@3798: } Darkvater@1391: } truelight@0: truelight@0: VARDEF DrawPixelInfo *_cur_dpi; truelight@0: tron@4444: enum { tron@4444: COLOUR_DARK_BLUE, tron@4444: COLOUR_PALE_GREEN, tron@4444: COLOUR_PINK, tron@4444: COLOUR_YELLOW, tron@4444: COLOUR_RED, tron@4444: COLOUR_LIGHT_BLUE, tron@4444: COLOUR_GREEN, tron@4444: COLOUR_DARK_GREEN, tron@4444: COLOUR_BLUE, tron@4444: COLOUR_CREAM, tron@4444: COLOUR_MAUVE, tron@4444: COLOUR_PURPLE, tron@4444: COLOUR_ORANGE, tron@4444: COLOUR_BROWN, tron@4444: COLOUR_GREY, tron@4444: COLOUR_WHITE tron@4444: }; tron@4444: tron@4444: /** tron@4444: * All 16 colour gradients tron@4444: * 8 colours per gradient from darkest (0) to lightest (7) tron@4444: */ tron@4444: VARDEF byte _colour_gradient[16][8]; tron@4444: dominik@614: VARDEF bool _use_dos_palette; dominik@614: 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: tron@2649: #ifdef _DEBUG tron@2649: extern bool _dbg_screen_rect; tron@2649: #endif tron@2649: Darkvater@2436: #endif /* GFX_H */