2
0

CBonusSelection.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * CBonusSelection.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 "../windows/CWindowObject.h"
  12. class SDL_Surface;
  13. class CCampaignState;
  14. class CButton;
  15. class CTextBox;
  16. class CToggleGroup;
  17. class CAnimImage;
  18. class CLabel;
  19. class CFlagBox;
  20. /// Campaign screen where you can choose one out of three starting bonuses
  21. class CBonusSelection : public CWindowObject
  22. {
  23. public:
  24. std::shared_ptr<CCampaignState> getCampaign();
  25. CBonusSelection();
  26. struct SCampPositions
  27. {
  28. std::string campPrefix;
  29. int colorSuffixLength;
  30. struct SRegionDesc
  31. {
  32. std::string infix;
  33. int xpos, ypos;
  34. };
  35. std::vector<SRegionDesc> regions;
  36. };
  37. class CRegion
  38. : public CIntObject
  39. {
  40. CBonusSelection * owner;
  41. std::shared_ptr<CPicture> graphicsNotSelected;
  42. std::shared_ptr<CPicture> graphicsSelected;
  43. std::shared_ptr<CPicture> graphicsStriped;
  44. int idOfMapAndRegion;
  45. bool accessible; // false if region should be striped
  46. bool selectable; // true if region should be selectable
  47. public:
  48. CRegion(int id, bool accessible, bool selectable, const SCampPositions & campDsc);
  49. void updateState();
  50. void clickLeft(tribool down, bool previousState) override;
  51. void clickRight(tribool down, bool previousState) override;
  52. };
  53. void loadPositionsOfGraphics();
  54. void createBonusesIcons();
  55. void updateAfterStateChange();
  56. // Event handlers
  57. void goBack();
  58. void startMap();
  59. void restartMap();
  60. void increaseDifficulty();
  61. void decreaseDifficulty();
  62. std::shared_ptr<CPicture> panelBackground;
  63. std::shared_ptr<CButton> buttonStart;
  64. std::shared_ptr<CButton> buttonRestart;
  65. std::shared_ptr<CButton> buttonBack;
  66. std::shared_ptr<CLabel> campaignName;
  67. std::shared_ptr<CLabel> labelCampaignDescription;
  68. std::shared_ptr<CTextBox> campaignDescription;
  69. std::shared_ptr<CLabel> mapName;
  70. std::shared_ptr<CLabel> labelMapDescription;
  71. std::shared_ptr<CTextBox> mapDescription;
  72. std::vector<SCampPositions> campDescriptions;
  73. std::vector<std::shared_ptr<CRegion>> regions;
  74. std::shared_ptr<CFlagBox> flagbox;
  75. std::shared_ptr<CLabel> labelChooseBonus;
  76. std::shared_ptr<CToggleGroup> groupBonuses;
  77. std::shared_ptr<CLabel> labelDifficulty;
  78. std::array<std::shared_ptr<CAnimImage>, 5> difficultyIcons;
  79. std::shared_ptr<CButton> buttonDifficultyLeft;
  80. std::shared_ptr<CButton> buttonDifficultyRight;
  81. std::shared_ptr<CAnimImage> iconsMapSizes;
  82. };