2025-10-18 21:43:05 +02:00
|
|
|
/*
|
|
|
|
|
* BattleOnlyMode.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"
|
2025-10-19 15:10:43 +02:00
|
|
|
#include "../../lib/constants/EntityIdentifiers.h"
|
2025-10-18 21:43:05 +02:00
|
|
|
|
2025-10-24 01:15:43 +02:00
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
class CGHeroInstance;
|
|
|
|
|
class CCreatureSet;
|
|
|
|
|
class CMap;
|
|
|
|
|
class EditorCallback;
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
|
2025-10-18 21:43:05 +02:00
|
|
|
class FilledTexturePlayerColored;
|
|
|
|
|
class CButton;
|
2025-10-19 15:10:43 +02:00
|
|
|
class CPicture;
|
|
|
|
|
class CLabel;
|
|
|
|
|
class BattleOnlyModeWindow;
|
|
|
|
|
class CAnimImage;
|
|
|
|
|
class GraphicalPrimitiveCanvas;
|
|
|
|
|
class CTextInput;
|
|
|
|
|
class TransparentFilledRectangle;
|
2025-10-18 21:43:05 +02:00
|
|
|
|
|
|
|
|
class BattleOnlyMode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static void openBattleWindow();
|
|
|
|
|
};
|
2025-10-19 15:10:43 +02:00
|
|
|
|
|
|
|
|
class NumberInputWindow : public CWindowObject
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
|
|
|
|
|
std::shared_ptr<TransparentFilledRectangle> backgroundOverlay;
|
|
|
|
|
std::shared_ptr<CButton> buttonOk;
|
|
|
|
|
std::shared_ptr<CTextInput> input;
|
|
|
|
|
public:
|
|
|
|
|
NumberInputWindow(int initialValue, std::function<void(int)> onValueSelected);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class BattleOnlyModeHeroSelector : public CIntObject
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
BattleOnlyModeWindow& parent;
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<CPicture> backgroundImage;
|
|
|
|
|
std::shared_ptr<CPicture> heroImage;
|
|
|
|
|
std::shared_ptr<CLabel> heroLabel;
|
|
|
|
|
std::vector<std::shared_ptr<CPicture>> creatureImage;
|
|
|
|
|
std::vector<std::shared_ptr<CLabel>> creatureImageLabel;
|
|
|
|
|
|
|
|
|
|
void setHeroIcon();
|
|
|
|
|
void setCreatureIcons();
|
|
|
|
|
public:
|
|
|
|
|
std::vector<std::shared_ptr<CAnimImage>> primSkills;
|
|
|
|
|
std::vector<std::shared_ptr<GraphicalPrimitiveCanvas>> primSkillsBorder;
|
|
|
|
|
std::vector<std::shared_ptr<CTextInput>> primSkillsInput;
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<CGHeroInstance> selectedHero;
|
|
|
|
|
std::shared_ptr<CCreatureSet> selectedArmy;
|
|
|
|
|
|
|
|
|
|
BattleOnlyModeHeroSelector(BattleOnlyModeWindow& parent, Point position);
|
|
|
|
|
};
|
|
|
|
|
|
2025-10-18 21:43:05 +02:00
|
|
|
class BattleOnlyModeWindow : public CWindowObject
|
|
|
|
|
{
|
2025-10-19 15:10:43 +02:00
|
|
|
friend class BattleOnlyModeHeroSelector;
|
2025-10-18 21:43:05 +02:00
|
|
|
private:
|
2025-10-19 15:10:43 +02:00
|
|
|
std::unique_ptr<CMap> map;
|
|
|
|
|
std::shared_ptr<EditorCallback> cb;
|
|
|
|
|
|
2025-10-18 21:43:05 +02:00
|
|
|
std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
|
|
|
|
|
std::shared_ptr<CButton> buttonOk;
|
|
|
|
|
std::shared_ptr<CButton> buttonAbort;
|
2025-10-19 15:10:43 +02:00
|
|
|
std::shared_ptr<CLabel> title;
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<CButton> battlegroundSelector;
|
|
|
|
|
std::shared_ptr<BattleOnlyModeHeroSelector> heroSelector1;
|
|
|
|
|
std::shared_ptr<BattleOnlyModeHeroSelector> heroSelector2;
|
2025-10-18 21:43:05 +02:00
|
|
|
|
2025-10-19 15:10:43 +02:00
|
|
|
TerrainId selectedTerrain;
|
|
|
|
|
FactionID selectedTown;
|
|
|
|
|
|
|
|
|
|
void init();
|
|
|
|
|
void setTerrainButtonText();
|
|
|
|
|
void setOkButtonEnabled();
|
2025-10-18 21:43:05 +02:00
|
|
|
void startBattle();
|
|
|
|
|
public:
|
|
|
|
|
BattleOnlyModeWindow();
|
2025-10-19 15:10:43 +02:00
|
|
|
};
|