1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

highscore input window

This commit is contained in:
Laserlicht
2023-09-22 20:39:20 +02:00
committed by GitHub
parent fe0adfa4bd
commit a4cb74f0dc
5 changed files with 262 additions and 132 deletions

View File

@@ -12,11 +12,13 @@
class CButton;
class CLabel;
class CMultiLineLabel;
class CAnimImage;
class CTextInput;
class CHighScoreScreen : public CWindowObject
{
enum HighScorePage { STANDARD, CAMPAIGN };
enum HighScorePage { SCENARIO, CAMPAIGN };
void addButtons();
void addHighScores();
@@ -26,7 +28,7 @@ class CHighScoreScreen : public CWindowObject
void buttonResetClick();
void buttonExitClick();
HighScorePage highscorepage = HighScorePage::STANDARD;
HighScorePage highscorepage = HighScorePage::SCENARIO;
std::shared_ptr<CPicture> background;
std::vector<std::shared_ptr<CButton>> buttons;
@@ -35,3 +37,35 @@ class CHighScoreScreen : public CWindowObject
public:
CHighScoreScreen();
};
class CHighScoreInput : public CWindowObject
{
std::shared_ptr<CPicture> background;
std::shared_ptr<CMultiLineLabel> text;
std::shared_ptr<CButton> buttonOk;
std::shared_ptr<CButton> buttonCancel;
std::shared_ptr<CGStatusBar> statusBar;
std::shared_ptr<CTextInput> textInput;
std::function<void(std::string text)> ready;
void okay();
void abort();
public:
CHighScoreInput(std::function<void(std::string text)> readyCB);
};
class CHighScoreInputScreen : public CWindowObject
{
std::vector<std::shared_ptr<CMultiLineLabel>> texts;
std::shared_ptr<CHighScoreInput> input;
public:
CHighScoreInputScreen();
void addEntry(std::string text);
void show(Canvas & to) override;
void activate() override;
void deactivate() override;
void clickPressed(const Point & cursorPosition) override;
};