CResDataBar.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. public:
  25. /// For dynamically-sized UI windows, e.g. adventure map interface
  26. CResDataBar(const std::string & imageName, const Point & position);
  27. /// For fixed-size UI windows, e.g. CastleInterface
  28. CResDataBar(const std::string &defname, int x, int y, int offx, int offy, int resdist, int datedist);
  29. void setDatePosition(const Point & position);
  30. void setResourcePosition(const GameResID & resource, const Point & position);
  31. void colorize(PlayerColor player);
  32. void showAll(Canvas & to) override;
  33. };