Files
@ r3016:b28a60dfd364
Branch filter:
Location: cpp/openttd-patchpack/source/gfx.h - annotation
r3016:b28a60dfd364
3.6 KiB
text/x-c
(svn r3596) -Codechange: [OSX] changed to use Apple's macros instead of OTTD macros for endian conversion
This increases the execution speed a lot since GCC can't detect the OTTD macro as an endian conversion
while Apple's code uses the instruction to convert endian instead of a series of instructions to produce the same result
Since we don't have that many endian conversions in the game, overall performance should not increase noteworthy
This increases the execution speed a lot since GCC can't detect the OTTD macro as an endian conversion
while Apple's code uses the instruction to convert endian instead of a series of instructions to produce the same result
Since we don't have that many endian conversions in the game, overall performance should not increase noteworthy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2062:c4c0326f1777 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2062:c4c0326f1777 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1914:63c34ade2fdf r0:d63b455452f6 r0:d63b455452f6 r1914:63c34ade2fdf r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2097:498a22d4bee9 r2406:ca53e91ceee1 r2406:ca53e91ceee1 r2406:ca53e91ceee1 r2407:bc0da484827c r2406:ca53e91ceee1 r2406:ca53e91ceee1 r2406:ca53e91ceee1 r2097:498a22d4bee9 r2113:600d6ea0d897 r2134:f272effb5e6e r2097:498a22d4bee9 r2097:498a22d4bee9 r2097:498a22d4bee9 r2097:498a22d4bee9 r1323:29249e0649f7 r2097:498a22d4bee9 r2097:498a22d4bee9 r2097:498a22d4bee9 r2113:600d6ea0d897 r2097:498a22d4bee9 r2097:498a22d4bee9 r2097:498a22d4bee9 r2097:498a22d4bee9 r193:6aa65dc5a4b4 r193:6aa65dc5a4b4 r0:d63b455452f6 r2436:963efe8b84cc r0:d63b455452f6 r1323:29249e0649f7 r1093:18f56ef2d029 r2634:a3ccca486bdf r2634:a3ccca486bdf r1093:18f56ef2d029 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r2548:9570bbbdacab r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1914:63c34ade2fdf r1093:18f56ef2d029 r1093:18f56ef2d029 r1093:18f56ef2d029 r1093:18f56ef2d029 r0:d63b455452f6 r1806:b8cc32d167b3 r1829:3dfbdb5a9e01 r0:d63b455452f6 r0:d63b455452f6 r1390:bd550d5f6790 r0:d63b455452f6 r0:d63b455452f6 r1391:4c60d2b628fd r1391:4c60d2b628fd r1391:4c60d2b628fd r1391:4c60d2b628fd r1391:4c60d2b628fd r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r614:5ada491fc357 r614:5ada491fc357 r1991:24313d1020cd r1991:24313d1020cd r1991:24313d1020cd r1991:24313d1020cd r1991:24313d1020cd r1991:24313d1020cd r1991:24313d1020cd r0:d63b455452f6 r657:a82164fd2bbd r657:a82164fd2bbd r657:a82164fd2bbd r657:a82164fd2bbd r657:a82164fd2bbd r2649:e3cea2f1dbaf r2649:e3cea2f1dbaf r2649:e3cea2f1dbaf r2649:e3cea2f1dbaf r2436:963efe8b84cc | /* $Id$ */
#ifndef GFX_H
#define GFX_H
typedef byte Pixel;
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 {
Pixel *dst_ptr;
int left, top, width, height;
int pitch;
uint16 zoom;
};
typedef struct CursorVars {
Point pos, size, offs, delta;
Point draw_pos, draw_size;
CursorID sprite;
int wheel; // mouse wheel movement
const CursorID *animate_list, *animate_cur;
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);
// XXX doesn't really belong here, but the only
// consumers always use it in conjunction with DoDrawString()
#define UPARROW "\x80"
#define DOWNARROW "\xAA"
int DrawStringCentered(int x, int y, StringID str, uint16 color);
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color);
int DoDrawStringCentered(int x, int y, const char *str, uint16 color);
int DrawString(int x, int y, StringID str, uint16 color);
int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw);
int DoDrawString(const char *string, int x, int y, uint16 color);
int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw);
void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color);
void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color);
void DrawStringRightAligned(int x, int y, StringID str, uint16 color);
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw);
void GfxFillRect(int left, int top, int right, int bottom, int color);
void GfxDrawLine(int left, int top, int right, int bottom, int color);
void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags);
uint16 GetDrawStringPlayerColor(PlayerID player);
int GetStringWidth(const char *str);
void LoadStringWidthTable(void);
void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
void DrawStringMultiLine(int x, int y, StringID str, int maxw);
void DrawDirtyBlocks(void);
void SetDirtyBlocks(int left, int top, int right, int bottom);
void MarkWholeScreenDirty(void);
void GfxInitPalettes(void);
bool FillDrawPixelInfo(DrawPixelInfo* n, const 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);
void SetAnimatedMouseCursor(const CursorID *table);
void CursorTick(void);
void DrawMouseCursor(void);
void ScreenSizeChanged(void);
void UndrawMouseCursor(void);
bool ChangeResInGame(int w, int h);
void SortResolutions(int count);
void ToggleFullScreen(bool fs);
/* gfx.c */
#define ASCII_LETTERSTART 32
VARDEF int _stringwidth_base;
VARDEF byte _stringwidth_table[0x2A0];
static inline byte GetCharacterWidth(uint key)
{
assert(key >= ASCII_LETTERSTART && key - ASCII_LETTERSTART < lengthof(_stringwidth_table));
return _stringwidth_table[key - ASCII_LETTERSTART];
}
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;
VARDEF bool _use_dos_palette;
typedef struct Colour {
byte r;
byte g;
byte b;
} Colour;
extern Colour _cur_palette[256];
typedef enum StringColorFlags {
IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor
} StringColorFlags;
#ifdef _DEBUG
extern bool _dbg_screen_rect;
#endif
#endif /* GFX_H */
|