CHighScoreScreen.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * CHighScoreScreen.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. #include "../../lib/gameState/HighScore.h"
  13. #include "../../lib/gameState/GameStatistics.h"
  14. class CButton;
  15. class CLabel;
  16. class CMultiLineLabel;
  17. class CAnimImage;
  18. class CTextInput;
  19. class VideoWidgetBase;
  20. class CFilledTexture;
  21. class TransparentFilledRectangle;
  22. class CHighScoreScreen : public CWindowObject
  23. {
  24. public:
  25. enum HighScorePage { SCENARIO, CAMPAIGN };
  26. private:
  27. void addButtons();
  28. void addHighScores();
  29. void buttonCampaignClick();
  30. void buttonScenarioClick();
  31. void buttonResetClick();
  32. void buttonExitClick();
  33. void showPopupWindow(const Point & cursorPosition) override;
  34. HighScorePage highscorepage;
  35. std::shared_ptr<CPicture> background;
  36. std::shared_ptr<CFilledTexture> backgroundAroundMenu;
  37. std::vector<std::shared_ptr<CButton>> buttons;
  38. std::vector<std::shared_ptr<CLabel>> texts;
  39. std::vector<std::shared_ptr<CAnimImage>> images;
  40. const int screenRows = 11;
  41. int highlighted;
  42. public:
  43. CHighScoreScreen(HighScorePage highscorepage, int highlighted = -1);
  44. };
  45. class CHighScoreInput : public CWindowObject
  46. {
  47. std::shared_ptr<CMultiLineLabel> text;
  48. std::shared_ptr<CButton> buttonOk;
  49. std::shared_ptr<CButton> buttonCancel;
  50. std::shared_ptr<CGStatusBar> statusBar;
  51. std::shared_ptr<CTextInput> textInput;
  52. std::function<void(std::string text)> ready;
  53. void okay();
  54. void abort();
  55. public:
  56. CHighScoreInput(std::string playerName, std::function<void(std::string text)> readyCB);
  57. };
  58. class CHighScoreInputScreen : public CWindowObject
  59. {
  60. std::vector<std::shared_ptr<CLabel>> texts;
  61. std::shared_ptr<CHighScoreInput> input;
  62. std::shared_ptr<TransparentFilledRectangle> background;
  63. std::shared_ptr<VideoWidgetBase> videoPlayer;
  64. std::shared_ptr<CFilledTexture> backgroundAroundMenu;
  65. std::shared_ptr<CButton> statisticButton;
  66. bool won;
  67. HighScoreCalculation calc;
  68. StatisticDataSet stat;
  69. public:
  70. CHighScoreInputScreen(bool won, HighScoreCalculation calc, const StatisticDataSet & statistic);
  71. int addEntry(std::string text);
  72. void clickPressed(const Point & cursorPosition) override;
  73. void keyPressed(EShortcut key) override;
  74. void show(Canvas & to) override;
  75. };