# viewport_func.h

Go to the documentation of this file.

    00001 /* $Id: viewport_func.h 23329 2011-11-25 23:06:17Z peter1138 $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef VIEWPORT_FUNC_H
    00013 #define VIEWPORT_FUNC_H
    00014
    00015 #include "gfx_type.h"
    00016 #include "viewport_type.h"
    00017 #include "window_type.h"
    00018 #include "tile_type.h"
    00019
    00020 static const int TILE_HEIGHT_STEP = 50;
    00021
    00022 void SetSelectionRed(bool);
    00023
    00024 void DeleteWindowViewport(Window *w);
    00025 void InitializeWindowViewport(Window *w, int x, int y, int width, int height, uint32 follow_flags, ZoomLevel zoom);
    00026 ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
    00027 Point GetTileBelowCursor();
    00028 void UpdateViewportPosition(Window *w);
    00029
    00030 void MarkAllViewportsDirty(int left, int top, int right, int bottom);
    00031
    00032 bool DoZoomInOutWindow(ZoomStateChange how, Window *w);
    00033 void ZoomInOrOutToCursorWindow(bool in, Window * w);
    00034 Point GetTileZoomCenterWindow(bool in, Window * w);
    00035 void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
    00036
    00043 static inline void MaxZoomInOut(ZoomStateChange how, Window *w)
    00044 {
    00045   while (DoZoomInOutWindow(how, w)) {};
    00046 }
    00047
    00048 void OffsetGroundSprite(int x, int y);
    00049
    00050 void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
    00051 void DrawGroundSpriteAt(SpriteID image, PaletteID pal, int32 x, int32 y, int z, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
    00052 void AddSortableSpriteToDraw(SpriteID image, PaletteID 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);
    00053 void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL, bool scale = true);
    00054 void ViewportAddString(const DrawPixelInfo *dpi, ZoomLevel small_from, const ViewportSign *sign, StringID string_normal, StringID string_small, StringID string_small_shadow, uint64 params_1, uint64 params_2 = 0, Colours colour = INVALID_COLOUR);
    00055
    00056
    00057 void StartSpriteCombine();
    00058 void EndSpriteCombine();
    00059
    00060 bool HandleViewportClicked(const ViewPort *vp, int x, int y);
    00061 void SetRedErrorSquare(TileIndex tile);
    00062 void SetTileSelectSize(int w, int h);
    00063 void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
    00064
    00065 void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
    00066
    00067 bool ScrollWindowToTile(TileIndex tile, Window *w, bool instant = false);
    00068 bool ScrollWindowTo(int x, int y, int z, Window *w, bool instant = false);
    00069
    00070 bool ScrollMainWindowToTile(TileIndex tile, bool instant = false);
    00071 bool ScrollMainWindowTo(int x, int y, int z = -1, bool instant = false);
    00072
    00073 void UpdateAllVirtCoords();
    00074
    00075 extern Point _tile_fract_coords;
    00076
    00077 void MarkTileDirtyByTile(TileIndex tile);
    00078
    00079 #endif /* VIEWPORT_FUNC_H */