mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
Merge pull request #5216 from GeorgeK1ng/random_menu_background
Ability to use random main menu background
This commit is contained in:
commit
08b513a7cd
@ -76,7 +76,13 @@ CMenuScreen::CMenuScreen(const JsonNode & configNode)
|
||||
{
|
||||
OBJECT_CONSTRUCTION;
|
||||
|
||||
background = std::make_shared<CPicture>(ImagePath::fromJson(config["background"]));
|
||||
const auto& bgConfig = config["background"];
|
||||
if (bgConfig.isVector() && !bgConfig.Vector().empty())
|
||||
background = std::make_shared<CPicture>(ImagePath::fromJson(*RandomGeneratorUtil::nextItem(bgConfig.Vector(), CRandomGenerator::getDefault())));
|
||||
|
||||
if (bgConfig.isString())
|
||||
background = std::make_shared<CPicture>(ImagePath::fromJson(bgConfig));
|
||||
|
||||
if(config["scalable"].Bool())
|
||||
background->scaleTo(GH.screenDimensions());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user