1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

simple resource show on right click

This commit is contained in:
Laserlicht
2025-09-17 18:44:59 +02:00
parent 3d382eefee
commit 0cc9c62e8a
2 changed files with 16 additions and 0 deletions

View File

@@ -18,15 +18,21 @@
#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/entities/ResourceTypeHandler.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 +95,12 @@ void CResDataBar::setPlayerColor(PlayerColor player)
{
background->setPlayerColor(player);
}
void CResDataBar::showPopupWindow(const Point & cursorPosition)
{
std::vector<std::shared_ptr<CComponent>> comp;
for (auto & i : LIBRARY->resourceTypeHandler->getAllObjects())
comp.push_back(std::make_shared<CComponent>(ComponentType::RESOURCE, i, GAME->interface()->cb->getResourceAmount(i)));
CRClickPopup::createAndPush(LIBRARY->generaltexth->translate("core.genrltxt.270"), comp);
}