1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00
This commit is contained in:
Laserlicht
2025-09-21 19:35:23 +02:00
parent b93249bba2
commit a833b53432
7 changed files with 67 additions and 15 deletions

View File

@@ -18,15 +18,19 @@
#include "../GameInstance.h"
#include "../gui/TextAlignment.h"
#include "../widgets/Images.h"
#include "../widgets/CComponent.h"
#include "../windows/InfoWindows.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/callback/CCallback.h"
#include "../../lib/texts/CGeneralTextHandler.h"
#include "../../lib/ResourceSet.h"
#include "../../lib/GameLibrary.h"
#include "../../lib/networkPacks/Component.h"
CResDataBar::CResDataBar(const ImagePath & imageName, const Point & position)
{
addUsedEvents(SHOW_POPUP);
pos.x += position.x;
pos.y += position.y;
@@ -89,3 +93,15 @@ void CResDataBar::setPlayerColor(PlayerColor player)
{
background->setPlayerColor(player);
}
void CResDataBar::showPopupWindow(const Point & cursorPosition)
{
if((cursorPosition.x - pos.x) > 600)
return;
std::vector<std::shared_ptr<CComponent>> comp;
for(auto i = 0; i < GameConstants::RESOURCE_QUANTITY - 1; i++)
comp.push_back(std::make_shared<CComponent>(ComponentType::RESOURCE, GameResID(i), GAME->interface()->cb->getResourceAmount(i)));
CRClickPopup::createAndPush(LIBRARY->generaltexth->translate("core.genrltxt.270"), comp);
}