2017-07-13 10:26:03 +02:00
|
|
|
/*
|
2023-02-01 16:42:03 +02:00
|
|
|
* CInfoBar.h, part of VCMI engine
|
2017-07-13 10:26:03 +02:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
2012-06-13 16:04:06 +03:00
|
|
|
#pragma once
|
|
|
|
|
2023-02-01 20:42:06 +02:00
|
|
|
#include "../gui/CIntObject.h"
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2012-06-13 16:04:06 +03:00
|
|
|
class CGHeroInstance;
|
|
|
|
class CGTownInstance;
|
|
|
|
struct Component;
|
2023-02-01 20:42:06 +02:00
|
|
|
class PlayerColor;
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
|
|
|
class CAnimImage;
|
|
|
|
class CShowableAnim;
|
|
|
|
class CComponent;
|
2018-04-07 13:34:11 +02:00
|
|
|
class CHeroTooltip;
|
|
|
|
class CTownTooltip;
|
2023-02-01 20:42:06 +02:00
|
|
|
class CLabel;
|
2018-04-07 13:34:11 +02:00
|
|
|
class CTextBox;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
/// Info box which shows next week/day information, hold the current date
|
|
|
|
class CInfoBar : public CIntObject
|
|
|
|
{
|
|
|
|
//all visible information located in one object - for ease of replacing
|
|
|
|
class CVisibleInfo : public CIntObject
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
public:
|
|
|
|
void show(SDL_Surface * to) override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::shared_ptr<CPicture> background;
|
|
|
|
std::list<std::shared_ptr<CIntObject>> forceRefresh;
|
|
|
|
|
|
|
|
CVisibleInfo();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EmptyVisibleInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EmptyVisibleInfo();
|
|
|
|
};
|
|
|
|
|
|
|
|
class VisibleHeroInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CHeroTooltip> heroTooltip;
|
|
|
|
public:
|
|
|
|
VisibleHeroInfo(const CGHeroInstance * hero);
|
|
|
|
};
|
|
|
|
|
|
|
|
class VisibleTownInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CTownTooltip> townTooltip;
|
|
|
|
public:
|
|
|
|
VisibleTownInfo(const CGTownInstance * town);
|
|
|
|
};
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
class VisibleDateInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CShowableAnim> animation;
|
|
|
|
std::shared_ptr<CLabel> label;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
std::string getNewDayName();
|
2018-04-07 13:34:11 +02:00
|
|
|
public:
|
|
|
|
VisibleDateInfo();
|
|
|
|
};
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
class VisibleEnemyTurnInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CAnimImage> banner;
|
|
|
|
std::shared_ptr<CShowableAnim> glass;
|
|
|
|
std::shared_ptr<CShowableAnim> sand;
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
2018-04-07 13:34:11 +02:00
|
|
|
VisibleEnemyTurnInfo(PlayerColor player);
|
|
|
|
};
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
class VisibleGameStatusInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CLabel> allyLabel;
|
|
|
|
std::shared_ptr<CLabel> enemyLabel;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::vector<std::shared_ptr<CAnimImage>> flags;
|
|
|
|
std::vector<std::shared_ptr<CAnimImage>> hallIcons;
|
|
|
|
std::vector<std::shared_ptr<CLabel>> hallLabels;
|
|
|
|
public:
|
|
|
|
VisibleGameStatusInfo();
|
|
|
|
};
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
class VisibleComponentInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CComponent> comp;
|
|
|
|
std::shared_ptr<CTextBox> text;
|
|
|
|
public:
|
|
|
|
VisibleComponentInfo(const Component & compToDisplay, std::string message);
|
2012-06-13 16:04:06 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
enum EState
|
|
|
|
{
|
|
|
|
EMPTY, HERO, TOWN, DATE, GAME, AITURN, COMPONENT
|
|
|
|
};
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CVisibleInfo> visibleInfo;
|
2012-06-13 16:04:06 +03:00
|
|
|
EState state;
|
|
|
|
|
|
|
|
//removes all information about current state, deactivates timer (if any)
|
2018-04-07 13:34:11 +02:00
|
|
|
void reset();
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void tick() override;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void hover(bool on) override;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
void playNewDaySound();
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
CInfoBar(const Rect & pos);
|
|
|
|
|
|
|
|
/// show new day/week animation
|
|
|
|
void showDate();
|
|
|
|
|
|
|
|
/// show component for 3 seconds. Used to display picked up resources
|
2012-09-26 16:13:39 +03:00
|
|
|
void showComponent(const Component & comp, std::string message);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
/// print enemy turn progress
|
2013-03-03 20:06:03 +03:00
|
|
|
void startEnemyTurn(PlayerColor color);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2012-06-22 14:40:16 +03:00
|
|
|
/// reset to default view - selected object
|
|
|
|
void showSelection();
|
|
|
|
|
2012-06-13 16:04:06 +03:00
|
|
|
/// show hero\town information
|
2012-06-22 14:40:16 +03:00
|
|
|
void showHeroSelection(const CGHeroInstance * hero);
|
|
|
|
void showTownSelection(const CGTownInstance * town);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
/// for 3 seconds shows amount of town halls and players status
|
|
|
|
void showGameStatus();
|
2013-11-07 15:48:41 +03:00
|
|
|
};
|
2014-07-13 18:39:45 +03:00
|
|
|
|