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

Initial part of dynamically-sized adventure map:

- removed no longer used CConfigHandler
- remove no longer use resolutions.json
- moved widget management from adventure map to a separate class
- adventure map layout is now loaded from config
This commit is contained in:
Ivan Savenko
2023-04-26 15:44:10 +03:00
parent cb8201876b
commit a015bf6507
28 changed files with 1335 additions and 884 deletions

View File

@@ -399,7 +399,7 @@ void CGStatusBar::clear()
write({});
}
CGStatusBar::CGStatusBar(std::shared_ptr<CPicture> background_, EFonts Font, ETextAlignment Align, const SDL_Color & Color)
CGStatusBar::CGStatusBar(std::shared_ptr<CIntObject> background_, EFonts Font, ETextAlignment Align, const SDL_Color & Color)
: CLabel(background_->pos.x, background_->pos.y, Font, Align, Color, "")
, enteringText(false)
{
@@ -419,14 +419,15 @@ CGStatusBar::CGStatusBar(int x, int y, std::string name, int maxw)
addUsedEvents(LCLICK);
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
background = std::make_shared<CPicture>(name);
auto backgroundImage = std::make_shared<CPicture>(name);
background = backgroundImage;
pos = background->pos;
if((unsigned)maxw < (unsigned)pos.w) //(insigned)-1 > than any correct value of pos.w
{
//execution of this block when maxw is incorrect breaks text centralization (issue #3151)
vstd::amin(pos.w, maxw);
background->srcRect = Rect(0, 0, maxw, pos.h);
backgroundImage->srcRect = Rect(0, 0, maxw, pos.h);
}
autoRedraw = false;
}