MapViewController.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * MapViewController.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "IMapRendererObserver.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class Point;
  14. VCMI_LIB_NAMESPACE_END
  15. class MapViewModel;
  16. class MapRendererContext;
  17. /// Class responsible for updating view state,
  18. /// such as its position and any animations
  19. class MapViewController : public IMapObjectObserver
  20. {
  21. std::shared_ptr<MapRendererContext> context;
  22. std::shared_ptr<MapViewModel> model;
  23. private:
  24. // IMapObjectObserver impl
  25. bool hasOngoingAnimations() override;
  26. void onObjectFadeIn(const CGObjectInstance * obj) override;
  27. void onObjectFadeOut(const CGObjectInstance * obj) override;
  28. void onObjectInstantAdd(const CGObjectInstance * obj) override;
  29. void onObjectInstantRemove(const CGObjectInstance * obj) override;
  30. void onHeroTeleported(const CGHeroInstance * obj, const int3 & from, const int3 & dest) override;
  31. void onHeroMoved(const CGHeroInstance * obj, const int3 & from, const int3 & dest) override;
  32. void onHeroRotated(const CGHeroInstance * obj, const int3 & from, const int3 & dest) override;
  33. public:
  34. MapViewController(std::shared_ptr<MapRendererContext> context, std::shared_ptr<MapViewModel> model);
  35. void setViewCenter(const int3 & position);
  36. void setViewCenter(const Point & position, int level);
  37. void setTileSize(const Point & tileSize);
  38. void update(uint32_t timeDelta);
  39. };