CCampaignScreen.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * CCampaignScreen.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 JsonNode;
  14. VCMI_LIB_NAMESPACE_END
  15. class CLabel;
  16. class CPicture;
  17. class CButton;
  18. class CCampaignScreen : public CWindowObject
  19. {
  20. public:
  21. enum CampaignStatus {DEFAULT = 0, ENABLED, DISABLED, COMPLETED}; // the status of the campaign
  22. private:
  23. /// A button which plays a video when you move the mouse cursor over it
  24. class CCampaignButton : public CIntObject
  25. {
  26. private:
  27. std::shared_ptr<CLabel> hoverLabel;
  28. std::shared_ptr<CPicture> graphicsImage;
  29. std::shared_ptr<CPicture> graphicsCompleted;
  30. CampaignStatus status;
  31. std::string campFile; // the filename/resourcename of the campaign
  32. VideoPath video; // the resource name of the video
  33. std::string hoverText;
  34. std::string campaignSet;
  35. void clickReleased(const Point & cursorPosition) override;
  36. void hover(bool on) override;
  37. public:
  38. CCampaignButton(const JsonNode & config, const JsonNode & parentConfig, std::string campaignSet);
  39. void show(Canvas & to) override;
  40. };
  41. std::string campaignSet;
  42. std::vector<std::shared_ptr<CCampaignButton>> campButtons;
  43. std::vector<std::shared_ptr<CPicture>> images;
  44. std::shared_ptr<CButton> buttonBack;
  45. std::shared_ptr<CButton> createExitButton(const JsonNode & button);
  46. public:
  47. CCampaignScreen(const JsonNode & config, std::string campaignSet);
  48. void activate() override;
  49. };