src/gfx.h
author KUDr
Sun, 18 Feb 2007 19:45:00 +0000
branchcpp_gui
changeset 6259 0f36789984b1
parent 6192 c6adfc929c6b
child 6268 4b5241e5dd10
permissions -rw-r--r--
(svn r8803) [cpp_gui] -Codechange: point structures (Point, Point16) made compatible
-PointT has now base PointRawT without constructor (plain struct compatible with unions)
-struct Point declared in gfx.h replaced by PointT<int>
-use of Point in WindowEvent::we union members replaced by PointRawT<int>
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2134
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2134
diff changeset
     2
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
#ifndef GFX_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     4
#define GFX_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
6259
0f36789984b1 (svn r8803) [cpp_gui] -Codechange: point structures (Point, Point16) made compatible
KUDr
parents: 6192
diff changeset
     6
#include "misc/rect.hpp"
5887
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
     7
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
     8
enum WindowKeyCodes {
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
     9
	WKC_SHIFT = 0x8000,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    10
	WKC_CTRL  = 0x4000,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    11
	WKC_ALT   = 0x2000,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    12
	WKC_META  = 0x1000,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    13
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    14
	// Special ones
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    15
	WKC_NONE        =  0,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    16
	WKC_ESC         =  1,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    17
	WKC_BACKSPACE   =  2,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    18
	WKC_INSERT      =  3,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    19
	WKC_DELETE      =  4,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    20
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    21
	WKC_PAGEUP      =  5,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    22
	WKC_PAGEDOWN    =  6,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    23
	WKC_END         =  7,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    24
	WKC_HOME        =  8,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    25
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    26
	// Arrow keys
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    27
	WKC_LEFT        =  9,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    28
	WKC_UP          = 10,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    29
	WKC_RIGHT       = 11,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    30
	WKC_DOWN        = 12,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    31
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    32
	// Return & tab
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    33
	WKC_RETURN      = 13,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    34
	WKC_TAB         = 14,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    35
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    36
	// Numerical keyboard
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    37
	WKC_NUM_0       = 16,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    38
	WKC_NUM_1       = 17,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    39
	WKC_NUM_2       = 18,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    40
	WKC_NUM_3       = 19,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    41
	WKC_NUM_4       = 20,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    42
	WKC_NUM_5       = 21,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    43
	WKC_NUM_6       = 22,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    44
	WKC_NUM_7       = 23,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    45
	WKC_NUM_8       = 24,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    46
	WKC_NUM_9       = 25,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    47
	WKC_NUM_DIV     = 26,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    48
	WKC_NUM_MUL     = 27,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    49
	WKC_NUM_MINUS   = 28,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    50
	WKC_NUM_PLUS    = 29,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    51
	WKC_NUM_ENTER   = 30,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    52
	WKC_NUM_DECIMAL = 31,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    53
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    54
	// Space
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    55
	WKC_SPACE       = 32,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    56
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    57
	// Function keys
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    58
	WKC_F1          = 33,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    59
	WKC_F2          = 34,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    60
	WKC_F3          = 35,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    61
	WKC_F4          = 36,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    62
	WKC_F5          = 37,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    63
	WKC_F6          = 38,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    64
	WKC_F7          = 39,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    65
	WKC_F8          = 40,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    66
	WKC_F9          = 41,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    67
	WKC_F10         = 42,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    68
	WKC_F11         = 43,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    69
	WKC_F12         = 44,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    70
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    71
	// backquote is the key left of "1"
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    72
	// we only store this key here, no matter what character is really mapped to it
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    73
	// on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °)
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    74
	WKC_BACKQUOTE   = 45,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    75
	WKC_PAUSE       = 46,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    76
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    77
	// 0-9 are mapped to 48-57
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    78
	// A-Z are mapped to 65-90
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    79
	// a-z are mapped to 97-122
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    80
};
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    81
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    82
enum GameModes {
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    83
	GM_MENU,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    84
	GM_NORMAL,
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    85
	GM_EDITOR
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    86
};
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    87
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    88
void GameLoop(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    89
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    90
void CreateConsole(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    91
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    92
typedef int32 CursorID;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    93
typedef byte Pixel;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    94
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    95
typedef struct Rect {
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    96
	int left,top,right,bottom;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    97
} Rect;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    98
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
    99
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   100
typedef struct CursorVars {
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   101
	Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   102
	Point draw_pos, draw_size;    ///< position and size bounding-box for drawing
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5887
diff changeset
   103
	SpriteID sprite; ///< current image of cursor
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5887
diff changeset
   104
	SpriteID pal;
5887
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   105
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   106
	int wheel;       ///< mouse wheel movement
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   107
	const CursorID *animate_list, *animate_cur; ///< in case of animated cursor, list of frames
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   108
	uint animate_timeout;                       ///< current frame in list of animated cursor
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   109
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   110
	bool visible;    ///< cursor is visible
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   111
	bool dirty;      ///< the rect occupied by the mouse is dirty (redraw)
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   112
	bool fix_at;     ///< mouse is moving, but cursor is not (used for scrolling)
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   113
	bool in_window;  ///< mouse inside this window, determines drawing logic
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   114
} CursorVars;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   115
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   116
typedef struct DrawPixelInfo {
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   117
	Pixel *dst_ptr;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   118
	int left, top, width, height;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   119
	int pitch;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   120
	uint16 zoom;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   121
} DrawPixelInfo;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   122
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   123
typedef struct Colour {
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   124
	byte r;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   125
	byte g;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   126
	byte b;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   127
} Colour;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   128
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   129
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   130
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   131
extern byte _dirkeys;        // 1 = left, 2 = up, 4 = right, 8 = down
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   132
extern bool _fullscreen;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   133
extern CursorVars _cursor;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   134
extern bool _ctrl_pressed;   // Is Ctrl pressed?
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   135
extern bool _shift_pressed;  // Is Shift pressed?
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   136
extern byte _fast_forward;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   137
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   138
extern bool _left_button_down;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   139
extern bool _left_button_clicked;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   140
extern bool _right_button_down;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   141
extern bool _right_button_clicked;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   142
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   143
extern DrawPixelInfo _screen;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   144
extern bool _exit_game;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   145
extern bool _networking;         ///< are we in networking mode?
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   146
extern byte _game_mode;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   147
extern byte _pause;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   148
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   149
extern int _pal_first_dirty;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   150
extern int _pal_last_dirty;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   151
extern int _num_resolutions;
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   152
extern uint16 _resolutions[32][2];
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   153
extern uint16 _cur_resolution[2];
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   154
extern Colour _cur_palette[256];
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   155
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   156
void HandleKeypress(uint32 key);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   157
void HandleMouseEvents(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   158
void CSleep(int milliseconds);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   159
void UpdateWindows(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   160
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   161
uint32 InteractiveRandom(void); /* Used for random sequences that are not the same on the other end of the multiplayer link */
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   162
uint InteractiveRandomRange(uint max);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   163
void DrawTextMessage(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   164
void DrawMouseCursor(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   165
void ScreenSizeChanged(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   166
void HandleExitGameRequest(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   167
void GameSizeChanged(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   168
void UndrawMouseCursor(void);
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   169
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   170
#include "helpers.hpp"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
3798
37a2090eac94 (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
   172
typedef enum FontSizes {
37a2090eac94 (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
   173
	FS_NORMAL,
37a2090eac94 (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
   174
	FS_SMALL,
37a2090eac94 (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
   175
	FS_LARGE,
37a2090eac94 (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
   176
	FS_END,
37a2090eac94 (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
   177
} FontSize;
37a2090eac94 (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
   178
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   179
DECLARE_POSTFIX_INCREMENT(FontSize);
3798
37a2090eac94 (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
   180
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
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
   182
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
2097
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   183
2406
be5cfb8cd20d (svn r2932) Give the strings consisting of an up/a down arrow symbolic names
tron
parents: 2187
diff changeset
   184
be5cfb8cd20d (svn r2932) Give the strings consisting of an up/a down arrow symbolic names
tron
parents: 2187
diff changeset
   185
// XXX doesn't really belong here, but the only
be5cfb8cd20d (svn r2932) Give the strings consisting of an up/a down arrow symbolic names
tron
parents: 2187
diff changeset
   186
// consumers always use it in conjunction with DoDrawString()
5108
dc67d70b5a45 (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
   187
#define UPARROW   "\xEE\x8A\x80"
dc67d70b5a45 (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
   188
#define DOWNARROW "\xEE\x8A\xAA"
2406
be5cfb8cd20d (svn r2932) Give the strings consisting of an up/a down arrow symbolic names
tron
parents: 2187
diff changeset
   189
be5cfb8cd20d (svn r2932) Give the strings consisting of an up/a down arrow symbolic names
tron
parents: 2187
diff changeset
   190
2097
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   191
int DrawStringCentered(int x, int y, StringID str, uint16 color);
2113
f228b399da01 (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
   192
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color);
2134
7192d5266a96 (svn r2644) - Fix: my name was mistyped ;p
Darkvater
parents: 2113
diff changeset
   193
int DoDrawStringCentered(int x, int y, const char *str, uint16 color);
2097
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   194
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   195
int DrawString(int x, int y, StringID str, uint16 color);
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   196
int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw);
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   197
1323
41397685320a (svn r1827) Next iteration of the byte -> char transition: some string drawing functions and buffers
tron
parents: 1093
diff changeset
   198
int DoDrawString(const char *string, int x, int y, uint16 color);
2097
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   199
int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw);
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   200
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   201
void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color);
2113
f228b399da01 (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
   202
void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color);
2097
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   203
4314
c7ded7546e7f (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
   204
int DrawStringRightAligned(int x, int y, StringID str, uint16 color);
2097
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   205
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw);
4314
c7ded7546e7f (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
   206
void DrawStringRightAlignedUnderline(int x, int y, StringID str, uint16 color);
2097
82b1e11883fd (svn r2607) - Feature: add support for truncating strings to a given (pixel) length. Function courtesy of Ludde.
Darkvater
parents: 2062
diff changeset
   207
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 0
diff changeset
   208
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
   209
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
   210
4609
6c337b3fbf4b (svn r6462) -Codechange: Have GetStringWidth() return width as well as the height bounding
Darkvater
parents: 4444
diff changeset
   211
BoundingRect GetStringBoundingBox(const char *str);
4954
d773d01b35f5 (svn r6953) -Codechange: Change FormatStringLinebreaks in such a way that if no whitespace was seen
Darkvater
parents: 4928
diff changeset
   212
uint32 FormatStringLinebreaks(char *str, int maxw);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   213
void LoadStringWidthTable(void);
2634
16334e1a4862 (svn r3176) Use proper types, not some variants of int
tron
parents: 2548
diff changeset
   214
void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
4928
4cdb51b5db7b (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
   215
uint DrawStringMultiLine(int x, int y, StringID str, int maxw);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   216
void DrawDirtyBlocks(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   217
void SetDirtyBlocks(int left, int top, int right, int bottom);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   218
void MarkWholeScreenDirty(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   219
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   220
void GfxInitPalettes(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   221
4429
1bb01569940c (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
   222
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
   223
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   224
/* window.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   225
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
   226
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   227
void SetMouseCursor(CursorID cursor);
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5887
diff changeset
   228
void SetMouseCursor(SpriteID sprite, SpriteID pal);
1914
5ede46fd496f (svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents: 1829
diff changeset
   229
void SetAnimatedMouseCursor(const CursorID *table);
1093
e8d26c7dc42f (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 CursorTick(void);
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   231
void DrawMouseCursor(void);
e8d26c7dc42f (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 ScreenSizeChanged(void);
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 657
diff changeset
   233
void UndrawMouseCursor(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
bool ChangeResInGame(int w, int h);
1806
75dc9c737892 (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
   235
void SortResolutions(int count);
6192
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5919
diff changeset
   236
void ToggleFullScreen(bool fs);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
/* gfx.c */
1390
53a5713cf3f9 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1350
diff changeset
   239
#define ASCII_LETTERSTART 32
3798
37a2090eac94 (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
   240
extern FontSize _cur_fontsize;
37a2090eac94 (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
   241
5108
dc67d70b5a45 (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
   242
byte GetCharacterWidth(FontSize size, uint32 key);
3798
37a2090eac94 (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
   243
37a2090eac94 (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
   244
static inline byte GetCharacterHeight(FontSize size)
37a2090eac94 (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
   245
{
37a2090eac94 (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
   246
	switch (size) {
37a2090eac94 (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
   247
		default: NOT_REACHED();
37a2090eac94 (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
   248
		case FS_NORMAL: return 10;
37a2090eac94 (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
   249
		case FS_SMALL:  return 6;
37a2090eac94 (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
   250
		case FS_LARGE:  return 18;
37a2090eac94 (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
   251
	}
1391
1325047def14 (svn r1895) - Fix: add assert for charwidth getter just in case
Darkvater
parents: 1390
diff changeset
   252
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   253
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   254
VARDEF DrawPixelInfo *_cur_dpi;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   255
4444
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   256
enum {
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   257
	COLOUR_DARK_BLUE,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   258
	COLOUR_PALE_GREEN,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   259
	COLOUR_PINK,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   260
	COLOUR_YELLOW,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   261
	COLOUR_RED,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   262
	COLOUR_LIGHT_BLUE,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   263
	COLOUR_GREEN,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   264
	COLOUR_DARK_GREEN,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   265
	COLOUR_BLUE,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   266
	COLOUR_CREAM,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   267
	COLOUR_MAUVE,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   268
	COLOUR_PURPLE,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   269
	COLOUR_ORANGE,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   270
	COLOUR_BROWN,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   271
	COLOUR_GREY,
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   272
	COLOUR_WHITE
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   273
};
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   274
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   275
/**
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   276
 * All 16 colour gradients
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   277
 * 8 colours per gradient from darkest (0) to lightest (7)
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   278
 */
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   279
VARDEF byte _colour_gradient[16][8];
9c9c7f962482 (svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents: 4437
diff changeset
   280
614
e016770cb781 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 543
diff changeset
   281
VARDEF bool _use_dos_palette;
e016770cb781 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 543
diff changeset
   282
657
40a9032b454b (svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents: 614
diff changeset
   283
typedef enum StringColorFlags {
40a9032b454b (svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents: 614
diff changeset
   284
	IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor
40a9032b454b (svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents: 614
diff changeset
   285
} StringColorFlags;
40a9032b454b (svn r1091) Fix: Finally station names use 100% the correct color in transparent mode
dominik
parents: 614
diff changeset
   286
5887
063ca43b682c (svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents: 5838
diff changeset
   287
2649
7cd504bd4e51 (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
   288
#ifdef _DEBUG
7cd504bd4e51 (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
   289
extern bool _dbg_screen_rect;
7cd504bd4e51 (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
   290
#endif
7cd504bd4e51 (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
   291
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2407
diff changeset
   292
#endif /* GFX_H */