浏览代码

Merge pull request #6107 from GeorgeK1ng/mainMenu_around

Add possibility to define custom main menu around image
Ivan Savenko 2 月之前
父节点
当前提交
9a95f249fa
共有 2 个文件被更改,包括 15 次插入6 次删除
  1. 7 1
      client/mainmenu/CMainMenu.cpp
  2. 8 5
      config/mainmenu.json

+ 7 - 1
client/mainmenu/CMainMenu.cpp

@@ -335,7 +335,13 @@ CMainMenu::CMainMenu()
 
 	menu = std::make_shared<CMenuScreen>(CMainMenuConfig::get().getConfig()["window"]);
 	OBJECT_CONSTRUCTION;
-	backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
+
+	const auto& bgConfig = CMainMenuConfig::get().getConfig()["backgroundAround"];
+
+	if (bgConfig.isString())
+		backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::fromJson(bgConfig), pos);
+	else
+		backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
 }
 
 CMainMenu::~CMainMenu() = default;

+ 8 - 5
config/mainmenu.json

@@ -1,5 +1,8 @@
 {
-	//images used in game selection screen
+	// Image around main menu
+	"backgroundAround" : "diboxbck",
+	
+	// Images used in game selection screen
 	"scenario-selection" :
 	{
 		"background" : ["gamselb0", "gamselb1"],
@@ -35,17 +38,17 @@
 		
 	},
 	
-	//Multiplayer selection image
+	// Multiplayer selection image
 	"multiplayer" : ["mumap"],
 
-	//Main menu window, consists of several sub-menus aka items
+	// Main menu window, consists of several sub-menus aka items
 	"window":
 	{
-		//"scalable" : true, //background will be scaled to screen size
+		//"scalable" : true, // Background will be scaled to screen size
 		
 		"background" : ["gamselbk"],
 
-		//"video" :    {"x": 8, "y": 105, "name":"CREDITS.SMK" },//Floating WoG logo. Disabled due to different position in various versions of H3.
+		//"video" :    {"x": 8, "y": 105, "name":"CREDITS.SMK" }, // Floating WoG logo. Disabled due to different position in various versions of H3.
 		
 		// Additional images
 		//"images":