mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Fix invisible chat in pregame. Fixed positioning of chat box
This commit is contained in:
		| @@ -135,7 +135,7 @@ InfoCard::InfoCard() | ||||
| 	Rect descriptionRect(26, 149, 320, 115); | ||||
| 	mapDescription = std::make_shared<CTextBox>("", descriptionRect, 1); | ||||
| 	playerListBg = std::make_shared<CPicture>(ImagePath::builtin("CHATPLUG.bmp"), 16, 276); | ||||
| 	chat = std::make_shared<CChatBox>(Rect(26, 132, 340, 132)); | ||||
| 	chat = std::make_shared<CChatBox>(Rect(18, 126, 335, 143)); | ||||
|  | ||||
| 	if(SEL->screenType == ESelectionScreen::campaignList) | ||||
| 	{ | ||||
| @@ -332,9 +332,12 @@ CChatBox::CChatBox(const Rect & rect) | ||||
| 	setRedrawParent(true); | ||||
|  | ||||
| 	const int height = static_cast<int>(graphics->fonts[FONT_SMALL]->getLineHeight()); | ||||
| 	inputBox = std::make_shared<CTextInput>(Rect(0, rect.h - height, rect.w, height), EFonts::FONT_SMALL, 0); | ||||
| 	Rect textInputArea(1, rect.h - height, rect.w - 1, height); | ||||
| 	Rect chatHistoryArea(3, 1, rect.w - 3, rect.h - height - 1); | ||||
| 	inputBackground = std::make_shared<TransparentFilledRectangle>(textInputArea, ColorRGBA(0,0,0,192)); | ||||
| 	inputBox = std::make_shared<CTextInput>(textInputArea, EFonts::FONT_SMALL, 0); | ||||
| 	inputBox->removeUsedEvents(KEYBOARD); | ||||
| 	chatHistory = std::make_shared<CTextBox>("", Rect(0, 0, rect.w, rect.h - height), 1); | ||||
| 	chatHistory = std::make_shared<CTextBox>("", chatHistoryArea, 1); | ||||
|  | ||||
| 	chatHistory->label->color = Colors::GREEN; | ||||
| } | ||||
|   | ||||
| @@ -33,6 +33,7 @@ class CChatBox; | ||||
| class CLabel; | ||||
| class CFlagBox; | ||||
| class CLabelGroup; | ||||
| class TransparentFilledRectangle; | ||||
|  | ||||
| class ISelectionScreenInfo | ||||
| { | ||||
| @@ -122,6 +123,7 @@ class CChatBox : public CIntObject | ||||
| public: | ||||
| 	std::shared_ptr<CTextBox> chatHistory; | ||||
| 	std::shared_ptr<CTextInput> inputBox; | ||||
| 	std::shared_ptr<TransparentFilledRectangle> inputBackground; | ||||
|  | ||||
| 	CChatBox(const Rect & rect); | ||||
|  | ||||
|   | ||||
| @@ -375,7 +375,7 @@ void CTextBox::setText(const std::string & text) | ||||
| 	else if(slider) | ||||
| 	{ | ||||
| 		// decrease width again if slider still used | ||||
| 		label->pos.w = pos.w - 32; | ||||
| 		label->pos.w = pos.w - 16; | ||||
| 		assert(label->pos.w > 0); | ||||
| 		label->setText(text); | ||||
| 		slider->setAmount(label->textSize.y); | ||||
| @@ -383,12 +383,12 @@ void CTextBox::setText(const std::string & text) | ||||
| 	else if(label->textSize.y > label->pos.h) | ||||
| 	{ | ||||
| 		// create slider and update widget | ||||
| 		label->pos.w = pos.w - 32; | ||||
| 		label->pos.w = pos.w - 16; | ||||
| 		assert(label->pos.w > 0); | ||||
| 		label->setText(text); | ||||
|  | ||||
| 		OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE); | ||||
| 		slider = std::make_shared<CSlider>(Point(pos.w - 32, 0), pos.h, std::bind(&CTextBox::sliderMoved, this, _1), | ||||
| 		slider = std::make_shared<CSlider>(Point(pos.w - 16, 0), pos.h, std::bind(&CTextBox::sliderMoved, this, _1), | ||||
| 			label->pos.h, label->textSize.y, 0, Orientation::VERTICAL, CSlider::EStyle(sliderStyle)); | ||||
| 		slider->setScrollStep((int)graphics->fonts[label->font]->getLineHeight()); | ||||
| 		slider->setPanningStep(1); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user