CResDataBar.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * CResDataBar.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 "../gui/CIntObject.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. enum class EGameResID : int8_t;
  14. using GameResID = Identifier<EGameResID>;
  15. VCMI_LIB_NAMESPACE_END
  16. /// Resources bar which shows information about how many gold, crystals,... you have
  17. /// Current date is displayed too
  18. class CResDataBar : public CIntObject
  19. {
  20. std::string buildDateString();
  21. std::shared_ptr<CPicture> background;
  22. std::map<GameResID, Point> resourcePositions;
  23. std::optional<Point> datePosition;
  24. void draw(SDL_Surface * to);
  25. public:
  26. /// For dynamically-sized UI windows, e.g. adventure map interface
  27. CResDataBar(const std::string & imageName, const Point & position);
  28. /// For fixed-size UI windows, e.g. CastleInterface
  29. CResDataBar(const std::string &defname, int x, int y, int offx, int offy, int resdist, int datedist);
  30. void setDatePosition(const Point & position);
  31. void setResourcePosition(const GameResID & resource, const Point & position);
  32. void colorize(PlayerColor player);
  33. void showAll(SDL_Surface * to) override;
  34. };