2
0

ImageLocator.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * ImageLocator.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 "IImage.h"
  12. #include "../../lib/filesystem/ResourcePath.h"
  13. #include "../../lib/constants/EntityIdentifiers.h"
  14. struct SharedImageLocator
  15. {
  16. enum class ShadowMode
  17. {
  18. SHADOW_NONE,
  19. SHADOW_NORMAL,
  20. SHADOW_SHEAR
  21. };
  22. enum class OverlayMode
  23. {
  24. OVERLAY_NONE,
  25. OVERLAY_OUTLINE,
  26. OVERLAY_FLAG
  27. };
  28. std::optional<ImagePath> image;
  29. std::optional<AnimationPath> defFile;
  30. int defFrame = -1;
  31. int defGroup = -1;
  32. EImageBlitMode layer = EImageBlitMode::OPAQUE;
  33. std::optional<ShadowMode> generateShadow;
  34. std::optional<OverlayMode> generateOverlay;
  35. SharedImageLocator() = default;
  36. SharedImageLocator(const AnimationPath & path, int frame, int group, EImageBlitMode layer);
  37. SharedImageLocator(const JsonNode & config, EImageBlitMode layer);
  38. SharedImageLocator(const ImagePath & path, EImageBlitMode layer);
  39. bool operator < (const SharedImageLocator & other) const;
  40. };
  41. struct ImageLocator : SharedImageLocator
  42. {
  43. PlayerColor playerColored = PlayerColor::CANNOT_DETERMINE;
  44. bool verticalFlip = false;
  45. bool horizontalFlip = false;
  46. int8_t scalingFactor = 0; // 0 = auto / use default scaling
  47. using SharedImageLocator::SharedImageLocator;
  48. ImageLocator(const JsonNode & config, EImageBlitMode layer);
  49. bool empty() const;
  50. };