mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	fix campaign video scrolling for short texts
This commit is contained in:
		| @@ -59,7 +59,10 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f | ||||
| 	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->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) | ||||
|   | ||||
| @@ -176,6 +176,11 @@ void CMultiLineLabel::setText(const std::string & Txt) | ||||
| 	CLabel::setText(Txt); | ||||
| } | ||||
|  | ||||
| std::vector<std::string> CMultiLineLabel::getLines() | ||||
| { | ||||
| 	return lines; | ||||
| } | ||||
|  | ||||
| void CTextContainer::blitLine(Canvas & to, Rect destRect, std::string what) | ||||
| { | ||||
| 	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 = ""); | ||||
|  | ||||
| 	void setText(const std::string & Txt) override; | ||||
| 	std::vector<std::string> getLines(); | ||||
| 	void showAll(Canvas & to) override; | ||||
|  | ||||
| 	void setVisibleSize(Rect visibleSize, bool redrawElement = true); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user