ImageLocator.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. std::optional<ImagePath> image;
  17. std::optional<AnimationPath> defFile;
  18. int defFrame = -1;
  19. int defGroup = -1;
  20. EImageBlitMode layer = EImageBlitMode::OPAQUE;
  21. SharedImageLocator() = default;
  22. SharedImageLocator(const AnimationPath & path, int frame, int group, EImageBlitMode layer);
  23. SharedImageLocator(const JsonNode & config, EImageBlitMode layer);
  24. SharedImageLocator(const ImagePath & path, EImageBlitMode layer);
  25. bool operator < (const SharedImageLocator & other) const;
  26. };
  27. struct ImageLocator : SharedImageLocator
  28. {
  29. PlayerColor playerColored = PlayerColor::CANNOT_DETERMINE;
  30. bool verticalFlip = false;
  31. bool horizontalFlip = false;
  32. int8_t scalingFactor = 0; // 0 = auto / use default scaling
  33. using SharedImageLocator::SharedImageLocator;
  34. ImageLocator(const JsonNode & config, EImageBlitMode layer);
  35. bool empty() const;
  36. };