src/viewport_func.h
author rubidium
Sat, 19 Apr 2008 13:17:19 +0000
changeset 8994 fb5e761cf141
parent 8957 ef3f499ff423
child 9127 14f21c5954ee
permissions -rw-r--r--
(svn r12789) -Codechange: rename AssignWindowViewport to InitializeWindowViewport because the viewport is now part of the window struct. Patch by Alberth.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     2
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
     3
/** @file viewport_func.h Functions related to (drawing on) viewports. */
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
     4
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
     5
#ifndef VIEWPORT_FUNC_H
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
     6
#define VIEWPORT_FUNC_H
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
8225
cd84a95b6630 (svn r11788) -Fix (11787): makedepend doesn't mark delete files as changed...
rubidium
parents: 8224
diff changeset
     8
#include "gfx_type.h"
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
     9
#include "viewport_type.h"
8119
52b48108425a (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents: 8106
diff changeset
    10
#include "vehicle_type.h"
8264
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8225
diff changeset
    11
#include "strings_type.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
1990
efb67f977138 (svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents: 1977
diff changeset
    13
void SetSelectionRed(bool);
efb67f977138 (svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents: 1977
diff changeset
    14
5122
3aa375cb5e8e (svn r7202) -Codechange: Move _viewports and _active_viewports local to viewport.c and have them
Darkvater
parents: 5046
diff changeset
    15
void DeleteWindowViewport(Window *w);
8994
fb5e761cf141 (svn r12789) -Codechange: rename AssignWindowViewport to InitializeWindowViewport because the viewport is now part of the window struct. Patch by Alberth.
rubidium
parents: 8957
diff changeset
    16
void InitializeWindowViewport(Window *w, int x, int y, int width, int height, uint32 follow_flags, ZoomLevel zoom);
2116
23031555ff54 (svn r2626) static, const, misc.
tron
parents: 1990
diff changeset
    17
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    18
Point GetTileBelowCursor();
5044
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    19
void UpdateViewportPosition(Window *w);
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    20
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    21
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
    22
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
    23
Point GetTileZoomCenterWindow(bool in, Window * w);
5045
846098142ffe (svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents: 5044
diff changeset
    24
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
    25
5046
d2c53a73b580 (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    26
static inline void MaxZoomInOut(int how, Window *w)
d2c53a73b580 (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    27
{
7318
632cd0497770 (svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents: 7006
diff changeset
    28
	while (DoZoomInOutWindow(how, w)) {};
5046
d2c53a73b580 (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    29
}
d2c53a73b580 (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    30
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    31
void OffsetGroundSprite(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
7681
582e8912e8d1 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 7659
diff changeset
    33
void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub = NULL);
582e8912e8d1 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 7659
diff changeset
    34
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z, const SubSprite *sub = NULL);
582e8912e8d1 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 7659
diff changeset
    35
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);
8946
a800978c3c8f (svn r12734) -Codechange: use a vector instead of allocating memory in a big byte array for StringSpriteToDraw.
rubidium
parents: 8373
diff changeset
    36
void AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2, uint16 color = 0, uint16 width = 0);
7681
582e8912e8d1 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 7659
diff changeset
    37
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
    38
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    40
void StartSpriteCombine();
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    41
void EndSpriteCombine();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
2116
23031555ff54 (svn r2626) static, const, misc.
tron
parents: 1990
diff changeset
    43
void HandleViewportClicked(const ViewPort *vp, int x, int y);
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    44
void PlaceObject();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
void SetRedErrorSquare(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    46
void SetTileSelectSize(int w, int h);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
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
    48
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    49
Vehicle *CheckMouseOverVehicle();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
7888
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    51
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    52
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process);
8373
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8264
diff changeset
    53
void VpSetPresizeRange(TileIndex from, TileIndex to);
7888
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    54
void VpSetPlaceSizingLimit(int limit);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    56
typedef void PlaceProc(TileIndex tile);
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    57
void PlaceProc_DemolishArea(TileIndex tile);
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    58
void PlaceProc_LevelLand(TileIndex tile);
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    59
void PlaceProc_BuyLand(TileIndex tile);
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    60
bool GUIPlaceProcDragXY(const WindowEvent *e);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    62
/* common button handler */
7889
e74ce8853ba7 (svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents: 7888
diff changeset
    63
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
430
2e9a2e9fcf11 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
    65
void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
2e9a2e9fcf11 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
    66
8121
3bc6351e7369 (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: 8119
diff changeset
    67
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w);
3bc6351e7369 (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: 8119
diff changeset
    68
void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num);
3bc6351e7369 (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: 8119
diff changeset
    69
3bc6351e7369 (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: 8119
diff changeset
    70
void ResetObjectToPlace();
3bc6351e7369 (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: 8119
diff changeset
    71
3bc6351e7369 (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: 8119
diff changeset
    72
bool ScrollWindowTo(int x, int y, Window *w, bool instant = false);
3bc6351e7369 (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: 8119
diff changeset
    73
3bc6351e7369 (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: 8119
diff changeset
    74
bool ScrollMainWindowToTile(TileIndex tile, bool instant = false);
3bc6351e7369 (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: 8119
diff changeset
    75
bool ScrollMainWindowTo(int x, int y, bool instant = false);
3bc6351e7369 (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: 8119
diff changeset
    76
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    77
extern PlaceProc *_place_proc;
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    78
extern Point _tile_fract_coords;
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    79
extern TileHighlightData _thd;
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    80
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    81
#endif /* VIEWPORT_FUNC_H */