diff --git a/client/windows/CHeroOverview.cpp b/client/windows/CHeroOverview.cpp index 53b9ceb84..857151849 100644 --- a/client/windows/CHeroOverview.cpp +++ b/client/windows/CHeroOverview.cpp @@ -34,24 +34,19 @@ CHeroOverview::CHeroOverview(const HeroTypeID & h) heroIndex = hero.getNum(); - pos = Rect(0, 0, 600, 450 + 35); + pos = Rect(0, 0, 600, 485); - genHeroWindow(); + genBackground(); + genControls(); center(); } -void CHeroOverview::genHeroWindow() +void CHeroOverview::genBackground() { backgroundTexture = std::make_shared(ImagePath::builtin("DIBOXBCK"), pos); updateShadow(); - int yOffset = 35; - int borderOffset = 5; - int alpha = 75; - - ColorRGBA borderColor = ColorRGBA(128, 100, 75); - Canvas canvas = Canvas(Point(pos.w, pos.h)); // hero image @@ -73,23 +68,23 @@ void CHeroOverview::genHeroWindow() canvas.drawBorder(Rect((284 / 4) * i + 21 - 1, 3 * borderOffset + yOffset + 64 + 20 + 1 - 1, 42 + 2, 42 + 2), borderColor); // skill footer - canvas.drawColorBlended(Rect(borderOffset, 4 * borderOffset + yOffset + 64 + 20 + 44, 284, 20), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(borderOffset - 1, 4 * borderOffset + yOffset + 64 + 20 + 44 - 1, 284 + 2, 20 + 2), borderColor); + canvas.drawColorBlended(Rect(borderOffset, 4 * borderOffset + yOffset + 128, 284, 20), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(borderOffset - 1, 4 * borderOffset + yOffset + 128 - 1, 284 + 2, 20 + 2), borderColor); // hero biography - canvas.drawColorBlended(Rect(borderOffset, 5 * borderOffset + yOffset + 64 + 20 + 44 + 20, 284, 130), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(borderOffset - 1, 5 * borderOffset + yOffset + 64 + 20 + 44 + 20 - 1, 284 + 2, 130 + 2), borderColor); + canvas.drawColorBlended(Rect(borderOffset, 5 * borderOffset + yOffset + 148, 284, 130), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(borderOffset - 1, 5 * borderOffset + yOffset + 148 - 1, 284 + 2, 130 + 2), borderColor); // speciality name - canvas.drawColorBlended(Rect(2 * borderOffset + 44, 6 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130, 235, 44), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(2 * borderOffset + 44 - 1, 6 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130 - 1, 235 + 2, 44 + 2), borderColor); + canvas.drawColorBlended(Rect(2 * borderOffset + 44, 6 * borderOffset + yOffset + 278, 235, 44), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(2 * borderOffset + 44 - 1, 6 * borderOffset + yOffset + 278 - 1, 235 + 2, 44 + 2), borderColor); // speciality image - canvas.drawBorder(Rect(borderOffset - 1, 6 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130 - 1, 44 + 2, 44 + 2), borderColor); + canvas.drawBorder(Rect(borderOffset - 1, 6 * borderOffset + yOffset + 278 - 1, 44 + 2, 44 + 2), borderColor); // speciality description - canvas.drawColorBlended(Rect(borderOffset, 7 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130 + 44, 284, 85), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(borderOffset - 1, 7 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130 + 44 - 1, 284 + 2, 85 + 2), borderColor); + canvas.drawColorBlended(Rect(borderOffset, 7 * borderOffset + yOffset + 322, 284, 85), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(borderOffset - 1, 7 * borderOffset + yOffset + 322 - 1, 284 + 2, 85 + 2), borderColor); // army title canvas.drawColorBlended(Rect(302, borderOffset + yOffset, 292, 30), ColorRGBA(0, 0, 0, alpha)); @@ -98,71 +93,74 @@ void CHeroOverview::genHeroWindow() // army for(int i = 0; i < 6; i++) { - int space = (292 - 32 - 6 * 32) / 5; - canvas.drawColorBlended(Rect(302 + i * (32 + space) + 16, 2 * borderOffset + yOffset + 30, 32, 32), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 + i * (32 + space) + 16 - 1, 2 * borderOffset + yOffset + 30 - 1, 32 + 2, 32 + 2), borderColor); + int space = (260 - 6 * 32) / 5; + canvas.drawColorBlended(Rect(318 + i * (32 + space), 2 * borderOffset + yOffset + 30, 32, 32), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(318 + i * (32 + space) - 1, 2 * borderOffset + yOffset + 30 - 1, 32 + 2, 32 + 2), borderColor); } // army footer - canvas.drawColorBlended(Rect(302, 3 * borderOffset + yOffset + 30 + 32, 292, 20), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 - 1, 3 * borderOffset + yOffset + 30 + 32 - 1, 292 + 2, 20 + 2), borderColor); + canvas.drawColorBlended(Rect(302, 3 * borderOffset + yOffset + 62, 292, 20), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(302 - 1, 3 * borderOffset + yOffset + 62 - 1, 292 + 2, 20 + 2), borderColor); // warmachine title - canvas.drawColorBlended(Rect(302, 4 * borderOffset + yOffset + 30 + 32 + 20, 292, 30), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 - 1, 4 * borderOffset + yOffset + 30 + 32 + 20 - 1, 292 + 2, 30 + 2), borderColor); + canvas.drawColorBlended(Rect(302, 4 * borderOffset + yOffset + 82, 292, 30), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(302 - 1, 4 * borderOffset + yOffset + 82 - 1, 292 + 2, 30 + 2), borderColor); // warmachine for(int i = 0; i < 6; i++) { int space = (292 - 32 - 6 * 32) / 5; - canvas.drawColorBlended(Rect(302 + i * (32 + space) + 16, 5 * borderOffset + yOffset + 30 + 32 + 20 + 30, 32, 32), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 + i * (32 + space) + 16 - 1, 5 * borderOffset + yOffset + 30 + 32 + 20 + 30 - 1, 32 + 2, 32 + 2), borderColor); + canvas.drawColorBlended(Rect(318 + i * (32 + space), 5 * borderOffset + yOffset + 112, 32, 32), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(318 + i * (32 + space) - 1, 5 * borderOffset + yOffset + 112 - 1, 32 + 2, 32 + 2), borderColor); } // secskill title - canvas.drawColorBlended(Rect(302, 6 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32, (292 / 2) - 2 * borderOffset, 30), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 - 1, 6 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 - 1, (292 / 2) - 2 * borderOffset + 2, 30 + 2), borderColor); + canvas.drawColorBlended(Rect(302, 6 * borderOffset + yOffset + 144, (292 / 2) - 2 * borderOffset, 30), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(302 - 1, 6 * borderOffset + yOffset + 144 - 1, (292 / 2) - 2 * borderOffset + 2, 30 + 2), borderColor); // vertical line - canvas.drawLine(Point(302 + (292 / 2), 6 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 - 1), Point(302 + (292 / 2), 6 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 - 2 + 254), borderColor, borderColor); + canvas.drawLine(Point(302 + (292 / 2), 6 * borderOffset + yOffset + 144 - 1), Point(302 + (292 / 2), 6 * borderOffset + yOffset + 144 - 2 + 254), borderColor, borderColor); // spell title - canvas.drawColorBlended(Rect(302 + (292 / 2) + 2 * borderOffset, 6 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32, (292 / 2) - 2 * borderOffset, 30), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 + (292 / 2) + 2 * borderOffset - 1, 6 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 - 1, (292 / 2) - 2 * borderOffset + 2, 30 + 2), borderColor); + canvas.drawColorBlended(Rect(302 + (292 / 2) + 2 * borderOffset, 6 * borderOffset + yOffset + 144, (292 / 2) - 2 * borderOffset, 30), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(302 + (292 / 2) + 2 * borderOffset - 1, 6 * borderOffset + yOffset + 144 - 1, (292 / 2) - 2 * borderOffset + 2, 30 + 2), borderColor); // secskill for(int i = 0; i < 6; i++) { - canvas.drawColorBlended(Rect(302, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset), 32, 32), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 - 1, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset) - 1, 32 + 2, 32 + 2), borderColor); - canvas.drawColorBlended(Rect(302 + 32 + borderOffset, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset), (292 / 2) - 32 - 3 * borderOffset, 32), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 + 32 + borderOffset - 1, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset) - 1, (292 / 2) - 32 - 3 * borderOffset + 2, 32 + 2), borderColor); + canvas.drawColorBlended(Rect(302, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), 32, 32), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(302 - 1, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset) - 1, 32 + 2, 32 + 2), borderColor); + canvas.drawColorBlended(Rect(302 + 32 + borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), (292 / 2) - 32 - 3 * borderOffset, 32), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(302 + 32 + borderOffset - 1, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset) - 1, (292 / 2) - 32 - 3 * borderOffset + 2, 32 + 2), borderColor); } // spell for(int i = 0; i < 6; i++) { - canvas.drawColorBlended(Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset), 32, 32), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 + (292 / 2) + 2 * borderOffset - 1, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset) - 1, 32 + 2, 32 + 2), borderColor); - canvas.drawColorBlended(Rect(302 + (292 / 2) + 2 * borderOffset + 32 + borderOffset, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset), (292 / 2) - 32 - 3 * borderOffset, 32), ColorRGBA(0, 0, 0, alpha)); - canvas.drawBorder(Rect(302 + (292 / 2) + 2 * borderOffset + 32 + borderOffset - 1, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset) - 1, (292 / 2) - 32 - 3 * borderOffset + 2, 32 + 2), borderColor); + canvas.drawColorBlended(Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), 32, 32), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(302 + (292 / 2) + 2 * borderOffset - 1, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset) - 1, 32 + 2, 32 + 2), borderColor); + canvas.drawColorBlended(Rect(302 + (292 / 2) + 2 * borderOffset + 32 + borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), (292 / 2) - 32 - 3 * borderOffset, 32), ColorRGBA(0, 0, 0, alpha)); + canvas.drawBorder(Rect(302 + (292 / 2) + 2 * borderOffset + 32 + borderOffset - 1, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset) - 1, (292 / 2) - 32 - 3 * borderOffset + 2, 32 + 2), borderColor); } std::shared_ptr backgroundShapesImg = GH.renderHandler().createImage(canvas.getInternalSurface()); backgroundShapes = std::make_shared(backgroundShapesImg, pos); +} +void CHeroOverview::genControls() +{ labelTitle = std::make_shared(pos.w / 2 + 8, 21, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[77]); // hero image imageHero = std::make_shared(AnimationPath::builtin("PortraitsLarge"), (*CGI->heroh)[heroIndex]->imageIndex, 0, borderOffset, borderOffset + yOffset); // hero name - labelHeroName = std::make_shared(64 + borderOffset + 110, borderOffset + yOffset + 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, (*CGI->heroh)[heroIndex]->getNameTranslated()); - labelHeroClass = std::make_shared(64 + borderOffset + 110, borderOffset + yOffset + 45, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, (*CGI->heroh)[heroIndex]->heroClass->getNameTranslated()); + labelHeroName = std::make_shared(borderOffset + 174, borderOffset + yOffset + 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, (*CGI->heroh)[heroIndex]->getNameTranslated()); + labelHeroClass = std::make_shared(borderOffset + 174, borderOffset + yOffset + 45, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, (*CGI->heroh)[heroIndex]->heroClass->getNameTranslated()); // skills header for(int i = 0; i < 4; i++) - labelSkillHeader.push_back(std::make_shared((284 / 4) * i + 42, 2 * borderOffset + yOffset + 64 + 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->jktexts[1 + i])); + labelSkillHeader.push_back(std::make_shared((284 / 4) * i + 42, 2 * borderOffset + yOffset + 74, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->jktexts[1 + i])); // skill const int tmp[] = {0, 1, 2, 5}; @@ -171,20 +169,20 @@ void CHeroOverview::genHeroWindow() // skills footer for(int i = 0; i < 4; i++) - labelSkillFooter.push_back(std::make_shared((284 / 4) * i + 42, 4 * borderOffset + yOffset + 64 + 20 + 44 + 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string((*CGI->heroh)[heroIndex]->heroClass->primarySkillInitial[i]))); + labelSkillFooter.push_back(std::make_shared((284 / 4) * i + 42, 4 * borderOffset + yOffset + 138, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string((*CGI->heroh)[heroIndex]->heroClass->primarySkillInitial[i]))); // hero biography - labelHeroBiography = std::make_shared(Rect(2 * borderOffset, 5 * borderOffset + borderOffset + yOffset + 64 + 20 + 44 + 20, 284 - 2 * borderOffset, 130 - 2 * borderOffset), FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIndex]->getBiographyTranslated()); + labelHeroBiography = std::make_shared(Rect(2 * borderOffset, 5 * borderOffset + borderOffset + yOffset + 148, 284 - 2 * borderOffset, 130 - 2 * borderOffset), FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIndex]->getBiographyTranslated()); // speciality name - labelHeroSpeciality = std::make_shared(3 * borderOffset + 44, 7 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[78]); - labelSpecialityName = std::make_shared(3 * borderOffset + 44, 7 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130 + 20, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIndex]->getSpecialtyNameTranslated()); + labelHeroSpeciality = std::make_shared(3 * borderOffset + 44, 7 * borderOffset + yOffset + 278, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[78]); + labelSpecialityName = std::make_shared(3 * borderOffset + 44, 7 * borderOffset + yOffset + 298, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIndex]->getSpecialtyNameTranslated()); // speciality image - imageSpeciality = std::make_shared(AnimationPath::builtin("UN44"), (*CGI->heroh)[heroIndex]->imageIndex, 0, borderOffset, 6 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130); + imageSpeciality = std::make_shared(AnimationPath::builtin("UN44"), (*CGI->heroh)[heroIndex]->imageIndex, 0, borderOffset, 6 * borderOffset + yOffset + 278); // speciality description - labelSpecialityDescription = std::make_shared(Rect(2 * borderOffset, 8 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130 + 44 - 1, 284 - borderOffset, 85 - borderOffset), FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIndex]->getSpecialtyDescriptionTranslated()); + labelSpecialityDescription = std::make_shared(Rect(2 * borderOffset, 8 * borderOffset + yOffset + 321, 284 - borderOffset, 85 - borderOffset), FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIndex]->getSpecialtyDescriptionTranslated()); // army title labelArmyTitle = std::make_shared(302 + borderOffset, 2 * borderOffset + yOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.startingArmy")); @@ -197,13 +195,13 @@ void CHeroOverview::genHeroWindow() { int space = (292 - 32 - 6 * 32) / 5; imageArmy.push_back(std::make_shared(AnimationPath::builtin("CPRSMALL"), (*CGI->creh)[army.creature]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 2 * borderOffset + yOffset + 30)); - labelArmyCount.push_back(std::make_shared(302 + i * (32 + space) + 32, 3 * borderOffset + yOffset + 30 + 32 + 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, (army.minAmount == army.maxAmount) ? std::to_string(army.minAmount) : std::to_string(army.minAmount) + "-" + std::to_string(army.maxAmount))); + labelArmyCount.push_back(std::make_shared(302 + i * (32 + space) + 32, 3 * borderOffset + yOffset + 72, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, (army.minAmount == army.maxAmount) ? std::to_string(army.minAmount) : std::to_string(army.minAmount) + "-" + std::to_string(army.maxAmount))); i++; } } // war machine title - labelWarMachineTitle = std::make_shared(302 + borderOffset, 4 * borderOffset + yOffset + 30 + 32 + 27, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.warMachine")); + labelWarMachineTitle = std::make_shared(302 + borderOffset, 4 * borderOffset + yOffset + 89, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.warMachine")); // war machine i = 0; @@ -212,29 +210,29 @@ void CHeroOverview::genHeroWindow() int space = (292 - 32 - 6 * 32) / 5; if(i == 0) { - imageWarMachine.push_back(std::make_shared(AnimationPath::builtin("CPRSMALL"), (*CGI->creh)[army.creature.CATAPULT]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 5 * borderOffset + yOffset + 30 + 32 + 20 + 30)); + imageWarMachine.push_back(std::make_shared(AnimationPath::builtin("CPRSMALL"), (*CGI->creh)[army.creature.CATAPULT]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 5 * borderOffset + yOffset + 112)); i++; } if((*CGI->creh)[army.creature]->warMachine != ArtifactID::NONE) { - imageWarMachine.push_back(std::make_shared(AnimationPath::builtin("CPRSMALL"), (*CGI->creh)[army.creature]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 5 * borderOffset + yOffset + 30 + 32 + 20 + 30)); + imageWarMachine.push_back(std::make_shared(AnimationPath::builtin("CPRSMALL"), (*CGI->creh)[army.creature]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 5 * borderOffset + yOffset + 112)); i++; } } // secskill title - labelSecSkillTitle = std::make_shared(302 + borderOffset, 6 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 8, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.secondarySkills")); + labelSecSkillTitle = std::make_shared(302 + borderOffset, 6 * borderOffset + yOffset + 152, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.secondarySkills")); // spell title - labelSpellTitle = std::make_shared(302 + (292 / 2) + 3 * borderOffset, 6 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 8, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.spells")); + labelSpellTitle = std::make_shared(302 + (292 / 2) + 3 * borderOffset, 6 * borderOffset + yOffset + 152, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.spells")); // secskill i = 0; for(auto & skill : (*CGI->heroh)[heroIndex]->secSkillsInit) { - imageSecSkills.push_back(std::make_shared(AnimationPath::builtin("SECSK32"), (*CGI->skillh)[skill.first]->getIconIndex() * 3 + skill.second + 2, 0, 302, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset))); - labelSecSkillsNames.push_back(std::make_shared(302 + 32 + 2 * borderOffset, 8 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset) - 5, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->levels[skill.second - 1])); - labelSecSkillsNames.push_back(std::make_shared(302 + 32 + 2 * borderOffset, 8 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset) + 10, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->skillh)[skill.first]->getNameTranslated())); + imageSecSkills.push_back(std::make_shared(AnimationPath::builtin("SECSK32"), (*CGI->skillh)[skill.first]->getIconIndex() * 3 + skill.second + 2, 0, 302, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset))); + labelSecSkillsNames.push_back(std::make_shared(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 174 + i * (32 + borderOffset) - 5, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->levels[skill.second - 1])); + labelSecSkillsNames.push_back(std::make_shared(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 174 + i * (32 + borderOffset) + 10, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->skillh)[skill.first]->getNameTranslated())); i++; } @@ -246,13 +244,13 @@ void CHeroOverview::genHeroWindow() { if((*CGI->heroh)[heroIndex]->haveSpellBook) { - imageSpells.push_back(std::make_shared(GH.renderHandler().loadAnimation(AnimationPath::builtin("ARTIFACT")), 0, Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset), 32, 32), 0)); + imageSpells.push_back(std::make_shared(GH.renderHandler().loadAnimation(AnimationPath::builtin("ARTIFACT")), 0, Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), 32, 32), 0)); } i++; } - imageSpells.push_back(std::make_shared(GH.renderHandler().loadAnimation(AnimationPath::builtin("SPELLBON")), (*CGI->spellh)[spell]->getIconIndex(), Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset), 32, 32), 0)); - labelSpellsNames.push_back(std::make_shared(302 + (292 / 2) + 3 * borderOffset + 32 + borderOffset, 8 * borderOffset + yOffset + 30 + 32 + 20 + 30 + 32 + 30 + i * (32 + borderOffset) + 3, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->spellh)[spell]->getNameTranslated())); + imageSpells.push_back(std::make_shared(GH.renderHandler().loadAnimation(AnimationPath::builtin("SPELLBON")), (*CGI->spellh)[spell]->getIconIndex(), Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), 32, 32), 0)); + labelSpellsNames.push_back(std::make_shared(302 + (292 / 2) + 3 * borderOffset + 32 + borderOffset, 8 * borderOffset + yOffset + 174 + i * (32 + borderOffset) + 3, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->spellh)[spell]->getNameTranslated())); i++; } } \ No newline at end of file diff --git a/client/windows/CHeroOverview.h b/client/windows/CHeroOverview.h index 6957adee1..c63c88ea5 100644 --- a/client/windows/CHeroOverview.h +++ b/client/windows/CHeroOverview.h @@ -23,6 +23,11 @@ class CHeroOverview : public CWindowObject const HeroTypeID & hero; int heroIndex; + const int yOffset = 35; + const int borderOffset = 5; + const int alpha = 75; + const ColorRGBA borderColor = ColorRGBA(128, 100, 75); + std::shared_ptr backgroundTexture; std::shared_ptr backgroundShapes; std::shared_ptr labelTitle; @@ -53,7 +58,8 @@ class CHeroOverview : public CWindowObject std::vector> imageSecSkills; std::vector> labelSecSkillsNames; - void genHeroWindow(); + void genBackground(); + void genControls(); public: CHeroOverview(const HeroTypeID & h);