mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
draw background
This commit is contained in:
parent
ff96b1af0a
commit
73fe924544
@ -12,8 +12,11 @@
|
||||
|
||||
#include "../CGameInfo.h"
|
||||
#include "../gui/CGuiHandler.h"
|
||||
#include "../render/Canvas.h"
|
||||
#include "../render/Colors.h"
|
||||
#include "../render/Graphics.h"
|
||||
#include "../render/IImage.h"
|
||||
#include "../renderSDL/RenderHandler.h"
|
||||
#include "../widgets/CComponent.h"
|
||||
#include "../widgets/Images.h"
|
||||
#include "../widgets/TextControls.h"
|
||||
@ -36,14 +39,39 @@ void CHeroOverview::genHeader()
|
||||
backgroundTexture = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
|
||||
updateShadow();
|
||||
|
||||
int yOffset = 35;
|
||||
int borderOffset = 5;
|
||||
|
||||
ColorRGBA borderColor = Colors::WHITE;
|
||||
|
||||
Canvas canvas = Canvas(Point(pos.w, pos.h));
|
||||
|
||||
// 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));
|
||||
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);
|
||||
|
||||
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]);
|
||||
labelSubTitle = std::make_shared<CLabel>(pos.w / 2, 88, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, (*CGI->heroh)[heroIndex]->getNameTranslated() + " - " + (*CGI->heroh)[heroIndex]->heroClass->getNameTranslated());
|
||||
image = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsSmall"), (*CGI->heroh)[heroIndex]->imageIndex, 0, pos.w / 2 - 24, 45);
|
||||
|
||||
// Image
|
||||
image = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsLarge"), (*CGI->heroh)[heroIndex]->imageIndex, 0, borderOffset, borderOffset + yOffset);
|
||||
|
||||
// Namebox
|
||||
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());
|
||||
}
|
||||
|
||||
void CHeroOverview::genHeroWindow()
|
||||
{
|
||||
pos = Rect(0, 0, 292, 226);
|
||||
pos = Rect(0, 0, 600, 600);
|
||||
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();
|
||||
|
@ -23,10 +23,12 @@ class CHeroOverview : public CWindowObject
|
||||
int heroIndex;
|
||||
|
||||
std::shared_ptr<CFilledTexture> backgroundTexture;
|
||||
std::shared_ptr<CPicture> backgroundShapes;
|
||||
std::shared_ptr<CLabel> labelTitle;
|
||||
std::shared_ptr<CLabel> labelSubTitle;
|
||||
std::shared_ptr<CAnimImage> image;
|
||||
|
||||
std::shared_ptr<CLabel> labelHeroName;
|
||||
std::shared_ptr<CLabel> labelHeroClass;
|
||||
std::shared_ptr<CLabel> labelHeroSpeciality;
|
||||
std::shared_ptr<CAnimImage> imageSpeciality;
|
||||
std::shared_ptr<CLabel> labelSpecialityName;
|
||||
|
Loading…
Reference in New Issue
Block a user