CBonusSelection.h 2.5 KB

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