# viewport_func.h

Go to the documentation of this file.

    00001 /* $Id: viewport_func.h 18702 2010-01-03 20:55:00Z frosch $ */
    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 "vehicle_type.h"
    00018 #include "window_type.h"
    00019 #include "tile_type.h"
    00020
    00021 void SetSelectionRed(bool);
    00022
    00023 void DeleteWindowViewport(Window *w);
    00024 void InitializeWindowViewport(Window *w, int x, int y, int width, int height, uint32 follow_flags, ZoomLevel zoom);
    00025 ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
    00026 Point GetTileBelowCursor();
    00027 void UpdateViewportPosition(Window *w);
    00028
    00034 void MarkAllViewportsDirty(int left, int top, int right, int bottom);
    00035
    00036 bool DoZoomInOutWindow(int how, Window *w);
    00037 void ZoomInOrOutToCursorWindow(bool in, Window * w);
    00038 Point GetTileZoomCenterWindow(bool in, Window * w);
    00039 void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
    00040
    00041 static inline void MaxZoomInOut(int how, Window *w)
    00042 {
    00043   while (DoZoomInOutWindow(how, w)) {};
    00044 }
    00045
    00046 void OffsetGroundSprite(int x, int y);
    00047
    00048 void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
    00049 void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, int z, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
    00050 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);
    00051 void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL);
    00052 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);
    00053
    00054
    00055 void StartSpriteCombine();
    00056 void EndSpriteCombine();
    00057
    00058 bool HandleViewportClicked(const ViewPort *vp, int x, int y);
    00059 void PlaceObject();
    00060 void SetRedErrorSquare(TileIndex tile);
    00061 void SetTileSelectSize(int w, int h);
    00062 void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
    00063
    00064 Vehicle *CheckMouseOverVehicle();
    00065
    00066 void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
    00067
    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 #endif /* VIEWPORT_FUNC_H */