1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

configurable window position

This commit is contained in:
Laserlicht
2025-06-19 19:48:02 +02:00
parent fac8fb5952
commit 14f0b82f17
13 changed files with 26 additions and 1 deletions

View File

@ -2120,7 +2120,10 @@ CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner, const ImagePath & i
assert(guildWindow.size() == 1 || guildWindow.size() == GAME->interface()->castleInt->town->getTown()->mageLevel); assert(guildWindow.size() == 1 || guildWindow.size() == GAME->interface()->castleInt->town->getTown()->mageLevel);
auto selectedGuildWindow = guildWindow.size() == 1 ? guildWindow[0] : guildWindow[owner->town->mageGuildLevel() - 1]; auto selectedGuildWindow = guildWindow.size() == 1 ? guildWindow[0] : guildWindow[owner->town->mageGuildLevel() - 1];
window = std::make_shared<CPicture>(selectedGuildWindow, 332, 76); auto windowPosition = owner->town->getTown()->clientInfo.guildWindowPosition;
if(windowPosition == Point(0, 0)) // TODO: remove legacy for compatibility
windowPosition = Point(332, 76);
window = std::make_shared<CPicture>(selectedGuildWindow, windowPosition.x, windowPosition.y);
resdatabar = std::make_shared<CMinorResDataBar>(); resdatabar = std::make_shared<CMinorResDataBar>();
resdatabar->moveBy(pos.topLeft(), true); resdatabar->moveBy(pos.topLeft(), true);

View File

@ -153,6 +153,7 @@
[ { "x": 570, "y": 82 }, { "x": 672, "y": 82 }, { "x": 570, "y": 157 }, { "x": 672, "y": 157 } ], [ { "x": 570, "y": 82 }, { "x": 672, "y": 82 }, { "x": 570, "y": 157 }, { "x": 672, "y": 157 } ],
[ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ] [ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ]
], ],
"guildWindowPosition": { "x": 332, "y": 76 },
"moatAbility" : "castleMoat", "moatAbility" : "castleMoat",
// primaryResource not specified so town get both Wood and Ore for resource bonus // primaryResource not specified so town get both Wood and Ore for resource bonus

View File

@ -158,6 +158,7 @@
[ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ], [ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ] [ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
], ],
"guildWindowPosition": { "x": 332, "y": 76 },
"primaryResource" : "mercury", "primaryResource" : "mercury",
"moatAbility" : "castleMoat", "moatAbility" : "castleMoat",

View File

@ -154,6 +154,7 @@
[ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ], [ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ] [ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
], ],
"guildWindowPosition": { "x": 332, "y": 76 },
"primaryResource" : "sulfur", "primaryResource" : "sulfur",
"moatAbility" : "dungeonMoat", "moatAbility" : "dungeonMoat",

View File

@ -152,6 +152,7 @@
[ { "x": 48, "y": 53 }, { "x": 48, "y": 147 }, { "x": 48, "y": 241 }, { "x": 48, "y": 335 }, { "x": 48, "y": 429 } ], [ { "x": 48, "y": 53 }, { "x": 48, "y": 147 }, { "x": 48, "y": 241 }, { "x": 48, "y": 335 }, { "x": 48, "y": 429 } ],
[ { "x": 570, "y": 82 }, { "x": 672, "y": 82 }, { "x": 570, "y": 157 }, { "x": 672, "y": 157 } ] [ { "x": 570, "y": 82 }, { "x": 672, "y": 82 }, { "x": 570, "y": 157 }, { "x": 672, "y": 157 } ]
], ],
"guildWindowPosition": { "x": 332, "y": 76 },
"moatAbility" : "fortressMoat", "moatAbility" : "fortressMoat",
// primaryResource not specified so town get both Wood and Ore for resource bonus // primaryResource not specified so town get both Wood and Ore for resource bonus

View File

@ -155,6 +155,7 @@
[ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ], [ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ] [ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
], ],
"guildWindowPosition": { "x": 332, "y": 76 },
"primaryResource" : "mercury", "primaryResource" : "mercury",
"moatAbility" : "infernoMoat", "moatAbility" : "infernoMoat",

View File

@ -159,6 +159,7 @@
[ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ], [ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ] [ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
], ],
"guildWindowPosition": { "x": 332, "y": 76 },
"moatAbility" : "necropolisMoat", "moatAbility" : "necropolisMoat",
// primaryResource not specified so town get both Wood and Ore for resource bonus // primaryResource not specified so town get both Wood and Ore for resource bonus

View File

@ -158,6 +158,7 @@
[ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ], [ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ] [ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
], ],
"guildWindowPosition": { "x": 332, "y": 76 },
"primaryResource" : "crystal", "primaryResource" : "crystal",
"moatAbility" : "rampartMoat", "moatAbility" : "rampartMoat",

View File

@ -150,6 +150,7 @@
[ { "x": 48, "y": 53 }, { "x": 48, "y": 147 }, { "x": 48, "y": 241 }, { "x": 48, "y": 335 }, { "x": 48, "y": 429 } ], [ { "x": 48, "y": 53 }, { "x": 48, "y": 147 }, { "x": 48, "y": 241 }, { "x": 48, "y": 335 }, { "x": 48, "y": 429 } ],
[ { "x": 570, "y": 82 }, { "x": 672, "y": 82 }, { "x": 570, "y": 157 }, { "x": 672, "y": 157 } ] [ { "x": 570, "y": 82 }, { "x": 672, "y": 82 }, { "x": 570, "y": 157 }, { "x": 672, "y": 157 } ]
], ],
"guildWindowPosition": { "x": 332, "y": 76 },
"moatAbility" : "strongholdMoat", "moatAbility" : "strongholdMoat",
// primaryResource not specified so town get both Wood and Ore for resource bonus // primaryResource not specified so town get both Wood and Ore for resource bonus

View File

@ -154,6 +154,7 @@
[ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ], [ { "x": 183, "y": 42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ] [ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
], ],
"guildWindowPosition": { "x": 332, "y": 76 },
"moatAbility" : "towerMoat", "moatAbility" : "towerMoat",
"buildings" : "buildings" :

View File

@ -183,6 +183,17 @@
"format" : "imageFile" "format" : "imageFile"
} }
}, },
"guildWindowPosition" : {
"type" : "array",
"items" : {
"type" : "object",
"additionalProperties" : false,
"properties" : {
"x" : { "type" : "number", "description" : "X coordinate on screen" },
"y" : { "type" : "number", "description" : "Y coordinate on screen" }
}
}
},
"guildSpellPositions" : { "guildSpellPositions" : {
"type" : "array", "type" : "array",
"description" : "Positions of spells in mage guild", "description" : "Positions of spells in mage guild",

View File

@ -90,6 +90,7 @@ public:
ImagePath townBackground; ImagePath townBackground;
std::vector<ImagePath> guildBackground; std::vector<ImagePath> guildBackground;
std::vector<ImagePath> guildWindow; std::vector<ImagePath> guildWindow;
Point guildWindowPosition;
std::vector<std::vector<Point>> guildSpellPositions; std::vector<std::vector<Point>> guildSpellPositions;
AnimationPath buildingsIcons; AnimationPath buildingsIcons;
ImagePath hallBackground; ImagePath hallBackground;

View File

@ -565,6 +565,7 @@ void CTownHandler::loadClientData(CTown &town, const JsonNode & source) const
info.townBackground = ImagePath::fromJson(source["townBackground"]); info.townBackground = ImagePath::fromJson(source["townBackground"]);
info.buildingsIcons = AnimationPath::fromJson(source["buildingsIcons"]); info.buildingsIcons = AnimationPath::fromJson(source["buildingsIcons"]);
info.tavernVideo = VideoPath::fromJson(source["tavernVideo"]); info.tavernVideo = VideoPath::fromJson(source["tavernVideo"]);
info.guildWindowPosition = Point(source["guildWindowPosition"]["x"].Integer(), source["guildWindowPosition"]["y"].Integer());
info.guildSpellPositions.clear(); info.guildSpellPositions.clear();
for(auto & level : source["guildSpellPositions"].Vector()) for(auto & level : source["guildSpellPositions"].Vector())