BattleResultWindow.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * BattleResultWindow.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 "../gui/CIntObject.h"
  12. #include "../../lib/texts/MetaString.h"
  13. #include "../../lib/filesystem/ResourcePath.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. struct BattleResult;
  16. VCMI_LIB_NAMESPACE_END
  17. class CLabel;
  18. class CButton;
  19. class CAnimImage;
  20. class VideoWidget;
  21. class CPlayerInterface;
  22. class CTextBox;
  23. struct BattleResultResources
  24. {
  25. VideoPath prologueVideo;
  26. VideoPath loopedVideo;
  27. AudioPath musicName;
  28. MetaString resultText;
  29. };
  30. /// Class which is responsible for showing the battle result window
  31. class BattleResultWindow : public WindowBase
  32. {
  33. private:
  34. std::shared_ptr<CPicture> background;
  35. std::vector<std::shared_ptr<CLabel>> labels;
  36. std::shared_ptr<CButton> exit;
  37. std::shared_ptr<CButton> repeat;
  38. std::vector<std::shared_ptr<CAnimImage>> icons;
  39. std::shared_ptr<CTextBox> description;
  40. std::shared_ptr<VideoWidget> videoPlayer;
  41. CPlayerInterface & owner;
  42. BattleResultResources getResources(const BattleResult & br);
  43. void buttonPressed(int button); //internal function for button callbacks
  44. public:
  45. BattleResultWindow(const BattleResult & br, CPlayerInterface & _owner, bool allowReplay = false);
  46. void bExitf(); //exit button callback
  47. void bRepeatf(); //repeat button callback
  48. std::function<void(int result)> resultCallback; //callback receiving which button was pressed
  49. void activate() override;
  50. };