CInfoBar.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * AdventureMapClasses.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 "ObjectLists.h"
  12. #include "../../lib/FunctionList.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CArmedInstance;
  15. class CGGarrison;
  16. class CGObjectInstance;
  17. class CGHeroInstance;
  18. class CGTownInstance;
  19. struct Component;
  20. struct InfoAboutArmy;
  21. struct InfoAboutHero;
  22. struct InfoAboutTown;
  23. VCMI_LIB_NAMESPACE_END
  24. class CAnimation;
  25. class CAnimImage;
  26. class CShowableAnim;
  27. class CFilledTexture;
  28. class CButton;
  29. class CComponent;
  30. class CHeroTooltip;
  31. class CTownTooltip;
  32. class CTextBox;
  33. class IImage;
  34. /// Info box which shows next week/day information, hold the current date
  35. class CInfoBar : public CIntObject
  36. {
  37. //all visible information located in one object - for ease of replacing
  38. class CVisibleInfo : public CIntObject
  39. {
  40. public:
  41. void show(SDL_Surface * to) override;
  42. protected:
  43. std::shared_ptr<CPicture> background;
  44. std::list<std::shared_ptr<CIntObject>> forceRefresh;
  45. CVisibleInfo();
  46. };
  47. class EmptyVisibleInfo : public CVisibleInfo
  48. {
  49. public:
  50. EmptyVisibleInfo();
  51. };
  52. class VisibleHeroInfo : public CVisibleInfo
  53. {
  54. std::shared_ptr<CHeroTooltip> heroTooltip;
  55. public:
  56. VisibleHeroInfo(const CGHeroInstance * hero);
  57. };
  58. class VisibleTownInfo : public CVisibleInfo
  59. {
  60. std::shared_ptr<CTownTooltip> townTooltip;
  61. public:
  62. VisibleTownInfo(const CGTownInstance * town);
  63. };
  64. class VisibleDateInfo : public CVisibleInfo
  65. {
  66. std::shared_ptr<CShowableAnim> animation;
  67. std::shared_ptr<CLabel> label;
  68. std::string getNewDayName();
  69. public:
  70. VisibleDateInfo();
  71. };
  72. class VisibleEnemyTurnInfo : public CVisibleInfo
  73. {
  74. std::shared_ptr<CAnimImage> banner;
  75. std::shared_ptr<CShowableAnim> glass;
  76. std::shared_ptr<CShowableAnim> sand;
  77. public:
  78. VisibleEnemyTurnInfo(PlayerColor player);
  79. };
  80. class VisibleGameStatusInfo : public CVisibleInfo
  81. {
  82. std::shared_ptr<CLabel> allyLabel;
  83. std::shared_ptr<CLabel> enemyLabel;
  84. std::vector<std::shared_ptr<CAnimImage>> flags;
  85. std::vector<std::shared_ptr<CAnimImage>> hallIcons;
  86. std::vector<std::shared_ptr<CLabel>> hallLabels;
  87. public:
  88. VisibleGameStatusInfo();
  89. };
  90. class VisibleComponentInfo : public CVisibleInfo
  91. {
  92. std::shared_ptr<CComponent> comp;
  93. std::shared_ptr<CTextBox> text;
  94. public:
  95. VisibleComponentInfo(const Component & compToDisplay, std::string message);
  96. };
  97. enum EState
  98. {
  99. EMPTY, HERO, TOWN, DATE, GAME, AITURN, COMPONENT
  100. };
  101. std::shared_ptr<CVisibleInfo> visibleInfo;
  102. EState state;
  103. //removes all information about current state, deactivates timer (if any)
  104. void reset();
  105. void tick() override;
  106. void clickLeft(tribool down, bool previousState) override;
  107. void clickRight(tribool down, bool previousState) override;
  108. void hover(bool on) override;
  109. void playNewDaySound();
  110. public:
  111. CInfoBar(const Rect & pos);
  112. /// show new day/week animation
  113. void showDate();
  114. /// show component for 3 seconds. Used to display picked up resources
  115. void showComponent(const Component & comp, std::string message);
  116. /// print enemy turn progress
  117. void startEnemyTurn(PlayerColor color);
  118. /// reset to default view - selected object
  119. void showSelection();
  120. /// show hero\town information
  121. void showHeroSelection(const CGHeroInstance * hero);
  122. void showTownSelection(const CGTownInstance * town);
  123. /// for 3 seconds shows amount of town halls and players status
  124. void showGameStatus();
  125. };