2
0

IMapRendererContext.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * IMapRendererContext.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. VCMI_LIB_NAMESPACE_BEGIN
  12. class int3;
  13. class Point;
  14. class CGObjectInstance;
  15. class ObjectInstanceID;
  16. struct TerrainTile;
  17. class ColorRGBA;
  18. struct CGPath;
  19. VCMI_LIB_NAMESPACE_END
  20. class IMapRendererContext
  21. {
  22. public:
  23. using MapObject = ObjectInstanceID;
  24. using MapObjectsList = std::vector<MapObject>;
  25. virtual ~IMapRendererContext() = default;
  26. /// returns dimensions of current map
  27. virtual int3 getMapSize() const = 0;
  28. /// returns true if chosen coordinates exist on map
  29. virtual bool isInMap(const int3 & coordinates) const = 0;
  30. /// returns true if selected tile has animation and should not be cached
  31. virtual bool tileAnimated(const int3 & coordinates) const = 0;
  32. /// returns tile by selected coordinates. Coordinates MUST be valid
  33. virtual const TerrainTile & getMapTile(const int3 & coordinates) const = 0;
  34. /// returns all objects visible on specified tile
  35. virtual const MapObjectsList & getObjects(const int3 & coordinates) const = 0;
  36. /// returns specific object by ID, or nullptr if not found
  37. virtual const CGObjectInstance * getObject(ObjectInstanceID objectID) const = 0;
  38. /// returns path of currently active hero, or nullptr if none
  39. virtual const CGPath * currentPath() const = 0;
  40. /// returns true if specified tile is visible in current context
  41. virtual bool isVisible(const int3 & coordinates) const = 0;
  42. /// returns true if specified object is the currently active hero
  43. virtual bool isActiveHero(const CGObjectInstance* obj) const = 0;
  44. /// Returns moveDir of hero that attacked this wandering monster, or -1 on failure
  45. virtual int attackedMonsterDirection(const CGObjectInstance * wanderingMonster) const = 0;
  46. virtual size_t objectGroupIndex(ObjectInstanceID objectID) const = 0;
  47. virtual Point objectImageOffset(ObjectInstanceID objectID, const int3 & coordinates) const = 0;
  48. /// returns object animation transparency. IF set to 0, object will not be visible
  49. virtual double objectTransparency(ObjectInstanceID objectID, const int3 & coordinates) const = 0;
  50. /// returns animation frame for selected object
  51. virtual size_t objectImageIndex(ObjectInstanceID objectID, size_t groupSize) const = 0;
  52. /// returns index of image for overlay on specific tile, or numeric_limits::max if none
  53. virtual size_t overlayImageIndex(const int3 & coordinates) const = 0;
  54. /// returns text that should be used as overlay for current tile
  55. virtual std::string overlayText(const int3 & coordinates) const = 0;
  56. /// returns text that should be used as overlay for current tile
  57. virtual ColorRGBA overlayTextColor(const int3 & coordinates) const = 0;
  58. /// returns animation frame for terrain
  59. virtual size_t terrainImageIndex(size_t groupSize) const = 0;
  60. virtual double viewTransitionProgress() const = 0;
  61. /// if true, rendered images will be converted to grayscale
  62. virtual bool filterGrayscale() const = 0;
  63. virtual bool showRoads() const = 0;
  64. virtual bool showRivers() const = 0;
  65. virtual bool showBorder() const = 0;
  66. /// if true, world view overlay will be shown
  67. virtual bool showImageOverlay() const = 0;
  68. // if true, new text overlay will be shown
  69. virtual bool showTextOverlay() const = 0;
  70. /// if true, map grid should be visible on map
  71. virtual bool showGrid() const = 0;
  72. virtual bool showVisitable() const = 0;
  73. virtual bool showBlocked() const = 0;
  74. /// if true, spell range for teleport / scuttle boat will be visible
  75. virtual bool showSpellRange(const int3 & position) const = 0;
  76. };