CHighScoreScreen.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. class CButton;
  13. class CLabel;
  14. class CMultiLineLabel;
  15. class CAnimImage;
  16. class CTextInput;
  17. class HighScoreParameter
  18. {
  19. public:
  20. int difficulty;
  21. int day;
  22. int townAmount;
  23. bool usedCheat;
  24. bool hasGrail;
  25. bool allDefeated;
  26. };
  27. class HighScoreCalculation
  28. {
  29. public:
  30. std::vector<HighScoreParameter> parameters = std::vector<HighScoreParameter>();
  31. int calculate();
  32. };
  33. class CHighScoreScreen : public CWindowObject
  34. {
  35. enum HighScorePage { SCENARIO, CAMPAIGN };
  36. void addButtons();
  37. void addHighScores();
  38. void buttonCampaginClick();
  39. void buttonStandardClick();
  40. void buttonResetClick();
  41. void buttonExitClick();
  42. HighScorePage highscorepage = HighScorePage::SCENARIO;
  43. std::shared_ptr<CPicture> background;
  44. std::vector<std::shared_ptr<CButton>> buttons;
  45. std::vector<std::shared_ptr<CLabel>> texts;
  46. std::vector<std::shared_ptr<CAnimImage>> images;
  47. public:
  48. CHighScoreScreen();
  49. };
  50. class CHighScoreInput : public CWindowObject
  51. {
  52. std::shared_ptr<CPicture> background;
  53. std::shared_ptr<CMultiLineLabel> text;
  54. std::shared_ptr<CButton> buttonOk;
  55. std::shared_ptr<CButton> buttonCancel;
  56. std::shared_ptr<CGStatusBar> statusBar;
  57. std::shared_ptr<CTextInput> textInput;
  58. std::function<void(std::string text)> ready;
  59. void okay();
  60. void abort();
  61. public:
  62. CHighScoreInput(std::function<void(std::string text)> readyCB);
  63. };
  64. class CHighScoreInputScreen : public CWindowObject
  65. {
  66. std::vector<std::shared_ptr<CMultiLineLabel>> texts;
  67. std::shared_ptr<CHighScoreInput> input;
  68. std::string video;
  69. bool won;
  70. public:
  71. CHighScoreInputScreen(bool won, HighScoreCalculation calc);
  72. void addEntry(std::string text);
  73. void show(Canvas & to) override;
  74. void activate() override;
  75. void deactivate() override;
  76. void clickPressed(const Point & cursorPosition) override;
  77. };