# viewport_func.h

Go to the documentation of this file.

    00001 /* $Id: viewport_func.h 11939 2008-01-21 23:55:57Z rubidium $ */
    00002
    00005 #ifndef VIEWPORT_FUNC_H
    00006 #define VIEWPORT_FUNC_H
    00007
    00008 #include "gfx_type.h"
    00009 #include "viewport_type.h"
    00010 #include "vehicle_type.h"
    00011 #include "strings_type.h"
    00012
    00013 void SetSelectionRed(bool);
    00014
    00015 void InitViewports();
    00016 void DeleteWindowViewport(Window *w);
    00017 void AssignWindowViewport(Window *w, int x, int y, int width, int height, uint32 follow_flags, ZoomLevel zoom);
    00018 ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
    00019 Point GetTileBelowCursor();
    00020 void UpdateViewportPosition(Window *w);
    00021
    00022 bool DoZoomInOutWindow(int how, Window *w);
    00023 void ZoomInOrOutToCursorWindow(bool in, Window * w);
    00024 Point GetTileZoomCenterWindow(bool in, Window * w);
    00025 void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
    00026
    00027 static inline void MaxZoomInOut(int how, Window *w)
    00028 {
    00029   while (DoZoomInOutWindow(how, w)) {};
    00030 }
    00031
    00032 void OffsetGroundSprite(int x, int y);
    00033
    00034 void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub = NULL);
    00035 void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z, const SubSprite *sub = NULL);
    00036 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);
    00037 void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2);
    00038 void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL);
    00039
    00040
    00041 void StartSpriteCombine();
    00042 void EndSpriteCombine();
    00043
    00044 void HandleViewportClicked(const ViewPort *vp, int x, int y);
    00045 void PlaceObject();
    00046 void SetRedErrorSquare(TileIndex tile);
    00047 void SetTileSelectSize(int w, int h);
    00048 void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
    00049
    00050 Vehicle *CheckMouseOverVehicle();
    00051
    00052 void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
    00053 void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process);
    00054 void VpSetPresizeRange(TileIndex from, TileIndex to);
    00055 void VpSetPlaceSizingLimit(int limit);
    00056
    00057 typedef void PlaceProc(TileIndex tile);
    00058 void PlaceProc_DemolishArea(TileIndex tile);
    00059 void PlaceProc_LevelLand(TileIndex tile);
    00060 void PlaceProc_BuyLand(TileIndex tile);
    00061 bool GUIPlaceProcDragXY(const WindowEvent *e);
    00062
    00063 /* common button handler */
    00064 bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc);
    00065
    00066 void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
    00067
    00068 void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w);
    00069 void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num);
    00070
    00071 void ResetObjectToPlace();
    00072
    00073 bool ScrollWindowTo(int x, int y, Window *w, bool instant = false);
    00074
    00075 bool ScrollMainWindowToTile(TileIndex tile, bool instant = false);
    00076 bool ScrollMainWindowTo(int x, int y, bool instant = false);
    00077
    00078 extern PlaceProc *_place_proc;
    00079 extern Point _tile_fract_coords;
    00080 extern TileHighlightData _thd;
    00081
    00082 #endif /* VIEWPORT_FUNC_H */