TurnTimerWidget.h 991 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * TurnTimerWidget.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. #include "../gui/InterfaceObjectConfigurable.h"
  13. #include "../render/Canvas.h"
  14. #include "../render/Colors.h"
  15. class CAnimImage;
  16. class CLabel;
  17. class TurnTimerWidget : public InterfaceObjectConfigurable
  18. {
  19. private:
  20. class DrawRect : public CIntObject
  21. {
  22. const Rect rect;
  23. const ColorRGBA color;
  24. public:
  25. DrawRect(const Rect &, const ColorRGBA &);
  26. void showAll(Canvas & to) override;
  27. };
  28. int turnTime;
  29. int lastTurnTime;
  30. int cachedTurnTime;
  31. std::set<int> notifications;
  32. std::shared_ptr<DrawRect> buildDrawRect(const JsonNode & config) const;
  33. public:
  34. void show(Canvas & to) override;
  35. void tick(uint32_t msPassed) override;
  36. void setTime(PlayerColor player, int time);
  37. TurnTimerWidget();
  38. };