Explorar o código

Support for player-colored images in configurable UI

Ivan Savenko %!s(int64=2) %!d(string=hai) anos
pai
achega
ffb37f067a

+ 4 - 0
client/gui/InterfaceObjectConfigurable.cpp

@@ -13,6 +13,7 @@
 #include "InterfaceObjectConfigurable.h"
 
 #include "../CGameInfo.h"
+#include "../CPlayerInterface.h"
 #include "../gui/CAnimation.h"
 #include "../gui/CGuiHandler.h"
 #include "../widgets/CComponent.h"
@@ -257,6 +258,9 @@ std::shared_ptr<CPicture> InterfaceObjectConfigurable::buildPicture(const JsonNo
 	auto pic = std::make_shared<CPicture>(image, position.x, position.y);
 	if(!config["visible"].isNull())
 		pic->visible = config["visible"].Bool();
+
+	if ( config["playerColored"].Bool() && LOCPLINT)
+		pic->colorize(LOCPLINT->playerID);
 	return pic;
 }
 

+ 2 - 0
config/widgets/battleWindow.json

@@ -4,12 +4,14 @@
 		{
 			"type": "picture",
 			"name": "menuTactics",
+			"playerColored" : true,
 			"position": {"x": 0, "y": 556},
 			"image": "COPLACBR.bmp"
 		},
 		{
 			"type": "picture",
 			"name": "menuBattle",
+			"playerColored" : true,
 			"position": {"x": 0, "y": 556},
 			"image": "CBAR.bmp"
 		},