mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
left side
This commit is contained in:
parent
73fe924544
commit
b674682fe3
@ -25,7 +25,7 @@
|
||||
#include "../../lib/CHeroHandler.h"
|
||||
|
||||
CHeroOverview::CHeroOverview(const HeroTypeID & h)
|
||||
: CWindowObject(BORDERED | RCLICK_POPUP), hero { h }, heroIndex { h.getNum() }
|
||||
: CWindowObject(BORDERED | RCLICK_POPUP), /*hero { h },*/ heroIndex { h.getNum() }
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
|
||||
@ -41,41 +41,74 @@ void CHeroOverview::genHeader()
|
||||
|
||||
int yOffset = 35;
|
||||
int borderOffset = 5;
|
||||
int alpha = 75;
|
||||
|
||||
ColorRGBA borderColor = Colors::WHITE;
|
||||
ColorRGBA borderColor = ColorRGBA(128, 100, 75);
|
||||
|
||||
Canvas canvas = Canvas(Point(pos.w, pos.h));
|
||||
|
||||
// Image
|
||||
// hero image
|
||||
canvas.drawBorder(Rect(borderOffset - 1, borderOffset + yOffset - 1, 58 + 2, 64 + 2), borderColor);
|
||||
|
||||
// Namebox
|
||||
canvas.drawColorBlended(Rect(64 + borderOffset, borderOffset + yOffset, 220, 64), ColorRGBA(0, 0, 0, 75));
|
||||
// hero name
|
||||
canvas.drawColorBlended(Rect(64 + borderOffset, borderOffset + yOffset, 220, 64), ColorRGBA(0, 0, 0, alpha));
|
||||
canvas.drawBorder(Rect(64 + borderOffset - 1, borderOffset + yOffset - 1, 220 + 2, 64 + 2), borderColor);
|
||||
|
||||
// vertical line
|
||||
canvas.drawLine(Point(295, borderOffset + yOffset - 1), Point(295, 445), borderColor, borderColor);
|
||||
|
||||
// skill header
|
||||
canvas.drawColorBlended(Rect(borderOffset, 2 * borderOffset + yOffset + 64, 284, 20), ColorRGBA(0, 0, 0, alpha));
|
||||
canvas.drawBorder(Rect(borderOffset - 1, 2 * borderOffset + yOffset + 64 - 1, 284 + 2, 20 + 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);
|
||||
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
|
||||
// speciality image
|
||||
canvas.drawBorder(Rect(borderOffset - 1, 6 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130 - 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);
|
||||
|
||||
|
||||
std::shared_ptr<IImage> backgroundShapesImg = GH.renderHandler().createImage(canvas.getInternalSurface());
|
||||
backgroundShapes = std::make_shared<CPicture>(backgroundShapesImg, pos);
|
||||
|
||||
labelTitle = std::make_shared<CLabel>(pos.w / 2 + 8, 21, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[77]);
|
||||
|
||||
// Image
|
||||
// hero image
|
||||
image = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsLarge"), (*CGI->heroh)[heroIndex]->imageIndex, 0, borderOffset, borderOffset + yOffset);
|
||||
|
||||
// Namebox
|
||||
// hero name
|
||||
labelHeroName = std::make_shared<CLabel>(64 + borderOffset + 110, borderOffset + yOffset + 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, (*CGI->heroh)[heroIndex]->getNameTranslated());
|
||||
labelHeroClass = std::make_shared<CLabel>(64 + borderOffset + 110, borderOffset + yOffset + 45, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, (*CGI->heroh)[heroIndex]->heroClass->getNameTranslated());
|
||||
|
||||
// hero biography
|
||||
labelHeroBiography = std::make_shared<CMultiLineLabel>(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());
|
||||
|
||||
// speciality name
|
||||
labelHeroSpeciality = std::make_shared<CLabel>(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<CLabel>(3 * borderOffset + 44, 7 * borderOffset + yOffset + 64 + 20 + 44 + 20 + 130 + 20, 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 + 64 + 20 + 44 + 20 + 130);
|
||||
|
||||
// speciality description
|
||||
labelSpecialityDescription = std::make_shared<CMultiLineLabel>(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());
|
||||
}
|
||||
|
||||
void CHeroOverview::genHeroWindow()
|
||||
{
|
||||
pos = Rect(0, 0, 600, 600);
|
||||
pos = Rect(0, 0, 450, 450 + 35);
|
||||
genHeader();
|
||||
labelHeroSpeciality = std::make_shared<CLabel>(pos.w / 2 + 4, 117, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[78]);
|
||||
auto heroIndex = hero.getNum() >= CGI->heroh->size() ? 0 : hero.getNum();
|
||||
|
||||
imageSpeciality = std::make_shared<CAnimImage>(AnimationPath::builtin("UN44"), (*CGI->heroh)[heroIndex]->imageIndex, 0, pos.w / 2 - 22, 134);
|
||||
labelSpecialityName = std::make_shared<CLabel>(pos.w / 2, 188, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, (*CGI->heroh)[heroIndex]->getSpecialtyNameTranslated());
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
#include "../windows/CWindowObject.h"
|
||||
|
||||
class CLabel;
|
||||
class CMultiLineLabel;
|
||||
class CFilledTexture;
|
||||
class CAnimImage;
|
||||
class CComponentBox;
|
||||
@ -19,7 +20,7 @@ class CTextBox;
|
||||
|
||||
class CHeroOverview : public CWindowObject
|
||||
{
|
||||
const HeroTypeID & hero;
|
||||
//const HeroTypeID & hero;
|
||||
int heroIndex;
|
||||
|
||||
std::shared_ptr<CFilledTexture> backgroundTexture;
|
||||
@ -28,12 +29,12 @@ class CHeroOverview : public CWindowObject
|
||||
std::shared_ptr<CAnimImage> image;
|
||||
|
||||
std::shared_ptr<CLabel> labelHeroName;
|
||||
std::shared_ptr<CMultiLineLabel> labelHeroBiography;
|
||||
std::shared_ptr<CLabel> labelHeroClass;
|
||||
std::shared_ptr<CLabel> labelHeroSpeciality;
|
||||
std::shared_ptr<CAnimImage> imageSpeciality;
|
||||
std::shared_ptr<CLabel> labelSpecialityName;
|
||||
|
||||
std::shared_ptr<CTextBox> textBonusDescription;
|
||||
std::shared_ptr<CMultiLineLabel> labelSpecialityDescription;
|
||||
|
||||
void genHeader();
|
||||
void genHeroWindow();
|
||||
|
Loading…
Reference in New Issue
Block a user