mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
simplified
This commit is contained in:
parent
05fad115b5
commit
21f37cfafb
@ -33,7 +33,7 @@ CHeroOverview::CHeroOverview(const HeroTypeID & h)
|
|||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||||
|
|
||||||
heroIndex = hero.getNum();
|
heroIdx = hero.getNum();
|
||||||
|
|
||||||
pos = Rect(0, 0, 600, 485);
|
pos = Rect(0, 0, 600, 485);
|
||||||
|
|
||||||
@ -47,150 +47,91 @@ void CHeroOverview::genBackground()
|
|||||||
{
|
{
|
||||||
backgroundTexture = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
|
backgroundTexture = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
|
||||||
updateShadow();
|
updateShadow();
|
||||||
|
}
|
||||||
|
|
||||||
Canvas canvas = Canvas(Point(pos.w, pos.h));
|
void CHeroOverview::genControls()
|
||||||
|
{
|
||||||
|
Rect r = Rect();
|
||||||
|
|
||||||
|
labelTitle = std::make_shared<CLabel>(pos.w / 2 + 8, 21, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[77]);
|
||||||
|
|
||||||
// hero image
|
// hero image
|
||||||
canvas.drawBorder(Rect(borderOffset - 1, borderOffset + yOffset - 1, 58 + 2, 64 + 2), borderColor);
|
r = Rect(borderOffset, borderOffset + yOffset, 58, 64);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
imageHero = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsLarge"), (*CGI->heroh)[heroIdx]->imageIndex, 0, r.x, r.y);
|
||||||
|
|
||||||
// hero name
|
// hero name
|
||||||
canvas.drawColorBlended(Rect(64 + borderOffset, borderOffset + yOffset, 220, 64), ColorRGBA(0, 0, 0, alpha));
|
r = Rect(64 + borderOffset, borderOffset + yOffset, 220, 64);
|
||||||
canvas.drawBorder(Rect(64 + borderOffset - 1, borderOffset + yOffset - 1, 220 + 2, 64 + 2), borderColor);
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
labelHeroName = std::make_shared<CLabel>(r.x + 110, r.y + 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, (*CGI->heroh)[heroIdx]->getNameTranslated());
|
||||||
|
labelHeroClass = std::make_shared<CLabel>(r.x + 110, r.y + 45, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, (*CGI->heroh)[heroIdx]->heroClass->getNameTranslated());
|
||||||
|
|
||||||
// vertical line
|
// vertical line
|
||||||
canvas.drawLine(Point(295, borderOffset + yOffset - 1), Point(295, borderOffset + yOffset - 2 + 439), borderColor, borderColor);
|
backgroundLines.push_back(std::make_shared<SimpleLine>(Point(295, borderOffset + yOffset - 1), Point(295, borderOffset + yOffset - 2 + 439), borderColor));
|
||||||
|
|
||||||
// skill header
|
// skills header
|
||||||
canvas.drawColorBlended(Rect(borderOffset, 2 * borderOffset + yOffset + 64, 284, 20), ColorRGBA(0, 0, 0, alpha));
|
r = Rect(borderOffset, 2 * borderOffset + yOffset + 64, 284, 20);
|
||||||
canvas.drawBorder(Rect(borderOffset - 1, 2 * borderOffset + yOffset + 64 - 1, 284 + 2, 20 + 2), borderColor);
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
labelSkillHeader.push_back(std::make_shared<CLabel>((r.w / 4) * i + 42, r.y + 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->jktexts[1 + i]));
|
||||||
|
|
||||||
// skill
|
// skill
|
||||||
|
const int tmp[] = {0, 1, 2, 5};
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++)
|
||||||
canvas.drawBorder(Rect((284 / 4) * i + 21 - 1, 3 * borderOffset + yOffset + 64 + 20 + 1 - 1, 42 + 2, 42 + 2), borderColor);
|
{
|
||||||
|
r = Rect((284 / 4) * i + 21, 3 * borderOffset + yOffset + 85, 42, 42);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
imageSkill.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("PSKIL42"), tmp[i], 0, r.x, r.y));
|
||||||
|
}
|
||||||
|
|
||||||
// skill footer
|
// skills footer
|
||||||
canvas.drawColorBlended(Rect(borderOffset, 4 * borderOffset + yOffset + 128, 284, 20), ColorRGBA(0, 0, 0, alpha));
|
r = Rect(borderOffset, 4 * borderOffset + yOffset + 128, 284, 20);
|
||||||
canvas.drawBorder(Rect(borderOffset - 1, 4 * borderOffset + yOffset + 128 - 1, 284 + 2, 20 + 2), borderColor);
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
r = Rect((284 / 4) * i + 42, r.y, r.w, r.h);
|
||||||
|
labelSkillFooter.push_back(std::make_shared<CLabel>(r.x, r.y + 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string((*CGI->heroh)[heroIdx]->heroClass->primarySkillInitial[i])));
|
||||||
|
}
|
||||||
|
|
||||||
// hero biography
|
// hero biography
|
||||||
canvas.drawColorBlended(Rect(borderOffset, 5 * borderOffset + yOffset + 148, 284, 130), ColorRGBA(0, 0, 0, alpha));
|
r = Rect(borderOffset, 5 * borderOffset + yOffset + 148, 284, 130);
|
||||||
canvas.drawBorder(Rect(borderOffset - 1, 5 * borderOffset + yOffset + 148 - 1, 284 + 2, 130 + 2), borderColor);
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
labelHeroBiography = std::make_shared<CMultiLineLabel>(r.resize(-borderOffset), FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIdx]->getBiographyTranslated());
|
||||||
|
|
||||||
// speciality name
|
// speciality name
|
||||||
canvas.drawColorBlended(Rect(2 * borderOffset + 44, 6 * borderOffset + yOffset + 278, 235, 44), ColorRGBA(0, 0, 0, alpha));
|
r = Rect(2 * borderOffset + 44, 6 * borderOffset + yOffset + 278, 235, 44);
|
||||||
canvas.drawBorder(Rect(2 * borderOffset + 44 - 1, 6 * borderOffset + yOffset + 278 - 1, 235 + 2, 44 + 2), borderColor);
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
labelHeroSpeciality = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[78]);
|
||||||
|
labelSpecialityName = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 20, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIdx]->getSpecialtyNameTranslated());
|
||||||
|
|
||||||
// speciality image
|
// speciality image
|
||||||
canvas.drawBorder(Rect(borderOffset - 1, 6 * borderOffset + yOffset + 278 - 1, 44 + 2, 44 + 2), borderColor);
|
r = Rect(borderOffset, 6 * borderOffset + yOffset + 278, 44, 44);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
imageSpeciality = std::make_shared<CAnimImage>(AnimationPath::builtin("UN44"), (*CGI->heroh)[heroIdx]->imageIndex, 0, r.x, r.y);
|
||||||
|
|
||||||
// speciality description
|
// speciality description
|
||||||
canvas.drawColorBlended(Rect(borderOffset, 7 * borderOffset + yOffset + 322, 284, 85), ColorRGBA(0, 0, 0, alpha));
|
r = Rect(borderOffset, 7 * borderOffset + yOffset + 322, 284, 85);
|
||||||
canvas.drawBorder(Rect(borderOffset - 1, 7 * borderOffset + yOffset + 322 - 1, 284 + 2, 85 + 2), borderColor);
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
labelSpecialityDescription = std::make_shared<CMultiLineLabel>(r.resize(-borderOffset), FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIdx]->getSpecialtyDescriptionTranslated());
|
||||||
|
|
||||||
// army title
|
// army title
|
||||||
canvas.drawColorBlended(Rect(302, borderOffset + yOffset, 292, 30), ColorRGBA(0, 0, 0, alpha));
|
r = Rect(302, borderOffset + yOffset, 292, 30);
|
||||||
canvas.drawBorder(Rect(302 - 1, borderOffset + yOffset - 1, 292 + 2, 30 + 2), borderColor);
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
labelArmyTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.startingArmy"));
|
||||||
|
|
||||||
|
// army numbers
|
||||||
|
r = Rect(302, 3 * borderOffset + yOffset + 62, 292, 20);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
|
||||||
// army
|
// army
|
||||||
for(int i = 0; i < 6; i++)
|
for(int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
int space = (260 - 6 * 32) / 5;
|
int space = (260 - 6 * 32) / 5;
|
||||||
canvas.drawColorBlended(Rect(318 + i * (32 + space), 2 * borderOffset + yOffset + 30, 32, 32), ColorRGBA(0, 0, 0, alpha));
|
r = Rect(318 + i * (32 + space), 2 * borderOffset + yOffset + 30, 32, 32);
|
||||||
canvas.drawBorder(Rect(318 + i * (32 + space) - 1, 2 * borderOffset + yOffset + 30 - 1, 32 + 2, 32 + 2), borderColor);
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// army footer
|
|
||||||
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 + 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(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 + 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 + 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 + 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 + 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 + 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<IImage> backgroundShapesImg = GH.renderHandler().createImage(canvas.getInternalSurface());
|
|
||||||
backgroundShapes = std::make_shared<CPicture>(backgroundShapesImg, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CHeroOverview::genControls()
|
|
||||||
{
|
|
||||||
labelTitle = std::make_shared<CLabel>(pos.w / 2 + 8, 21, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[77]);
|
|
||||||
|
|
||||||
// hero image
|
|
||||||
imageHero = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsLarge"), (*CGI->heroh)[heroIndex]->imageIndex, 0, borderOffset, borderOffset + yOffset);
|
|
||||||
|
|
||||||
// hero name
|
|
||||||
labelHeroName = std::make_shared<CLabel>(borderOffset + 174, borderOffset + yOffset + 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, (*CGI->heroh)[heroIndex]->getNameTranslated());
|
|
||||||
labelHeroClass = std::make_shared<CLabel>(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<CLabel>((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};
|
|
||||||
for(int i = 0; i < 4; i++)
|
|
||||||
imageSkill.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("PSKIL42"), tmp[i], 0, (284 / 4) * i + 21, 3 * borderOffset + yOffset + 64 + 20 + 1));
|
|
||||||
|
|
||||||
// skills footer
|
|
||||||
for(int i = 0; i < 4; i++)
|
|
||||||
labelSkillFooter.push_back(std::make_shared<CLabel>((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<CMultiLineLabel>(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<CLabel>(3 * borderOffset + 44, 7 * borderOffset + yOffset + 278, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[78]);
|
|
||||||
labelSpecialityName = std::make_shared<CLabel>(3 * borderOffset + 44, 7 * borderOffset + yOffset + 298, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->heroh)[heroIndex]->getSpecialtyNameTranslated());
|
|
||||||
|
|
||||||
// speciality image
|
|
||||||
imageSpeciality = std::make_shared<CAnimImage>(AnimationPath::builtin("UN44"), (*CGI->heroh)[heroIndex]->imageIndex, 0, borderOffset, 6 * borderOffset + yOffset + 278);
|
|
||||||
|
|
||||||
// speciality description
|
|
||||||
labelSpecialityDescription = std::make_shared<CMultiLineLabel>(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<CLabel>(302 + borderOffset, 2 * borderOffset + yOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.startingArmy"));
|
|
||||||
|
|
||||||
// army
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(auto & army : (*CGI->heroh)[heroIndex]->initialArmy)
|
for(auto & army : (*CGI->heroh)[heroIdx]->initialArmy)
|
||||||
{
|
{
|
||||||
if((*CGI->creh)[army.creature]->warMachine == ArtifactID::NONE)
|
if((*CGI->creh)[army.creature]->warMachine == ArtifactID::NONE)
|
||||||
{
|
{
|
||||||
@ -202,11 +143,19 @@ void CHeroOverview::genControls()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// war machine title
|
// war machine title
|
||||||
labelWarMachineTitle = std::make_shared<CLabel>(302 + borderOffset, 4 * borderOffset + yOffset + 89, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.warMachine"));
|
r = Rect(302, 4 * borderOffset + yOffset + 82, 292, 30);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
labelWarMachineTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.warMachine"));
|
||||||
|
|
||||||
// war machine
|
// war machine
|
||||||
|
for(int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
int space = (292 - 32 - 6 * 32) / 5;
|
||||||
|
r = Rect(318 + i * (32 + space), 5 * borderOffset + yOffset + 112, 32, 32);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
for(auto & army : (*CGI->heroh)[heroIndex]->initialArmy)
|
for(auto & army : (*CGI->heroh)[heroIdx]->initialArmy)
|
||||||
{
|
{
|
||||||
int space = (292 - 32 - 6 * 32) / 5;
|
int space = (292 - 32 - 6 * 32) / 5;
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
@ -222,14 +171,28 @@ void CHeroOverview::genControls()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// secskill title
|
// secskill title
|
||||||
labelSecSkillTitle = std::make_shared<CLabel>(302 + borderOffset, 6 * borderOffset + yOffset + 152, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.secondarySkills"));
|
r = Rect(302, 6 * borderOffset + yOffset + 144, (292 / 2) - 2 * borderOffset, 30);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
labelSecSkillTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.secondarySkills"));
|
||||||
|
|
||||||
|
// vertical line
|
||||||
|
backgroundLines.push_back(std::make_shared<SimpleLine>(Point(302 + (292 / 2), 6 * borderOffset + yOffset + 144 - 1), Point(302 + (292 / 2), 6 * borderOffset + yOffset + 144 - 2 + 254), borderColor));
|
||||||
|
|
||||||
// spell title
|
// spell title
|
||||||
labelSpellTitle = std::make_shared<CLabel>(302 + (292 / 2) + 3 * borderOffset, 6 * borderOffset + yOffset + 152, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.spells"));
|
r = Rect(302 + (292 / 2) + 2 * borderOffset, 6 * borderOffset + yOffset + 144, (292 / 2) - 2 * borderOffset, 30);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
labelSpellTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->translate("vcmi.heroOverview.spells"));
|
||||||
|
|
||||||
// secskill
|
// secskill
|
||||||
|
for(int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
r = Rect(302, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), 32, 32);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
r = Rect(302 + 32 + borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), (292 / 2) - 32 - 3 * borderOffset, 32);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
for(auto & skill : (*CGI->heroh)[heroIndex]->secSkillsInit)
|
for(auto & skill : (*CGI->heroh)[heroIdx]->secSkillsInit)
|
||||||
{
|
{
|
||||||
imageSecSkills.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("SECSK32"), (*CGI->skillh)[skill.first]->getIconIndex() * 3 + skill.second + 2, 0, 302, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset)));
|
imageSecSkills.push_back(std::make_shared<CAnimImage>(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<CLabel>(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<CLabel>(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 174 + i * (32 + borderOffset) - 5, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->levels[skill.second - 1]));
|
||||||
@ -238,12 +201,19 @@ void CHeroOverview::genControls()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// spell
|
// spell
|
||||||
|
for(int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
r = Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), 32, 32);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
r = Rect(302 + (292 / 2) + 2 * borderOffset + 32 + borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), (292 / 2) - 32 - 3 * borderOffset, 32);
|
||||||
|
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
|
||||||
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
for(auto & spell : (*CGI->heroh)[heroIndex]->spells)
|
for(auto & spell : (*CGI->heroh)[heroIdx]->spells)
|
||||||
{
|
{
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
if((*CGI->heroh)[heroIndex]->haveSpellBook)
|
if((*CGI->heroh)[heroIdx]->haveSpellBook)
|
||||||
{
|
{
|
||||||
imageSpells.push_back(std::make_shared<CAnimImage>(GH.renderHandler().loadAnimation(AnimationPath::builtin("ARTIFACT")), 0, Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), 32, 32), 0));
|
imageSpells.push_back(std::make_shared<CAnimImage>(GH.renderHandler().loadAnimation(AnimationPath::builtin("ARTIFACT")), 0, Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 174 + i * (32 + borderOffset), 32, 32), 0));
|
||||||
}
|
}
|
||||||
|
@ -23,15 +23,17 @@ class SimpleLine;
|
|||||||
class CHeroOverview : public CWindowObject
|
class CHeroOverview : public CWindowObject
|
||||||
{
|
{
|
||||||
const HeroTypeID & hero;
|
const HeroTypeID & hero;
|
||||||
int heroIndex;
|
int heroIdx;
|
||||||
|
|
||||||
const int yOffset = 35;
|
const int yOffset = 35;
|
||||||
const int borderOffset = 5;
|
const int borderOffset = 5;
|
||||||
const int alpha = 75;
|
const ColorRGBA rectangleColor = ColorRGBA(0, 0, 0, 75);
|
||||||
const ColorRGBA borderColor = ColorRGBA(128, 100, 75);
|
const ColorRGBA borderColor = ColorRGBA(128, 100, 75);
|
||||||
|
|
||||||
std::shared_ptr<CFilledTexture> backgroundTexture;
|
std::shared_ptr<CFilledTexture> backgroundTexture;
|
||||||
std::shared_ptr<CPicture> backgroundShapes;
|
std::vector<std::shared_ptr<TransparentFilledRectangle>> backgroundRectangles;
|
||||||
|
std::vector<std::shared_ptr<SimpleLine>> backgroundLines;
|
||||||
|
|
||||||
std::shared_ptr<CLabel> labelTitle;
|
std::shared_ptr<CLabel> labelTitle;
|
||||||
std::shared_ptr<CAnimImage> imageHero;
|
std::shared_ptr<CAnimImage> imageHero;
|
||||||
std::shared_ptr<CLabel> labelHeroName;
|
std::shared_ptr<CLabel> labelHeroName;
|
||||||
|
@ -100,7 +100,7 @@ public:
|
|||||||
|
|
||||||
Rect resize(const int size) const
|
Rect resize(const int size) const
|
||||||
{
|
{
|
||||||
return Rect(x-size,y-size,w+size,h+size);
|
return Rect(x-size,y-size,w+2*size,h+2*size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveTo(const Point & dest)
|
void moveTo(const Point & dest)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user