1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +02:00
This commit is contained in:
Laserlicht 2023-09-25 01:04:06 +02:00 committed by GitHub
parent 3e4a5b7d80
commit 28f4046937
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 10 deletions

View File

@ -461,6 +461,9 @@ CGStatusBar::CGStatusBar(int x, int y, const ImagePath & name, int maxw)
addUsedEvents(LCLICK);
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
if(name.empty())
return;
auto backgroundImage = std::make_shared<CPicture>(name);
background = backgroundImage;
pos = background->pos;

View File

@ -96,14 +96,14 @@ public:
}
} spellsorter;
CSpellWindow::CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _myInt, bool openOnBattleSpells, bool isBigSpellbook):
CWindowObject(PLAYER_COLORED | (isBigSpellbook ? BORDERED : 0)),
CSpellWindow::CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _myInt, bool openOnBattleSpells):
CWindowObject(PLAYER_COLORED | (settings["general"]["enableUiEnhancements"].Bool() ? BORDERED : 0)),
battleSpellsOnly(openOnBattleSpells),
selectedTab(4),
currentPage(0),
myHero(_myHero),
myInt(_myInt),
isBigSpellbook(isBigSpellbook)
isBigSpellbook(settings["general"]["enableUiEnhancements"].Bool())
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
@ -200,7 +200,11 @@ CSpellWindow::CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _m
for(auto item : schoolBorders)
item->preload();
mana = std::make_shared<CLabel>(435 + (isBigSpellbook ? 157 : 0), 426 + offB, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, std::to_string(myHero->mana));
mana = std::make_shared<CLabel>(435 + (isBigSpellbook ? 159 : 0), 426 + offB, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, std::to_string(myHero->mana));
if(isBigSpellbook)
statusBar = CGStatusBar::create(400, 587, ImagePath::builtin(""));
else
statusBar = CGStatusBar::create(7, 569, ImagePath::builtin("Spelroll.bmp"));
interactiveAreas.push_back(std::make_shared<InteractiveArea>( Rect( 479 + pos.x + (isBigSpellbook ? 175 : 0), 405 + pos.y + offB, isBigSpellbook ? 60 : 36, 56), std::bind(&CSpellWindow::fexitb, this), 460, this));
@ -259,13 +263,13 @@ std::shared_ptr<IImage> CSpellWindow::createBigSpellBook()
std::shared_ptr<IImage> img = GH.renderHandler().loadImage(ImagePath::builtin("SpelBack"));
Canvas canvas = Canvas(Point(800, 600));
// edges
canvas.draw(img, Point(0, 0), Rect(10, 38, 90, 45));
canvas.draw(img, Point(0, 460), Rect(10, 400, 90, 141));
canvas.draw(img, Point(0, 0), Rect(15, 38, 90, 45));
canvas.draw(img, Point(0, 460), Rect(15, 400, 90, 141));
canvas.draw(img, Point(705, 0), Rect(509, 38, 95, 45));
canvas.draw(img, Point(705, 460), Rect(509, 400, 95, 141));
// left / right
Canvas tmp1 = Canvas(Point(90, 355 - 45));
tmp1.draw(img, Point(0, 0), Rect(10, 38 + 45, 90, 355 - 45));
tmp1.draw(img, Point(0, 0), Rect(15, 38 + 45, 90, 355 - 45));
canvas.drawScaled(tmp1, Point(0, 45), Point(90, 415));
Canvas tmp2 = Canvas(Point(95, 355 - 45));
tmp2.draw(img, Point(0, 0), Rect(509, 38 + 45, 95, 355 - 45));
@ -279,7 +283,7 @@ std::shared_ptr<IImage> CSpellWindow::createBigSpellBook()
canvas.drawScaled(tmp4, Point(90, 460), Point(615, 141));
// middle
Canvas tmp5 = Canvas(Point(409, 141));
tmp5.draw(img, Point(0, 0), Rect(100, 38 + 45, 509 - 10, 400 - 38));
tmp5.draw(img, Point(0, 0), Rect(100, 38 + 45, 509 - 15, 400 - 38));
canvas.drawScaled(tmp5, Point(90, 45), Point(615, 415));
return GH.renderHandler().createImage(canvas.getInternalSurface());

View File

@ -108,7 +108,7 @@ class CSpellWindow : public CWindowObject
std::shared_ptr<IImage> createBigSpellBook();
public:
CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _myInt, bool openOnBattleSpells = true, bool isBigSpellbook = true);
CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _myInt, bool openOnBattleSpells = true);
~CSpellWindow();
void fexitb();