CHighScoreScreen.h 2.2 KB

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