mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-27 21:49:10 +02:00
Merge pull request #4780 from Laserlicht/text_pos_fix
fix: campaign video scrolling for short texts
This commit is contained in:
commit
52e0899d6f
@ -60,7 +60,10 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f
|
|||||||
CCS->soundh->setCallback(voiceSoundHandle, onVoiceStop);
|
CCS->soundh->setCallback(voiceSoundHandle, onVoiceStop);
|
||||||
|
|
||||||
text = std::make_shared<CMultiLineLabel>(Rect(100, 500, 600, 100), EFonts::FONT_BIG, ETextAlignment::CENTER, Colors::METALLIC_GOLD, spe.prologText.toString());
|
text = std::make_shared<CMultiLineLabel>(Rect(100, 500, 600, 100), EFonts::FONT_BIG, ETextAlignment::CENTER, Colors::METALLIC_GOLD, spe.prologText.toString());
|
||||||
text->scrollTextTo(-50); // beginning of text in the vertical middle of black area
|
if(text->getLines().size() == 3)
|
||||||
|
text->scrollTextTo(-25); // beginning of text in the vertical middle of black area
|
||||||
|
else if(text->getLines().size() > 3)
|
||||||
|
text->scrollTextTo(-50); // beginning of text in the vertical middle of black area
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrologEpilogVideo::tick(uint32_t msPassed)
|
void CPrologEpilogVideo::tick(uint32_t msPassed)
|
||||||
|
@ -176,6 +176,11 @@ void CMultiLineLabel::setText(const std::string & Txt)
|
|||||||
CLabel::setText(Txt);
|
CLabel::setText(Txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> CMultiLineLabel::getLines()
|
||||||
|
{
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
void CTextContainer::blitLine(Canvas & to, Rect destRect, std::string what)
|
void CTextContainer::blitLine(Canvas & to, Rect destRect, std::string what)
|
||||||
{
|
{
|
||||||
const auto f = GH.renderHandler().loadFont(font);
|
const auto f = GH.renderHandler().loadFont(font);
|
||||||
|
@ -96,6 +96,7 @@ public:
|
|||||||
CMultiLineLabel(Rect position, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const ColorRGBA & Color = Colors::WHITE, const std::string & Text = "");
|
CMultiLineLabel(Rect position, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const ColorRGBA & Color = Colors::WHITE, const std::string & Text = "");
|
||||||
|
|
||||||
void setText(const std::string & Txt) override;
|
void setText(const std::string & Txt) override;
|
||||||
|
std::vector<std::string> getLines();
|
||||||
void showAll(Canvas & to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
void setVisibleSize(Rect visibleSize, bool redrawElement = true);
|
void setVisibleSize(Rect visibleSize, bool redrawElement = true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user