src/gfx_type.h
author smatz
Wed, 18 Jun 2008 21:19:04 +0000
changeset 9551 6f60dca6c566
parent 9044 d01d22d12fce
child 9597 825e5483799b
permissions -rw-r--r--
(svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     1
/* $Id$ */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     2
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     3
/** @file gfx_type.h Types related to the graphics and/or input devices. */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     4
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     5
#ifndef GFX_TYPE_H
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     6
#define GFX_TYPE_H
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     7
9551
6f60dca6c566 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz
parents: 9044
diff changeset
     8
#include "core/endian_type.hpp"
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     9
#include "core/enum_type.hpp"
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    10
#include "core/geometry_type.hpp"
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    11
#include "zoom_type.h"
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    12
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    13
typedef uint32 SpriteID;      ///< The number of a sprite, without mapping bits and colortables
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    14
struct PalSpriteID {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    15
	SpriteID sprite;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    16
	SpriteID pal;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    17
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    18
typedef int32 CursorID;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    19
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    20
enum WindowKeyCodes {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    21
	WKC_SHIFT = 0x8000,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    22
	WKC_CTRL  = 0x4000,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    23
	WKC_ALT   = 0x2000,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    24
	WKC_META  = 0x1000,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    25
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    26
	/* Special ones */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    27
	WKC_NONE        =  0,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    28
	WKC_ESC         =  1,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    29
	WKC_BACKSPACE   =  2,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    30
	WKC_INSERT      =  3,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    31
	WKC_DELETE      =  4,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    32
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    33
	WKC_PAGEUP      =  5,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    34
	WKC_PAGEDOWN    =  6,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    35
	WKC_END         =  7,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    36
	WKC_HOME        =  8,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    37
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    38
	/* Arrow keys */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    39
	WKC_LEFT        =  9,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    40
	WKC_UP          = 10,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    41
	WKC_RIGHT       = 11,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    42
	WKC_DOWN        = 12,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    43
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    44
	/* Return & tab */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    45
	WKC_RETURN      = 13,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    46
	WKC_TAB         = 14,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    47
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    48
	/* Space */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    49
	WKC_SPACE       = 32,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    50
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    51
	/* Function keys */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    52
	WKC_F1          = 33,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    53
	WKC_F2          = 34,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    54
	WKC_F3          = 35,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    55
	WKC_F4          = 36,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    56
	WKC_F5          = 37,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    57
	WKC_F6          = 38,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    58
	WKC_F7          = 39,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    59
	WKC_F8          = 40,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    60
	WKC_F9          = 41,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    61
	WKC_F10         = 42,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    62
	WKC_F11         = 43,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    63
	WKC_F12         = 44,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    64
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    65
	/* Backquote is the key left of "1"
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    66
	 * we only store this key here, no matter what character is really mapped to it
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    67
	 * on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    68
	WKC_BACKQUOTE   = 45,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    69
	WKC_PAUSE       = 46,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    70
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    71
	/* 0-9 are mapped to 48-57
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    72
	 * A-Z are mapped to 65-90
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    73
	 * a-z are mapped to 97-122 */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    74
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    75
	/* Numerical keyboard */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    76
	WKC_NUM_0       = 128,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    77
	WKC_NUM_1       = 129,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    78
	WKC_NUM_2       = 130,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    79
	WKC_NUM_3       = 131,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    80
	WKC_NUM_4       = 132,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    81
	WKC_NUM_5       = 133,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    82
	WKC_NUM_6       = 134,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    83
	WKC_NUM_7       = 135,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    84
	WKC_NUM_8       = 136,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    85
	WKC_NUM_9       = 137,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    86
	WKC_NUM_DIV     = 138,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    87
	WKC_NUM_MUL     = 139,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    88
	WKC_NUM_MINUS   = 140,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    89
	WKC_NUM_PLUS    = 141,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    90
	WKC_NUM_ENTER   = 142,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    91
	WKC_NUM_DECIMAL = 143,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    92
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    93
	/* Other keys */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    94
	WKC_SLASH       = 144, ///< / Forward slash
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    95
	WKC_SEMICOLON   = 145, ///< ; Semicolon
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    96
	WKC_EQUALS      = 146, ///< = Equals
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    97
	WKC_L_BRACKET   = 147, ///< [ Left square bracket
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    98
	WKC_BACKSLASH   = 148, ///< \ Backslash
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    99
	WKC_R_BRACKET   = 149, ///< ] Right square bracket
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   100
	WKC_SINGLEQUOTE = 150, ///< ' Single quote
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   101
	WKC_COMMA       = 151, ///< , Comma
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   102
	WKC_PERIOD      = 152, ///< . Period
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   103
	WKC_MINUS       = 153, ///< - Minus
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   104
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   105
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   106
/** A single sprite of a list of animated cursors */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   107
struct AnimCursor {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   108
	static const CursorID LAST = MAX_UVALUE(CursorID);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   109
	CursorID sprite;   ///< Must be set to LAST_ANIM when it is the last sprite of the loop
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   110
	byte display_time; ///< Amount of ticks this sprite will be shown
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   111
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   112
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   113
struct CursorVars {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   114
	Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   115
	Point draw_pos, draw_size;    ///< position and size bounding-box for drawing
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   116
	SpriteID sprite; ///< current image of cursor
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   117
	SpriteID pal;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   118
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   119
	int wheel;       ///< mouse wheel movement
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   120
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   121
	/* We need two different vars to keep track of how far the scrollwheel moved.
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   122
	 * OSX uses this for scrolling around the map. */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   123
	int v_wheel;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   124
	int h_wheel;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   125
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   126
	const AnimCursor *animate_list; ///< in case of animated cursor, list of frames
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   127
	const AnimCursor *animate_cur;  ///< in case of animated cursor, current frame
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   128
	uint animate_timeout;           ///< in case of animated cursor, number of ticks to show the current cursor
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   129
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   130
	bool visible;    ///< cursor is visible
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   131
	bool dirty;      ///< the rect occupied by the mouse is dirty (redraw)
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   132
	bool fix_at;     ///< mouse is moving, but cursor is not (used for scrolling)
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   133
	bool in_window;  ///< mouse inside this window, determines drawing logic
8828
28784a133c57 (svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents: 8123
diff changeset
   134
28784a133c57 (svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents: 8123
diff changeset
   135
	bool vehchain;   ///< vehicle chain is dragged
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   136
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   137
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   138
struct DrawPixelInfo {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   139
	void *dst_ptr;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   140
	int left, top, width, height;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   141
	int pitch;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   142
	ZoomLevel zoom;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   143
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   144
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   145
struct Colour {
9551
6f60dca6c566 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz
parents: 9044
diff changeset
   146
#if TTD_ENDIAN == TTD_BIG_ENDIAN
6f60dca6c566 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz
parents: 9044
diff changeset
   147
	uint8 a, r, g, b; ///< colour channels in BE order
6f60dca6c566 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz
parents: 9044
diff changeset
   148
#else
6f60dca6c566 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz
parents: 9044
diff changeset
   149
	uint8 b, g, r, a; ///< colour channels in LE order
6f60dca6c566 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz
parents: 9044
diff changeset
   150
#endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
6f60dca6c566 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz
parents: 9044
diff changeset
   151
6f60dca6c566 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz
parents: 9044
diff changeset
   152
	operator uint32 () { return *(uint32 *)this; }
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   153
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   154
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   155
enum FontSize {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   156
	FS_NORMAL,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   157
	FS_SMALL,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   158
	FS_LARGE,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   159
	FS_END,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   160
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   161
DECLARE_POSTFIX_INCREMENT(FontSize);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   162
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   163
/**
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   164
 * Used to only draw a part of the sprite.
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   165
 * Draw the subsprite in the rect (sprite_x_offset + left, sprite_y_offset + top) to (sprite_x_offset + right, sprite_y_offset + bottom).
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   166
 * Both corners are included in the drawing area.
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   167
 */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   168
struct SubSprite {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   169
	int left, top, right, bottom;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   170
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   171
9044
d01d22d12fce (svn r12863) -Codechange: rewrite GeneratePlayerColour to be better understandable.
rubidium
parents: 8828
diff changeset
   172
enum Colours {
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   173
	COLOUR_DARK_BLUE,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   174
	COLOUR_PALE_GREEN,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   175
	COLOUR_PINK,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   176
	COLOUR_YELLOW,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   177
	COLOUR_RED,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   178
	COLOUR_LIGHT_BLUE,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   179
	COLOUR_GREEN,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   180
	COLOUR_DARK_GREEN,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   181
	COLOUR_BLUE,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   182
	COLOUR_CREAM,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   183
	COLOUR_MAUVE,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   184
	COLOUR_PURPLE,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   185
	COLOUR_ORANGE,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   186
	COLOUR_BROWN,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   187
	COLOUR_GREY,
9044
d01d22d12fce (svn r12863) -Codechange: rewrite GeneratePlayerColour to be better understandable.
rubidium
parents: 8828
diff changeset
   188
	COLOUR_WHITE,
d01d22d12fce (svn r12863) -Codechange: rewrite GeneratePlayerColour to be better understandable.
rubidium
parents: 8828
diff changeset
   189
	COLOUR_END,
d01d22d12fce (svn r12863) -Codechange: rewrite GeneratePlayerColour to be better understandable.
rubidium
parents: 8828
diff changeset
   190
	INVALID_COLOUR = 0xFF
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   191
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   192
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   193
/** Colour of the strings, see _string_colormap in table/palettes.h or docs/ottd-colourtext-palette.png */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   194
enum TextColour {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   195
	TC_FROMSTRING  = 0x00,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   196
	TC_BLUE        = 0x00,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   197
	TC_SILVER      = 0x01,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   198
	TC_GOLD        = 0x02,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   199
	TC_RED         = 0x03,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   200
	TC_PURPLE      = 0x04,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   201
	TC_LIGHT_BROWN = 0x05,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   202
	TC_ORANGE      = 0x06,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   203
	TC_GREEN       = 0x07,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   204
	TC_YELLOW      = 0x08,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   205
	TC_DARK_GREEN  = 0x09,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   206
	TC_CREAM       = 0x0A,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   207
	TC_BROWN       = 0x0B,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   208
	TC_WHITE       = 0x0C,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   209
	TC_LIGHT_BLUE  = 0x0D,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   210
	TC_GREY        = 0x0E,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   211
	TC_DARK_BLUE   = 0x0F,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   212
	TC_BLACK       = 0x10,
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   213
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   214
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   215
enum StringColorFlags {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   216
	IS_PALETTE_COLOR = 0x100, ///< color value is already a real palette color index, not an index of a StringColor
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   217
};
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   218
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   219
#endif /* GFX_TYPE_H */