CCampaignScreen.h 1.6 KB

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