src/gfx_func.h
author rubidium
Thu, 18 Dec 2008 12:23:08 +0000
changeset 10436 8d3a9fbe8f19
parent 10062 8ec5e3f048b7
permissions -rw-r--r--
(svn r14689) -Change: make configure die on commonly made user mistakes, like not having SDL development files or zlib headers installed; you can still compile a dedicated server or a binary without zlib, but you have to explicitly force it.
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_func.h Functions related to the gfx engine. */
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
/**
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     6
 * @defgroup dirty Dirty
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     7
 *
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     8
 * Handles the repaint of some part of the screen.
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
     9
 *
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    10
 * Some places in the code are called functions which makes something "dirty".
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    11
 * This has nothing to do with making a Tile or Window darker or less visible.
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    12
 * This term comes from memory caching and is used to define an object must
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    13
 * be repaint. If some data of an object (like a Tile, Window, Vehicle, whatever)
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    14
 * are changed which are so extensive the object must be repaint its marked
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    15
 * as "dirty". The video driver repaint this object instead of the whole screen
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    16
 * (this is btw. also possible if needed). This is used to avoid a
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    17
 * flickering of the screen by the video driver constantly repainting it.
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    18
 *
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    19
 * This whole mechanism is controlled by an rectangle defined in #_invalid_rect. This
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    20
 * rectangle defines the area on the screen which must be repaint. If a new object
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    21
 * needs to be repainted this rectangle is extended to 'catch' the object on the
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    22
 * screen. At some point (which is normaly uninteressted for patch writers) this
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    23
 * rectangle is send to the video drivers method
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    24
 * VideoDriver::MakeDirty and it is truncated back to an empty rectangle. At some
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    25
 * later point (which is uninteressted, too) the video driver
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    26
 * repaints all these saved rectangle instead of the whole screen and drop the
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    27
 * rectangle informations. Then a new round begins by marking objects "dirty".
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    28
 *
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    29
 * @see VideoDriver::MakeDirty
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    30
 * @see _invalid_rect
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    31
 * @see _screen
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
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    34
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    35
#ifndef GFX_FUNC_H
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    36
#define GFX_FUNC_H
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
#include "gfx_type.h"
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    39
#include "strings_type.h"
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    40
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    41
void GameLoop();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    42
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    43
void CreateConsole();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    44
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    45
extern byte _dirkeys;        ///< 1 = left, 2 = up, 4 = right, 8 = down
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    46
extern bool _fullscreen;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    47
extern CursorVars _cursor;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    48
extern bool _ctrl_pressed;   ///< Is Ctrl pressed?
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    49
extern bool _shift_pressed;  ///< Is Shift pressed?
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    50
extern byte _fast_forward;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    51
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    52
extern bool _left_button_down;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    53
extern bool _left_button_clicked;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    54
extern bool _right_button_down;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    55
extern bool _right_button_clicked;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    56
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    57
extern DrawPixelInfo _screen;
8249
90bd3316062f (svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents: 8171
diff changeset
    58
extern bool _screen_disable_anim;   ///< Disable palette animation (important for 32bpp-anim blitter during giant screenshot)
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    59
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    60
extern int _pal_first_dirty;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    61
extern int _pal_count_dirty;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    62
extern int _num_resolutions;
9533
e8b86b70c5f6 (svn r13537) -Fix [FS#2090](r13523): QSortT won't work this way, use Dimension instead of uint16[2] for resolutions
smatz
parents: 9117
diff changeset
    63
extern Dimension _resolutions[32];
e8b86b70c5f6 (svn r13537) -Fix [FS#2090](r13523): QSortT won't work this way, use Dimension instead of uint16[2] for resolutions
smatz
parents: 9117
diff changeset
    64
extern Dimension _cur_resolution;
9551
6f60dca6c566 (svn r13571) -Codechange: define channels in struct Colour in different order on LE and BE machines
smatz
parents: 9533
diff changeset
    65
extern Colour _cur_palette[256]; ///< Current palette. Entry 0 has to be always fully transparent!
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    66
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    67
void HandleKeypress(uint32 key);
8586
cb0e7e00f1d2 (svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
smatz
parents: 8433
diff changeset
    68
void HandleCtrlChanged();
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    69
void HandleMouseEvents();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    70
void CSleep(int milliseconds);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    71
void UpdateWindows();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    72
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    73
void DrawMouseCursor();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    74
void ScreenSizeChanged();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    75
void GameSizeChanged();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    76
void UndrawMouseCursor();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    77
9901
602720bd2d53 (svn r14051) -Codechange: enumify the DrawString buffer length.
rubidium
parents: 9882
diff changeset
    78
enum {
602720bd2d53 (svn r14051) -Codechange: enumify the DrawString buffer length.
rubidium
parents: 9882
diff changeset
    79
	/* Size of the buffer used for drawing strings. */
602720bd2d53 (svn r14051) -Codechange: enumify the DrawString buffer length.
rubidium
parents: 9882
diff changeset
    80
	DRAW_STRING_BUFFER = 1024,
602720bd2d53 (svn r14051) -Codechange: enumify the DrawString buffer length.
rubidium
parents: 9882
diff changeset
    81
};
602720bd2d53 (svn r14051) -Codechange: enumify the DrawString buffer length.
rubidium
parents: 9882
diff changeset
    82
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    83
void RedrawScreenRect(int left, int top, int right, int bottom);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    84
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    85
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    86
void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub = NULL);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    87
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    88
int DrawStringCentered(int x, int y, StringID str, uint16 color);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    89
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    90
int DoDrawStringCentered(int x, int y, const char *str, uint16 color);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    91
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    92
int DrawString(int x, int y, StringID str, uint16 color);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    93
int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    94
9882
aa5f19fddb3c (svn r14030) -Fix (r14027): true != false, also rename the parameter to make 'true' and 'false' more intuitively useable.
frosch
parents: 9880
diff changeset
    95
int DoDrawString(const char *string, int x, int y, uint16 real_colour, bool parse_string_also_when_clipped = false);
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    96
int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    97
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    98
void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
    99
void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   100
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   101
int DrawStringRightAligned(int x, int y, StringID str, uint16 color);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   102
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   103
void DrawStringRightAlignedUnderline(int x, int y, StringID str, uint16 color);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   104
8737
4405e2e80db6 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8586
diff changeset
   105
void DrawCharCentered(uint32 c, int x, int y, uint16 color);
4405e2e80db6 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8586
diff changeset
   106
9607
5a5728fb702a (svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch
parents: 9551
diff changeset
   107
void GfxFillRect(int left, int top, int right, int bottom, int color, FillRectMode mode = FILLRECT_OPAQUE);
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   108
void GfxDrawLine(int left, int top, int right, int bottom, int color);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   109
void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   110
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   111
Dimension GetStringBoundingBox(const char *str);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   112
uint32 FormatStringLinebreaks(char *str, int maxw);
9682
142c31e35bfa (svn r13787) -Codechange: resize the red error message box if needed
smatz
parents: 9607
diff changeset
   113
int GetStringHeight(StringID str, int maxw);
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   114
void LoadStringWidthTable();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   115
void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   116
uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh = -1);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   117
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
 * Let the dirty blocks repainting by the video driver.
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
 * @ingroup dirty
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   122
 */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   123
void DrawDirtyBlocks();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   124
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
 * Set a new dirty block.
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   127
 *
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   128
 * @ingroup dirty
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
void SetDirtyBlocks(int left, int top, int right, int bottom);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   131
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   132
/**
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   133
 * Marks the whole screen as dirty.
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   134
 *
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   135
 * @ingroup dirty
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
void MarkWholeScreenDirty();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   138
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   139
void GfxInitPalettes();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   140
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   141
bool FillDrawPixelInfo(DrawPixelInfo* n, int left, int top, int width, int height);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   142
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   143
/* window.cpp */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   144
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   145
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   146
void SetMouseCursor(SpriteID sprite, SpriteID pal);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   147
void SetAnimatedMouseCursor(const AnimCursor *table);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   148
void CursorTick();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   149
bool ChangeResInGame(int w, int h);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   150
void SortResolutions(int count);
8171
3fb9d1f8ac3b (svn r11734) -Change: Allow ToggleFullScreen to return the result of the operation' attempt. Previously, only visual clues were available.
belugas
parents: 8123
diff changeset
   151
bool ToggleFullScreen(bool fs);
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   152
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   153
/* gfx.cpp */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   154
#define ASCII_LETTERSTART 32
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   155
extern FontSize _cur_fontsize;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   156
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   157
byte GetCharacterWidth(FontSize size, uint32 key);
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   158
9773
fd7309d22bc6 (svn r13910) -Document: string drawing related functions and types (Alberth)
rubidium
parents: 9682
diff changeset
   159
/**
fd7309d22bc6 (svn r13910) -Document: string drawing related functions and types (Alberth)
rubidium
parents: 9682
diff changeset
   160
 * Get height of a character for a given font size.
fd7309d22bc6 (svn r13910) -Document: string drawing related functions and types (Alberth)
rubidium
parents: 9682
diff changeset
   161
 * @param size Font size to get height of
fd7309d22bc6 (svn r13910) -Document: string drawing related functions and types (Alberth)
rubidium
parents: 9682
diff changeset
   162
 * @return     Height of characters in the given font (pixels)
fd7309d22bc6 (svn r13910) -Document: string drawing related functions and types (Alberth)
rubidium
parents: 9682
diff changeset
   163
 */
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   164
static inline byte GetCharacterHeight(FontSize size)
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   165
{
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   166
	switch (size) {
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   167
		default: NOT_REACHED();
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   168
		case FS_NORMAL: return 10;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   169
		case FS_SMALL:  return 6;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   170
		case FS_LARGE:  return 18;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   171
	}
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   172
}
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   173
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   174
extern DrawPixelInfo *_cur_dpi;
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   175
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   176
/**
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   177
 * All 16 colour gradients
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   178
 * 8 colours per gradient from darkest (0) to lightest (7)
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   179
 */
9850
61bd42a09ddd (svn r13994) -Codechange: replace a few rogue magic numbers with Colours enum values
belugas
parents: 9773
diff changeset
   180
extern byte _colour_gradient[COLOUR_END][8];
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   181
9995
7f2dab0093c1 (svn r14152) -Fix (r14146): Apple decided to use a name I wanted to use... thus making compilation fail on OSX (planetmaker)
rubidium
parents: 9989
diff changeset
   182
extern PaletteType _use_palette;
10062
8ec5e3f048b7 (svn r14229) -Feature: allow overriding the palette of the base GRFs. This way you can play with NewGRFs made for the Windows palette with the DOS palettes base GRFs (and vice versa). Note that for this to work correctly ALL NewGRFs must use the same palette; mix and match is not yet supported.
rubidium
parents: 9995
diff changeset
   183
extern bool _palette_remap_grf[];
8ec5e3f048b7 (svn r14229) -Feature: allow overriding the palette of the base GRFs. This way you can play with NewGRFs made for the Windows palette with the DOS palettes base GRFs (and vice versa). Note that for this to work correctly ALL NewGRFs must use the same palette; mix and match is not yet supported.
rubidium
parents: 9995
diff changeset
   184
extern const byte *_palette_remap;
8ec5e3f048b7 (svn r14229) -Feature: allow overriding the palette of the base GRFs. This way you can play with NewGRFs made for the Windows palette with the DOS palettes base GRFs (and vice versa). Note that for this to work correctly ALL NewGRFs must use the same palette; mix and match is not yet supported.
rubidium
parents: 9995
diff changeset
   185
extern const byte *_palette_reverse_remap;
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   186
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
diff changeset
   187
#endif /* GFX_FUNC_H */