src/viewport_func.h
author rubidium
Fri, 04 Jul 2008 19:00:11 +0000
changeset 11118 f66e0a4ce878
parent 10467 a8de2b5759bd
permissions -rw-r--r--
(svn r13676) -Fix [FS#2126]: inactive companies from old (TTD) saves could be marked active in some cases, which then loads garbage in their statistics and such.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     2
8720
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8634
diff changeset
     3
/** @file viewport_func.h Functions related to (drawing on) viewports. */
6919
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
     4
8720
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8634
diff changeset
     5
#ifndef VIEWPORT_FUNC_H
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8634
diff changeset
     6
#define VIEWPORT_FUNC_H
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
8721
b7971ad9bdd9 (svn r11788) -Fix (11787): makedepend doesn't mark delete files as changed...
rubidium
parents: 8720
diff changeset
     8
#include "gfx_type.h"
8720
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8634
diff changeset
     9
#include "viewport_type.h"
8615
6b91ca653bad (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents: 8602
diff changeset
    10
#include "vehicle_type.h"
8760
ce0891c412ce (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8721
diff changeset
    11
#include "strings_type.h"
10445
2dd7d9d0a957 (svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents: 10257
diff changeset
    12
#include "window_type.h"
2dd7d9d0a957 (svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents: 10257
diff changeset
    13
#include "tile_type.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
1990
90eb49e87b90 (svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents: 1977
diff changeset
    15
void SetSelectionRed(bool);
90eb49e87b90 (svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents: 1977
diff changeset
    16
5122
a68d16b055fa (svn r7202) -Codechange: Move _viewports and _active_viewports local to viewport.c and have them
Darkvater
parents: 5046
diff changeset
    17
void DeleteWindowViewport(Window *w);
10257
fe75471234f3 (svn r12789) -Codechange: rename AssignWindowViewport to InitializeWindowViewport because the viewport is now part of the window struct. Patch by Alberth.
rubidium
parents: 10217
diff changeset
    18
void InitializeWindowViewport(Window *w, int x, int y, int width, int height, uint32 follow_flags, ZoomLevel zoom);
2116
cdfc27b696b7 (svn r2626) static, const, misc.
tron
parents: 1990
diff changeset
    19
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    20
Point GetTileBelowCursor();
5044
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    21
void UpdateViewportPosition(Window *w);
10445
2dd7d9d0a957 (svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents: 10257
diff changeset
    22
void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str);
5044
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    23
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    24
bool DoZoomInOutWindow(int how, Window *w);
152
c3964b43943e (svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents: 133
diff changeset
    25
void ZoomInOrOutToCursorWindow(bool in, Window * w);
c3964b43943e (svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents: 133
diff changeset
    26
Point GetTileZoomCenterWindow(bool in, Window * w);
5045
3e734e178dae (svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents: 5044
diff changeset
    27
void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
5046
2b2375affc0a (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    29
static inline void MaxZoomInOut(int how, Window *w)
2b2375affc0a (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    30
{
7814
fe643468ad64 (svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents: 7502
diff changeset
    31
	while (DoZoomInOutWindow(how, w)) {};
5046
2b2375affc0a (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    32
}
2b2375affc0a (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    33
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
void OffsetGroundSprite(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
8177
f0bcc8e149f3 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 8155
diff changeset
    36
void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub = NULL);
f0bcc8e149f3 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 8155
diff changeset
    37
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z, const SubSprite *sub = NULL);
f0bcc8e149f3 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 8155
diff changeset
    38
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, int dz, int z, bool transparent = false, int bb_offset_x = 0, int bb_offset_y = 0, int bb_offset_z = 0, const SubSprite *sub = NULL);
10202
19da84f6725c (svn r12734) -Codechange: use a vector instead of allocating memory in a big byte array for StringSpriteToDraw.
rubidium
parents: 8869
diff changeset
    39
void AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2, uint16 color = 0, uint16 width = 0);
8177
f0bcc8e149f3 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 8155
diff changeset
    40
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    43
void StartSpriteCombine();
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    44
void EndSpriteCombine();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
2116
cdfc27b696b7 (svn r2626) static, const, misc.
tron
parents: 1990
diff changeset
    46
void HandleViewportClicked(const ViewPort *vp, int x, int y);
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    47
void PlaceObject();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    48
void SetRedErrorSquare(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
void SetTileSelectSize(int w, int h);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    52
Vehicle *CheckMouseOverVehicle();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    53
430
75820dedf4f1 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
    54
void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
75820dedf4f1 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
    55
8617
931e0970d509 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8615
diff changeset
    56
bool ScrollWindowTo(int x, int y, Window *w, bool instant = false);
931e0970d509 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8615
diff changeset
    57
931e0970d509 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8615
diff changeset
    58
bool ScrollMainWindowToTile(TileIndex tile, bool instant = false);
931e0970d509 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8615
diff changeset
    59
bool ScrollMainWindowTo(int x, int y, bool instant = false);
931e0970d509 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8615
diff changeset
    60
8720
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8634
diff changeset
    61
extern Point _tile_fract_coords;
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8634
diff changeset
    62
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8634
diff changeset
    63
#endif /* VIEWPORT_FUNC_H */