MapRendererContext.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * MapRenderer.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 "../../lib/ConstTransitivePtr.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class int3;
  14. class Point;
  15. class ObjectInstanceID;
  16. class CGObjectInstance;
  17. struct TerrainTile;
  18. struct CGPath;
  19. VCMI_LIB_NAMESPACE_END
  20. class IMapRendererContext
  21. {
  22. public:
  23. virtual ~IMapRendererContext() = default;
  24. using ObjectsVector = std::vector< ConstTransitivePtr<CGObjectInstance> >;
  25. /// returns dimensions of current map
  26. virtual int3 getMapSize() const = 0;
  27. /// returns true if chosen coordinates exist on map
  28. virtual bool isInMap(const int3 & coordinates) const = 0;
  29. /// returns tile by selected coordinates. Coordinates MUST be valid
  30. virtual const TerrainTile & getMapTile(const int3 & coordinates) const = 0;
  31. /// returns vector of all objects present on current map
  32. virtual ObjectsVector getAllObjects() const = 0;
  33. /// returns specific object by ID, or nullptr if not found
  34. virtual const CGObjectInstance * getObject( ObjectInstanceID objectID ) const = 0;
  35. /// returns path of currently active hero, or nullptr if none
  36. virtual const CGPath * currentPath() const = 0;
  37. /// returns true if specified tile is visible in current context
  38. virtual bool isVisible(const int3 & coordinates) const = 0;
  39. /// returns how long should each frame of animation be visible, in milliseconds
  40. virtual uint32_t getAnimationPeriod() const = 0;
  41. /// returns total animation time since creation of this context
  42. virtual uint32_t getAnimationTime() const = 0;
  43. /// returns size of ouput tile, in pixels. 32x32 for "standard" map, may be smaller for world view mode
  44. virtual Point tileSize() const = 0;
  45. /// if true, map grid should be visible on map
  46. virtual bool showGrid() const = 0;
  47. };