1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
vcmi/client/adventureMap/TurnTimerWidget.h

54 lines
1.5 KiB
C++
Raw Normal View History

2023-08-13 12:06:35 +02:00
/*
2023-08-13 21:50:40 +02:00
* TurnTimerWidget.h, part of VCMI engine
2023-08-13 12:06:35 +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
*
*/
#pragma once
#include "../gui/CIntObject.h"
2023-08-13 23:13:37 +02:00
#include "../render/Colors.h"
#include "../../lib/TurnTimerInfo.h"
2023-08-13 12:06:35 +02:00
class CAnimImage;
class CLabel;
class CFilledTexture;
class TransparentFilledRectangle;
2023-08-13 12:06:35 +02:00
2023-08-26 04:15:28 +02:00
VCMI_LIB_NAMESPACE_BEGIN
class PlayerColor;
VCMI_LIB_NAMESPACE_END
class TurnTimerWidget : public CIntObject
2023-08-13 12:06:35 +02:00
{
int lastSoundCheckSeconds;
bool isBattleMode;
2023-12-22 22:46:29 +02:00
const std::set<int> notificationThresholds = {1, 2, 3, 4, 5, 10, 20, 30};
std::map<PlayerColor, std::shared_ptr<CLabel>> playerLabelsMain;
std::map<PlayerColor, std::shared_ptr<CLabel>> playerLabelsBattle;
std::map<PlayerColor, std::shared_ptr<CLabel>> playerLabelsUnit;
std::shared_ptr<CFilledTexture> backgroundTexture;
std::shared_ptr<TransparentFilledRectangle> backgroundBorder;
void updateTimer(PlayerColor player, uint32_t msPassed);
2023-08-13 12:06:35 +02:00
void show(Canvas & to) override;
void tick(uint32_t msPassed) override;
void updateNotifications(PlayerColor player, int timeMs);
void updateTextLabel(PlayerColor player, const TurnTimerInfo & timer);
public:
/// Activates adventure map mode in which widget will display timer for all players
TurnTimerWidget(const Point & position);
2023-08-13 12:06:35 +02:00
/// Activates battle mode in which timer displays only timer of specific player
TurnTimerWidget(const Point & position, PlayerColor player);
2023-08-13 12:06:35 +02:00
};