src/gfx.h
author belugas
Thu, 01 Mar 2007 01:24:44 +0000
changeset 6179 d19b0137d8e4
parent 6146 179f7480cf6b
child 6231 ff7454d35935
permissions -rw-r--r--
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2134
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2134
diff changeset
     2
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
     3
/** @file gfx.h */
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#ifndef GFX_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
#define GFX_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
     8
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
     9
enum WindowKeyCodes {
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    10
	WKC_SHIFT = 0x8000,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    11
	WKC_CTRL  = 0x4000,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    12
	WKC_ALT   = 0x2000,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    13
	WKC_META  = 0x1000,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    14
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    15
	/* Special ones */
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    16
	WKC_NONE        =  0,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    17
	WKC_ESC         =  1,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    18
	WKC_BACKSPACE   =  2,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    19
	WKC_INSERT      =  3,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    20
	WKC_DELETE      =  4,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    21
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    22
	WKC_PAGEUP      =  5,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    23
	WKC_PAGEDOWN    =  6,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    24
	WKC_END         =  7,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    25
	WKC_HOME        =  8,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    26
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    27
	/* Arrow keys */
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    28
	WKC_LEFT        =  9,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    29
	WKC_UP          = 10,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    30
	WKC_RIGHT       = 11,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    31
	WKC_DOWN        = 12,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    32
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    33
	/* Return & tab */
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    34
	WKC_RETURN      = 13,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    35
	WKC_TAB         = 14,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    36
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    37
	/* Numerical keyboard */
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    38
	WKC_NUM_0       = 16,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    39
	WKC_NUM_1       = 17,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    40
	WKC_NUM_2       = 18,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    41
	WKC_NUM_3       = 19,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    42
	WKC_NUM_4       = 20,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    43
	WKC_NUM_5       = 21,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    44
	WKC_NUM_6       = 22,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    45
	WKC_NUM_7       = 23,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    46
	WKC_NUM_8       = 24,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    47
	WKC_NUM_9       = 25,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    48
	WKC_NUM_DIV     = 26,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    49
	WKC_NUM_MUL     = 27,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    50
	WKC_NUM_MINUS   = 28,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    51
	WKC_NUM_PLUS    = 29,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    52
	WKC_NUM_ENTER   = 30,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    53
	WKC_NUM_DECIMAL = 31,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    54
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    55
	/* Space */
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    56
	WKC_SPACE       = 32,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    57
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    58
	/* Function keys */
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    59
	WKC_F1          = 33,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    60
	WKC_F2          = 34,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    61
	WKC_F3          = 35,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    62
	WKC_F4          = 36,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    63
	WKC_F5          = 37,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    64
	WKC_F6          = 38,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    65
	WKC_F7          = 39,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    66
	WKC_F8          = 40,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    67
	WKC_F9          = 41,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    68
	WKC_F10         = 42,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    69
	WKC_F11         = 43,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    70
	WKC_F12         = 44,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    71
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    72
	/* backquote is the key left of "1"
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    73
	 * we only store this key here, no matter what character is really mapped to it
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    74
	 * on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) */
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    75
	WKC_BACKQUOTE   = 45,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    76
	WKC_PAUSE       = 46,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    77
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    78
	/* 0-9 are mapped to 48-57
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    79
	 * A-Z are mapped to 65-90
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
    80
	 * a-z are mapped to 97-122 */
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    81
};
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    82
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    83
enum GameModes {
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    84
	GM_MENU,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    85
	GM_NORMAL,
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    86
	GM_EDITOR
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    87
};
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    88
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    89
void GameLoop(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    90
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    91
void CreateConsole(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    92
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    93
typedef int32 CursorID;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    94
typedef byte Pixel;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    95
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    96
typedef struct Point {
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    97
	int x,y;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    98
} Point;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
    99
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   100
typedef struct Rect {
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   101
	int left,top,right,bottom;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   102
} Rect;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   103
6138
f1196498ef66 (svn r8880) -Codechange: make anim cursors an array of structs.
rubidium
parents: 5941
diff changeset
   104
/** A single sprite of a list of animated cursors */
f1196498ef66 (svn r8880) -Codechange: make anim cursors an array of structs.
rubidium
parents: 5941
diff changeset
   105
struct AnimCursor {
6146
179f7480cf6b (svn r8889) -Fix (r8880): a CursorID is not a SpriteID.
rubidium
parents: 6138
diff changeset
   106
	static const CursorID LAST = MAX_UVALUE(CursorID);
6138
f1196498ef66 (svn r8880) -Codechange: make anim cursors an array of structs.
rubidium
parents: 5941
diff changeset
   107
	CursorID sprite;   ///< Must be set to LAST_ANIM when it is the last sprite of the loop
f1196498ef66 (svn r8880) -Codechange: make anim cursors an array of structs.
rubidium
parents: 5941
diff changeset
   108
	byte display_time; ///< Amount of ticks this sprite will be shown
f1196498ef66 (svn r8880) -Codechange: make anim cursors an array of structs.
rubidium
parents: 5941
diff changeset
   109
};
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   110
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   111
typedef struct CursorVars {
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   112
	Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   113
	Point draw_pos, draw_size;    ///< position and size bounding-box for drawing
5668
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5636
diff changeset
   114
	SpriteID sprite; ///< current image of cursor
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5636
diff changeset
   115
	SpriteID pal;
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   116
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   117
	int wheel;       ///< mouse wheel movement
6138
f1196498ef66 (svn r8880) -Codechange: make anim cursors an array of structs.
rubidium
parents: 5941
diff changeset
   118
	const AnimCursor *animate_list; ///< in case of animated cursor, list of frames
f1196498ef66 (svn r8880) -Codechange: make anim cursors an array of structs.
rubidium
parents: 5941
diff changeset
   119
	const AnimCursor *animate_cur;  ///< in case of animated cursor, current frame
f1196498ef66 (svn r8880) -Codechange: make anim cursors an array of structs.
rubidium
parents: 5941
diff changeset
   120
	uint animate_timeout;           ///< in case of animated cursor, number of ticks to show the current cursor
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   121
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   122
	bool visible;    ///< cursor is visible
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   123
	bool dirty;      ///< the rect occupied by the mouse is dirty (redraw)
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   124
	bool fix_at;     ///< mouse is moving, but cursor is not (used for scrolling)
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   125
	bool in_window;  ///< mouse inside this window, determines drawing logic
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   126
} CursorVars;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   127
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   128
typedef struct DrawPixelInfo {
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   129
	Pixel *dst_ptr;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   130
	int left, top, width, height;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   131
	int pitch;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   132
	uint16 zoom;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   133
} DrawPixelInfo;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   134
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   135
typedef struct Colour {
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   136
	byte r;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   137
	byte g;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   138
	byte b;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   139
} Colour;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   140
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   141
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   142
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
   143
extern byte _dirkeys;        ///< 1 = left, 2 = up, 4 = right, 8 = down
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   144
extern bool _fullscreen;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   145
extern CursorVars _cursor;
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
   146
extern bool _ctrl_pressed;   ///< Is Ctrl pressed?
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
   147
extern bool _shift_pressed;  ///< Is Shift pressed?
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   148
extern byte _fast_forward;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   149
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   150
extern bool _left_button_down;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   151
extern bool _left_button_clicked;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   152
extern bool _right_button_down;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   153
extern bool _right_button_clicked;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   154
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   155
extern DrawPixelInfo _screen;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   156
extern bool _exit_game;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   157
extern bool _networking;         ///< are we in networking mode?
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   158
extern byte _game_mode;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   159
extern byte _pause;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   160
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   161
extern int _pal_first_dirty;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   162
extern int _pal_last_dirty;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   163
extern int _num_resolutions;
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   164
extern uint16 _resolutions[32][2];
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   165
extern uint16 _cur_resolution[2];
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   166
extern Colour _cur_palette[256];
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   167
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   168
void HandleKeypress(uint32 key);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   169
void HandleMouseEvents(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   170
void CSleep(int milliseconds);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   171
void UpdateWindows(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   172
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
   173
uint32 InteractiveRandom(void); //< Used for random sequences that are not the same on the other end of the multiplayer link
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   174
uint InteractiveRandomRange(uint max);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   175
void DrawTextMessage(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   176
void DrawMouseCursor(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   177
void ScreenSizeChanged(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   178
void HandleExitGameRequest(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   179
void GameSizeChanged(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   180
void UndrawMouseCursor(void);
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   181
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   182
#include "helpers.hpp"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   183
3798
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   184
typedef enum FontSizes {
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   185
	FS_NORMAL,
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   186
	FS_SMALL,
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   187
	FS_LARGE,
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   188
	FS_END,
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   189
} FontSize;
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   190
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   191
DECLARE_POSTFIX_INCREMENT(FontSize);
3798
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   192
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
void RedrawScreenRect(int left, int top, int right, int bottom);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
2097
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   195
2406
8c873205483a (svn r2932) Give the strings consisting of an up/a down arrow symbolic names
tron
parents: 2187
diff changeset
   196
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
   197
/* XXX doesn't really belong here, but the only
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
   198
 * consumers always use it in conjunction with DoDrawString() */
5108
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4954
diff changeset
   199
#define UPARROW   "\xEE\x8A\x80"
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4954
diff changeset
   200
#define DOWNARROW "\xEE\x8A\xAA"
2406
8c873205483a (svn r2932) Give the strings consisting of an up/a down arrow symbolic names
tron
parents: 2187
diff changeset
   201
8c873205483a (svn r2932) Give the strings consisting of an up/a down arrow symbolic names
tron
parents: 2187
diff changeset
   202
2097
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   203
int DrawStringCentered(int x, int y, StringID str, uint16 color);
2113
be2f07df0dfa (svn r2623) - CodeChange: rework DrawStringCenteredTruncated() a bit. Instead of giving center + width you give the coordinates of the bounding box (left, right) it has to fit in (ludde)
Darkvater
parents: 2097
diff changeset
   204
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color);
2134
50fafe90c9f0 (svn r2644) - Fix: my name was mistyped ;p
Darkvater
parents: 2113
diff changeset
   205
int DoDrawStringCentered(int x, int y, const char *str, uint16 color);
2097
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   206
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   207
int DrawString(int x, int y, StringID str, uint16 color);
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   208
int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw);
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   209
1323
bac2e38e8b60 (svn r1827) Next iteration of the byte -> char transition: some string drawing functions and buffers
tron
parents: 1093
diff changeset
   210
int DoDrawString(const char *string, int x, int y, uint16 color);
2097
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   211
int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw);
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   212
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   213
void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color);
2113
be2f07df0dfa (svn r2623) - CodeChange: rework DrawStringCenteredTruncated() a bit. Instead of giving center + width you give the coordinates of the bounding box (left, right) it has to fit in (ludde)
Darkvater
parents: 2097
diff changeset
   214
void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color);
2097
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   215
4314
5c816195d9d4 (svn r5967) -Change: use right alignment for the year in the player's balance window instead of centering (about) 'string width' / 2 from the right edge
rubidium
parents: 3798
diff changeset
   216
int DrawStringRightAligned(int x, int y, StringID str, uint16 color);
2097
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   217
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw);
4314
5c816195d9d4 (svn r5967) -Change: use right alignment for the year in the player's balance window instead of centering (about) 'string width' / 2 from the right edge
rubidium
parents: 3798
diff changeset
   218
void DrawStringRightAlignedUnderline(int x, int y, StringID str, uint16 color);
2097
e95d19e1941f (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   219
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 0
diff changeset
   220
void GfxFillRect(int left, int top, int right, int bottom, int color);
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 0
diff changeset
   221
void GfxDrawLine(int left, int top, int right, int bottom, int color);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   222
4609
954fe701062f (svn r6462) -Codechange: Have GetStringWidth() return width as well as the height bounding
Darkvater
parents: 4444
diff changeset
   223
BoundingRect GetStringBoundingBox(const char *str);
4954
c1f059faa899 (svn r6953) -Codechange: Change FormatStringLinebreaks in such a way that if no whitespace was seen
Darkvater
parents: 4928
diff changeset
   224
uint32 FormatStringLinebreaks(char *str, int maxw);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   225
void LoadStringWidthTable(void);
2634
0df9396b0067 (svn r3176) Use proper types, not some variants of int
tron
parents: 2548
diff changeset
   226
void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
4928
ff53f78c5a87 (svn r6908) - Codechange: Modify DrawStringMultiLine() to return the number of pixel lines used, and use it for drawing NewGRF additional text (mart3p)
peter1138
parents: 4609
diff changeset
   227
uint DrawStringMultiLine(int x, int y, StringID str, int maxw);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   228
void DrawDirtyBlocks(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   229
void SetDirtyBlocks(int left, int top, int right, int bottom);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   230
void MarkWholeScreenDirty(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   231
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   232
void GfxInitPalettes(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
4429
b4eb6d97996f (svn r6184) Remove the unused (because it was NULL in all callers) second parameter of FillDrawPixelInfo() and simplify some expressions
tron
parents: 4428
diff changeset
   234
bool FillDrawPixelInfo(DrawPixelInfo* n, int left, int top, int width, int height);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   235
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
   236
/* window.cpp */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   239
void SetMouseCursor(CursorID cursor);
5668
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5636
diff changeset
   240
void SetMouseCursor(SpriteID sprite, SpriteID pal);
6138
f1196498ef66 (svn r8880) -Codechange: make anim cursors an array of structs.
rubidium
parents: 5941
diff changeset
   241
void SetAnimatedMouseCursor(const AnimCursor *table);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   242
void CursorTick(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   243
void DrawMouseCursor(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   244
void ScreenSizeChanged(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   245
void UndrawMouseCursor(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   246
bool ChangeResInGame(int w, int h);
1806
5a55d508c23e (svn r2310) - Fix: Game would crash if you full-screened with the 'fullscreen' button than chose a resolution from the dropdown box that was no longer valid. Big thanks to DaleStan for track down the crashing bug.
Darkvater
parents: 1391
diff changeset
   247
void SortResolutions(int count);
5941
adaea39e84ab (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5668
diff changeset
   248
void ToggleFullScreen(bool fs);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   249
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
   250
/* gfx.cpp */
1390
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1350
diff changeset
   251
#define ASCII_LETTERSTART 32
3798
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   252
extern FontSize _cur_fontsize;
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   253
5108
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4954
diff changeset
   254
byte GetCharacterWidth(FontSize size, uint32 key);
3798
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   255
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   256
static inline byte GetCharacterHeight(FontSize size)
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   257
{
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   258
	switch (size) {
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   259
		default: NOT_REACHED();
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   260
		case FS_NORMAL: return 10;
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   261
		case FS_SMALL:  return 6;
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   262
		case FS_LARGE:  return 18;
b1f5290b36b1 (svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents: 3312
diff changeset
   263
	}
1391
929b46b9e3cc (svn r1895) - Fix: add assert for charwidth getter just in case
Darkvater
parents: 1390
diff changeset
   264
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   265
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   266
VARDEF DrawPixelInfo *_cur_dpi;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   267
4444
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   268
enum {
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   269
	COLOUR_DARK_BLUE,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   270
	COLOUR_PALE_GREEN,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   271
	COLOUR_PINK,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   272
	COLOUR_YELLOW,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   273
	COLOUR_RED,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   274
	COLOUR_LIGHT_BLUE,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   275
	COLOUR_GREEN,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   276
	COLOUR_DARK_GREEN,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   277
	COLOUR_BLUE,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   278
	COLOUR_CREAM,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   279
	COLOUR_MAUVE,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   280
	COLOUR_PURPLE,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   281
	COLOUR_ORANGE,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   282
	COLOUR_BROWN,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   283
	COLOUR_GREY,
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   284
	COLOUR_WHITE
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   285
};
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   286
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   287
/**
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   288
 * All 16 colour gradients
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   289
 * 8 colours per gradient from darkest (0) to lightest (7)
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   290
 */
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   291
VARDEF byte _colour_gradient[16][8];
8d40844e6755 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   292
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 543
diff changeset
   293
VARDEF bool _use_dos_palette;
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 543
diff changeset
   294
657
d4d36b4853ec (svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents: 614
diff changeset
   295
typedef enum StringColorFlags {
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6146
diff changeset
   296
	IS_PALETTE_COLOR = 0x100, ///< color value is already a real palette color index, not an index of a StringColor
657
d4d36b4853ec (svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents: 614
diff changeset
   297
} StringColorFlags;
d4d36b4853ec (svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents: 614
diff changeset
   298
5636
3c19b56dc982 (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5587
diff changeset
   299
2649
1392cd1a60cc (svn r3191) Move declaration and definition of _dbg_screen_rect to a place where it somewhat makes sense and wrap them in #ifdef _DEBUG
tron
parents: 2634
diff changeset
   300
#ifdef _DEBUG
1392cd1a60cc (svn r3191) Move declaration and definition of _dbg_screen_rect to a place where it somewhat makes sense and wrap them in #ifdef _DEBUG
tron
parents: 2634
diff changeset
   301
extern bool _dbg_screen_rect;
1392cd1a60cc (svn r3191) Move declaration and definition of _dbg_screen_rect to a place where it somewhat makes sense and wrap them in #ifdef _DEBUG
tron
parents: 2634
diff changeset
   302
#endif
1392cd1a60cc (svn r3191) Move declaration and definition of _dbg_screen_rect to a place where it somewhat makes sense and wrap them in #ifdef _DEBUG
tron
parents: 2634
diff changeset
   303
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2407
diff changeset
   304
#endif /* GFX_H */