File diff r6178:fc8bd2bde93a → r6179:c0508e7aefec
src/gfx.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file gfx.h */
 

	
 
#ifndef GFX_H
 
#define GFX_H
 

	
 

	
 
enum WindowKeyCodes {
 
	WKC_SHIFT = 0x8000,
 
	WKC_CTRL  = 0x4000,
 
	WKC_ALT   = 0x2000,
 
	WKC_META  = 0x1000,
 

	
 
	// Special ones
 
	/* Special ones */
 
	WKC_NONE        =  0,
 
	WKC_ESC         =  1,
 
	WKC_BACKSPACE   =  2,
 
	WKC_INSERT      =  3,
 
	WKC_DELETE      =  4,
 

	
 
	WKC_PAGEUP      =  5,
 
	WKC_PAGEDOWN    =  6,
 
	WKC_END         =  7,
 
	WKC_HOME        =  8,
 

	
 
	// Arrow keys
 
	/* Arrow keys */
 
	WKC_LEFT        =  9,
 
	WKC_UP          = 10,
 
	WKC_RIGHT       = 11,
 
	WKC_DOWN        = 12,
 

	
 
	// Return & tab
 
	/* Return & tab */
 
	WKC_RETURN      = 13,
 
	WKC_TAB         = 14,
 

	
 
	// Numerical keyboard
 
	/* Numerical keyboard */
 
	WKC_NUM_0       = 16,
 
	WKC_NUM_1       = 17,
 
	WKC_NUM_2       = 18,
 
	WKC_NUM_3       = 19,
 
	WKC_NUM_4       = 20,
 
	WKC_NUM_5       = 21,
 
@@ -47,16 +49,16 @@ enum WindowKeyCodes {
 
	WKC_NUM_MUL     = 27,
 
	WKC_NUM_MINUS   = 28,
 
	WKC_NUM_PLUS    = 29,
 
	WKC_NUM_ENTER   = 30,
 
	WKC_NUM_DECIMAL = 31,
 

	
 
	// Space
 
	/* Space */
 
	WKC_SPACE       = 32,
 

	
 
	// Function keys
 
	/* Function keys */
 
	WKC_F1          = 33,
 
	WKC_F2          = 34,
 
	WKC_F3          = 35,
 
	WKC_F4          = 36,
 
	WKC_F5          = 37,
 
	WKC_F6          = 38,
 
@@ -64,21 +66,21 @@ enum WindowKeyCodes {
 
	WKC_F8          = 40,
 
	WKC_F9          = 41,
 
	WKC_F10         = 42,
 
	WKC_F11         = 43,
 
	WKC_F12         = 44,
 

	
 
	// backquote is the key left of "1"
 
	// we only store this key here, no matter what character is really mapped to it
 
	// on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °)
 
	/* backquote is the key left of "1"
 
	 * we only store this key here, no matter what character is really mapped to it
 
	 * on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) */
 
	WKC_BACKQUOTE   = 45,
 
	WKC_PAUSE       = 46,
 

	
 
	// 0-9 are mapped to 48-57
 
	// A-Z are mapped to 65-90
 
	// a-z are mapped to 97-122
 
	/* 0-9 are mapped to 48-57
 
	 * A-Z are mapped to 65-90
 
	 * a-z are mapped to 97-122 */
 
};
 

	
 
enum GameModes {
 
	GM_MENU,
 
	GM_NORMAL,
 
	GM_EDITOR
 
@@ -135,17 +137,17 @@ typedef struct Colour {
 
	byte g;
 
	byte b;
 
} Colour;
 

	
 

	
 

	
 
extern byte _dirkeys;        // 1 = left, 2 = up, 4 = right, 8 = down
 
extern byte _dirkeys;        ///< 1 = left, 2 = up, 4 = right, 8 = down
 
extern bool _fullscreen;
 
extern CursorVars _cursor;
 
extern bool _ctrl_pressed;   // Is Ctrl pressed?
 
extern bool _shift_pressed;  // Is Shift pressed?
 
extern bool _ctrl_pressed;   ///< Is Ctrl pressed?
 
extern bool _shift_pressed;  ///< Is Shift pressed?
 
extern byte _fast_forward;
 

	
 
extern bool _left_button_down;
 
extern bool _left_button_clicked;
 
extern bool _right_button_down;
 
extern bool _right_button_clicked;
 
@@ -165,13 +167,13 @@ extern Colour _cur_palette[256];
 

	
 
void HandleKeypress(uint32 key);
 
void HandleMouseEvents(void);
 
void CSleep(int milliseconds);
 
void UpdateWindows(void);
 

	
 
uint32 InteractiveRandom(void); /* Used for random sequences that are not the same on the other end of the multiplayer link */
 
uint32 InteractiveRandom(void); //< Used for random sequences that are not the same on the other end of the multiplayer link
 
uint InteractiveRandomRange(uint max);
 
void DrawTextMessage(void);
 
void DrawMouseCursor(void);
 
void ScreenSizeChanged(void);
 
void HandleExitGameRequest(void);
 
void GameSizeChanged(void);
 
@@ -189,14 +191,14 @@ typedef enum FontSizes {
 
DECLARE_POSTFIX_INCREMENT(FontSize);
 

	
 
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()
 
/* XXX doesn't really belong here, but the only
 
 * consumers always use it in conjunction with DoDrawString() */
 
#define UPARROW   "\xEE\x8A\x80"
 
#define DOWNARROW "\xEE\x8A\xAA"
 

	
 

	
 
int DrawStringCentered(int x, int y, StringID str, uint16 color);
 
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color);
 
@@ -228,13 +230,13 @@ void SetDirtyBlocks(int left, int top, i
 
void MarkWholeScreenDirty(void);
 

	
 
void GfxInitPalettes(void);
 

	
 
bool FillDrawPixelInfo(DrawPixelInfo* n, int left, int top, int width, int height);
 

	
 
/* window.c */
 
/* window.cpp */
 
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
 

	
 
void SetMouseCursor(CursorID cursor);
 
void SetMouseCursor(SpriteID sprite, SpriteID pal);
 
void SetAnimatedMouseCursor(const AnimCursor *table);
 
void CursorTick(void);
 
@@ -242,13 +244,13 @@ 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 */
 
/* gfx.cpp */
 
#define ASCII_LETTERSTART 32
 
extern FontSize _cur_fontsize;
 

	
 
byte GetCharacterWidth(FontSize size, uint32 key);
 

	
 
static inline byte GetCharacterHeight(FontSize size)
 
@@ -288,13 +290,13 @@ enum {
 
 */
 
VARDEF byte _colour_gradient[16][8];
 

	
 
VARDEF bool _use_dos_palette;
 

	
 
typedef enum StringColorFlags {
 
	IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor
 
	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