2023-09-22 01:39:35 +02:00
|
|
|
/*
|
|
|
|
* CHighScoreScreen.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "../windows/CWindowObject.h"
|
2024-07-26 03:33:44 +02:00
|
|
|
#include "../../lib/gameState/HighScore.h"
|
2023-09-22 01:39:35 +02:00
|
|
|
|
|
|
|
class CButton;
|
|
|
|
class CLabel;
|
2023-09-22 20:39:20 +02:00
|
|
|
class CMultiLineLabel;
|
2023-09-22 01:39:35 +02:00
|
|
|
class CAnimImage;
|
2023-09-22 20:39:20 +02:00
|
|
|
class CTextInput;
|
2024-05-15 18:34:23 +02:00
|
|
|
class VideoWidgetBase;
|
2024-05-18 19:58:51 +02:00
|
|
|
class CFilledTexture;
|
2023-09-22 01:39:35 +02:00
|
|
|
|
2023-09-23 16:28:28 +02:00
|
|
|
class TransparentFilledRectangle;
|
|
|
|
|
2023-09-22 01:39:35 +02:00
|
|
|
class CHighScoreScreen : public CWindowObject
|
|
|
|
{
|
2023-09-23 13:14:45 +02:00
|
|
|
public:
|
2023-09-23 14:51:39 +02:00
|
|
|
enum HighScorePage { SCENARIO, CAMPAIGN };
|
2023-09-22 01:39:35 +02:00
|
|
|
|
2023-09-23 13:14:45 +02:00
|
|
|
private:
|
2023-09-23 14:51:39 +02:00
|
|
|
void addButtons();
|
|
|
|
void addHighScores();
|
|
|
|
|
2023-09-23 20:41:30 +02:00
|
|
|
void buttonCampaignClick();
|
|
|
|
void buttonScenarioClick();
|
2023-09-23 14:51:39 +02:00
|
|
|
void buttonResetClick();
|
|
|
|
void buttonExitClick();
|
|
|
|
|
|
|
|
void showPopupWindow(const Point & cursorPosition) override;
|
|
|
|
|
|
|
|
HighScorePage highscorepage;
|
|
|
|
|
|
|
|
std::shared_ptr<CPicture> background;
|
2024-05-18 19:58:51 +02:00
|
|
|
std::shared_ptr<CFilledTexture> backgroundAroundMenu;
|
2023-09-23 14:51:39 +02:00
|
|
|
std::vector<std::shared_ptr<CButton>> buttons;
|
|
|
|
std::vector<std::shared_ptr<CLabel>> texts;
|
|
|
|
std::vector<std::shared_ptr<CAnimImage>> images;
|
|
|
|
|
2023-09-24 02:00:42 +02:00
|
|
|
const int screenRows = 11;
|
|
|
|
|
2023-09-23 14:51:39 +02:00
|
|
|
int highlighted;
|
2023-09-22 01:39:35 +02:00
|
|
|
public:
|
2023-09-25 18:06:40 +02:00
|
|
|
CHighScoreScreen(HighScorePage highscorepage, int highlighted = -1);
|
2023-09-22 01:39:35 +02:00
|
|
|
};
|
2023-09-22 20:39:20 +02:00
|
|
|
|
|
|
|
class CHighScoreInput : public CWindowObject
|
|
|
|
{
|
2023-09-23 14:51:39 +02:00
|
|
|
std::shared_ptr<CMultiLineLabel> text;
|
|
|
|
std::shared_ptr<CButton> buttonOk;
|
2023-09-22 20:39:20 +02:00
|
|
|
std::shared_ptr<CButton> buttonCancel;
|
|
|
|
std::shared_ptr<CGStatusBar> statusBar;
|
2023-09-23 14:51:39 +02:00
|
|
|
std::shared_ptr<CTextInput> textInput;
|
2023-09-22 20:39:20 +02:00
|
|
|
|
2023-09-23 14:51:39 +02:00
|
|
|
std::function<void(std::string text)> ready;
|
|
|
|
|
|
|
|
void okay();
|
|
|
|
void abort();
|
2023-09-22 20:39:20 +02:00
|
|
|
public:
|
2023-09-26 22:06:04 +02:00
|
|
|
CHighScoreInput(std::string playerName, std::function<void(std::string text)> readyCB);
|
2023-09-22 20:39:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CHighScoreInputScreen : public CWindowObject
|
|
|
|
{
|
2023-09-23 14:51:39 +02:00
|
|
|
std::vector<std::shared_ptr<CMultiLineLabel>> texts;
|
|
|
|
std::shared_ptr<CHighScoreInput> input;
|
2023-09-23 16:28:28 +02:00
|
|
|
std::shared_ptr<TransparentFilledRectangle> background;
|
2024-05-15 18:34:23 +02:00
|
|
|
std::shared_ptr<VideoWidgetBase> videoPlayer;
|
2024-05-18 19:58:51 +02:00
|
|
|
std::shared_ptr<CFilledTexture> backgroundAroundMenu;
|
2023-09-22 21:45:12 +02:00
|
|
|
|
2023-09-23 14:51:39 +02:00
|
|
|
bool won;
|
|
|
|
HighScoreCalculation calc;
|
2023-09-22 20:39:20 +02:00
|
|
|
public:
|
2023-09-23 00:21:36 +02:00
|
|
|
CHighScoreInputScreen(bool won, HighScoreCalculation calc);
|
2023-09-22 20:39:20 +02:00
|
|
|
|
2023-09-23 14:51:39 +02:00
|
|
|
int addEntry(std::string text);
|
2023-09-22 20:39:20 +02:00
|
|
|
|
|
|
|
void clickPressed(const Point & cursorPosition) override;
|
2023-09-23 15:11:48 +02:00
|
|
|
void keyPressed(EShortcut key) override;
|
2024-05-15 18:34:23 +02:00
|
|
|
void show(Canvas & to) override;
|
2024-05-02 21:14:50 +02:00
|
|
|
};
|