From 40405113c670b85397e645c35f5133014c686f98 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sun, 21 Sep 2025 19:54:25 +0200 Subject: [PATCH] draw multiple --- client/adventureMap/AdventureMapWidget.cpp | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/client/adventureMap/AdventureMapWidget.cpp b/client/adventureMap/AdventureMapWidget.cpp index f91b2af09..df6d15868 100644 --- a/client/adventureMap/AdventureMapWidget.cpp +++ b/client/adventureMap/AdventureMapWidget.cpp @@ -320,14 +320,32 @@ std::shared_ptr AdventureMapWidget::buildTexturePlayerColored(const std::shared_ptr AdventureMapWidget::buildResourceAdditional(const JsonNode & input) { OBJECT_CONSTRUCTION; + logGlobal->debug("Building widget ResourceAdditional"); Rect area = readTargetArea(input["area"]); auto obj = std::make_shared(); - auto result = std::make_shared(ImagePath::builtin("ResBarElement"), area.topLeft()); - result->setResourcePosition(GameResID::CRYSTAL, Point(35, 3)); - addWidget("", result); - obj->addChild(result.get()); - //auto area = std::make_shared(area) + + int remainingSpace = area.w; + int resElementSize = 84; + int fitOffset = 2; + for (int i = 0; i < 15; i++) // TODO: Replace with resources + { + if(remainingSpace < resElementSize) + break; + + auto res = std::make_shared(ImagePath::builtin("ResBarElement"), area.topRight() + Point(remainingSpace - area.w - resElementSize + fitOffset, 0)); + res->setResourcePosition(GameResID::CRYSTAL, Point(35, 3)); // TODO: Replace with resource + addWidget("", res); + obj->addChild(res.get()); + + remainingSpace -= resElementSize; + } + + area.w = remainingSpace + fitOffset; + auto texture = std::make_shared(area); + addWidget("", texture); + obj->addChild(texture.get()); + return obj; } @@ -389,6 +407,8 @@ void AdventureMapWidget::setPlayerChildren(CIntObject * widget, const PlayerColo if (textureIndexed) textureIndexed->setPlayerColor(player); + + setPlayerChildren(entry, player); } redraw();