| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /*
- * MapView.h, part of VCMI engine
- *
- * Authors: listed in file AUTHORS in main folder
- *
- * License: GNU General Public License v2.0 or later
- * Full text of license available in license.txt file, in main folder
- *
- */
- #pragma once
- #include "../gui/CIntObject.h"
- VCMI_LIB_NAMESPACE_BEGIN
- struct ObjectPosInfo;
- VCMI_LIB_NAMESPACE_END
- class Canvas;
- class MapViewActions;
- class MapViewController;
- class MapViewModel;
- class MapViewCache;
- /// Main class that represents visible section of adventure map
- /// Contains all public interface of view and translates calls to internal model
- class MapView : public CIntObject
- {
- std::shared_ptr<MapViewModel> model;
- std::shared_ptr<MapViewCache> tilesCache;
- std::shared_ptr<MapViewController> controller;
- std::shared_ptr<MapViewActions> actions;
- bool isSwiping;
- std::shared_ptr<MapViewModel> createModel(const Point & dimensions) const;
- void render(Canvas & target, bool fullUpdate);
- public:
- MapView(const Point & offset, const Point & dimensions);
- ~MapView() override;
- /// Moves current view to another level, preserving position
- void onMapLevelSwitched();
- /// Moves current view by specified distance in pixels
- void onMapScrolled(const Point & distance);
- /// Moves current view to specified position, in pixels
- void onMapSwiped(const Point & viewPosition);
- /// Ends swiping mode and allows normal map scrolling once again
- void onMapSwipeEnded();
- /// Moves current view to specified tile
- void onCenteredTile(const int3 & tile);
- /// Centers view on object and starts "tracking" it
- /// Whenever object changes position, so will the object
- /// Tracking will be disabled on any call that moves view
- void onCenteredObject(const CGObjectInstance * target);
- /// Switches view to "View Earth" / "View Air" mode, displaying downscaled map with overlay
- void onViewSpellActivated( uint32_t tileSize, const std::vector<ObjectPosInfo>& objectPositions, bool showTerrain);
- /// Switches view to downscaled View World
- void onViewWorldActivated( uint32_t tileSize);
- /// Switches view from View World mode back to standard view
- void onViewMapActivated();
- void show(SDL_Surface * to) override;
- void showAll(SDL_Surface * to) override;
- };
|