1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Always use ResourcePath for referencing images and animations

This commit is contained in:
Ivan Savenko
2023-08-23 15:07:50 +03:00
parent f79492e5b0
commit 823ffa7a07
201 changed files with 1390 additions and 1362 deletions

View File

@@ -80,16 +80,16 @@ CSelectionBase::CSelectionBase(ESelectionScreen type)
pos.h = 584;
if(screenType == ESelectionScreen::campaignList)
{
setBackground("CamCust.bmp");
setBackground(ImagePath::builtin("CamCust.bmp"));
}
else
{
const JsonVector & bgNames = CMainMenuConfig::get().getConfig()["game-select"].Vector();
setBackground(RandomGeneratorUtil::nextItem(bgNames, CRandomGenerator::getDefault())->String());
setBackground(ImagePath::fromJson(*RandomGeneratorUtil::nextItem(bgNames, CRandomGenerator::getDefault())));
}
pos = background->center();
card = std::make_shared<InfoCard>();
buttonBack = std::make_shared<CButton>(Point(581, 535), "SCNRBACK.DEF", CGI->generaltexth->zelp[105], [=](){ close();}, EShortcut::GLOBAL_CANCEL);
buttonBack = std::make_shared<CButton>(Point(581, 535), AnimationPath::builtin("SCNRBACK.DEF"), CGI->generaltexth->zelp[105], [=](){ close();}, EShortcut::GLOBAL_CANCEL);
}
void CSelectionBase::toggleTab(std::shared_ptr<CIntObject> tab)
@@ -125,7 +125,7 @@ InfoCard::InfoCard()
mapName = std::make_shared<CLabel>(26, 39, FONT_BIG, ETextAlignment::TOPLEFT, Colors::YELLOW);
Rect descriptionRect(26, 149, 320, 115);
mapDescription = std::make_shared<CTextBox>("", descriptionRect, 1);
playerListBg = std::make_shared<CPicture>("CHATPLUG.bmp", 16, 276);
playerListBg = std::make_shared<CPicture>(ImagePath::builtin("CHATPLUG.bmp"), 16, 276);
chat = std::make_shared<CChatBox>(Rect(26, 132, 340, 132));
if(SEL->screenType == ESelectionScreen::campaignList)
@@ -134,14 +134,14 @@ InfoCard::InfoCard()
}
else
{
background = std::make_shared<CPicture>("GSELPOP1.bmp", 0, 0);
background = std::make_shared<CPicture>(ImagePath::builtin("GSELPOP1.bmp"), 0, 0);
parent->addChild(background.get());
auto it = vstd::find(parent->children, this); //our position among parent children
parent->children.insert(it, background.get()); //put BG before us
parent->children.pop_back();
pos.w = background->pos.w;
pos.h = background->pos.h;
iconsMapSizes = std::make_shared<CAnimImage>("SCNRMPSZ", 4, 0, 318, 22); //let it be custom size (frame 4) by default
iconsMapSizes = std::make_shared<CAnimImage>(AnimationPath::builtin("SCNRMPSZ"), 4, 0, 318, 22); //let it be custom size (frame 4) by default
iconDifficulty = std::make_shared<CToggleGroup>(0);
{
@@ -149,7 +149,7 @@ InfoCard::InfoCard()
for(int i = 0; i < 5; i++)
{
auto button = std::make_shared<CToggleButton>(Point(110 + i * 32, 450), difButns[i], CGI->generaltexth->zelp[24 + i]);
auto button = std::make_shared<CToggleButton>(Point(110 + i * 32, 450), AnimationPath::builtin(difButns[i]), CGI->generaltexth->zelp[24 + i]);
iconDifficulty->addToggle(i, button);
if(SEL->screenType != ESelectionScreen::newGame)
@@ -165,8 +165,8 @@ InfoCard::InfoCard()
labelScenarioDescription = std::make_shared<CLabel>(26, 132, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[496]);
labelVictoryCondition = std::make_shared<CLabel>(26, 283, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[497]);
labelLossCondition = std::make_shared<CLabel>(26, 339, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[498]);
iconsVictoryCondition = std::make_shared<CAnimImage>("SCNRVICT", 0, 0, 24, 302);
iconsLossCondition = std::make_shared<CAnimImage>("SCNRLOSS", 0, 0, 24, 359);
iconsVictoryCondition = std::make_shared<CAnimImage>(AnimationPath::builtin("SCNRVICT"), 0, 0, 24, 302);
iconsLossCondition = std::make_shared<CAnimImage>(AnimationPath::builtin("SCNRLOSS"), 0, 0, 24, 359);
labelVictoryConditionText = std::make_shared<CLabel>(60, 307, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
labelLossConditionText = std::make_shared<CLabel>(60, 366, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
@@ -356,7 +356,7 @@ CFlagBox::CFlagBox(const Rect & rect)
labelAllies = std::make_shared<CLabel>(0, 0, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[390] + ":");
labelEnemies = std::make_shared<CLabel>(133, 0, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[391] + ":");
iconsTeamFlags = std::make_shared<CAnimation>("ITGFLAGS.DEF");
iconsTeamFlags = std::make_shared<CAnimation>(AnimationPath::builtin("ITGFLAGS.DEF"));
iconsTeamFlags->preload();
}
@@ -390,7 +390,7 @@ void CFlagBox::showPopupWindow(const Point & cursorPosition)
}
CFlagBox::CFlagBoxTooltipBox::CFlagBoxTooltipBox(std::shared_ptr<CAnimation> icons)
: CWindowObject(BORDERED | RCLICK_POPUP | SHADOW_DISABLED, "DIBOXBCK")
: CWindowObject(BORDERED | RCLICK_POPUP | SHADOW_DISABLED, ImagePath::builtin("DIBOXBCK"))
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;