mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Most of rendering in BattleInt is done via canvas
- refactoring of CBattleStacksController.cpp - moved EAlignment enum to Geometries.h from CIntObject - renamed EAlignment to ETextAlignment, to avoid conflict with good/evil alignemt - ETextAlignment is now enum class
This commit is contained in:
		| @@ -20,7 +20,7 @@ CreatureCostBox::CreatureCostBox(Rect position, std::string titleText) | ||||
| 	type |= REDRAW_PARENT; | ||||
| 	pos = position + pos; | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(pos.w/2, 10, FONT_SMALL, CENTER, Colors::WHITE, titleText); | ||||
| 	title = std::make_shared<CLabel>(pos.w/2, 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, titleText); | ||||
| } | ||||
|  | ||||
| void CreatureCostBox::set(TResources res) | ||||
| @@ -39,7 +39,7 @@ void CreatureCostBox::createItems(TResources res) | ||||
| 	while(iter.valid()) | ||||
| 	{ | ||||
| 		ImagePtr image = std::make_shared<CAnimImage>("RESOURCE", iter->resType); | ||||
| 		LabelPtr text = std::make_shared<CLabel>(15, 43, FONT_SMALL, CENTER, Colors::WHITE, "0"); | ||||
| 		LabelPtr text = std::make_shared<CLabel>(15, 43, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, "0"); | ||||
|  | ||||
| 		resources.insert(std::make_pair(iter->resType, std::make_pair(text, image))); | ||||
| 		iter++; | ||||
|   | ||||
| @@ -30,7 +30,7 @@ struct SDL_Surface; | ||||
| struct SDL_Color; | ||||
| class CAnimation; | ||||
|  | ||||
| enum EFonts | ||||
| enum EFonts : int | ||||
| { | ||||
| 	FONT_BIG, FONT_CALLI, FONT_CREDITS, FONT_HIGH_SCORE, FONT_MEDIUM, FONT_SMALL, FONT_TIMES, FONT_TINY, FONT_VERD | ||||
| }; | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
| #include "CBattleInterfaceClasses.h" | ||||
| #include "CBattleStacksController.h" | ||||
| #include "../gui/CAnimation.h" | ||||
| #include "../gui/CCanvas.h" | ||||
| #include "../CMusicHandler.h" | ||||
| #include "../CGameInfo.h" | ||||
| #include "../CPlayerInterface.h" | ||||
| @@ -34,7 +35,7 @@ void CBattleEffectsController::displayEffect(EBattleEffect::EBattleEffect effect | ||||
| { | ||||
| 	std::string customAnim = graphics->battleACToDef[effect][0]; | ||||
|  | ||||
| 	owner->stacksController->addNewAnim(new CEffectAnimation(owner, customAnim, destTile)); | ||||
| 	owner->stacksController->addNewAnim(new CEffectAnimation(owner, customAnim, destTile));//FIXME: check positioning for double-hex creatures | ||||
| } | ||||
|  | ||||
| void CBattleEffectsController::displayEffect(EBattleEffect::EBattleEffect effect, uint32_t soundID, const BattleHex & destTile) | ||||
| @@ -98,21 +99,17 @@ void CBattleEffectsController::startAction(const BattleAction* action) | ||||
| { | ||||
| 	const CStack *stack = owner->curInt->cb->battleGetStackByID(action->stackNumber); | ||||
|  | ||||
| 	int txtid = 0; | ||||
| 	switch(action->actionType) | ||||
| 	{ | ||||
| 	case EActionType::WAIT: | ||||
| 		txtid = 136; | ||||
| 		owner->controlPanel->console->addText(stack->formatGeneralMessage(136)); | ||||
| 		break; | ||||
| 	case EActionType::BAD_MORALE: | ||||
| 		txtid = -34; //negative -> no separate singular/plural form | ||||
| 		owner->controlPanel->console->addText(stack->formatGeneralMessage(-34)); | ||||
| 		displayEffect(EBattleEffect::BAD_MORALE, soundBase::BADMRLE, stack->getPosition()); | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
| 	if(txtid != 0) | ||||
| 		owner->controlPanel->console->addText(stack->formatGeneralMessage(txtid)); | ||||
|  | ||||
| 	//displaying special abilities | ||||
| 	auto actionTarget = action->getTarget(owner->curInt->cb.get()); | ||||
| 	switch(action->actionType) | ||||
| @@ -123,7 +120,7 @@ void CBattleEffectsController::startAction(const BattleAction* action) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CBattleEffectsController::showBattlefieldObjects(SDL_Surface *to, const BattleHex & destTile) | ||||
| void CBattleEffectsController::showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & destTile) | ||||
| { | ||||
| 	for (auto & elem : battleEffects) | ||||
| 	{ | ||||
| @@ -138,8 +135,6 @@ void CBattleEffectsController::showBattlefieldObjects(SDL_Surface *to, const Bat | ||||
|  | ||||
| 		auto img = elem.animation->getImage(currentFrame); | ||||
|  | ||||
| 		SDL_Rect temp_rect = genRect(img->height(), img->width(), elem.x, elem.y); | ||||
|  | ||||
| 		img->draw(to, &temp_rect, nullptr); | ||||
| 		canvas->draw(img, Point(elem.x, elem.y)); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
| struct SDL_Surface; | ||||
| class BattleAction; | ||||
| class CAnimation; | ||||
| class CCanvas; | ||||
| class CBattleInterface; | ||||
| struct BattleObjectsByHex; | ||||
| struct CustomEffectInfo; | ||||
| @@ -68,7 +69,7 @@ public: | ||||
| 	void displayEffect(EBattleEffect::EBattleEffect effect, uint32_t soundID, const BattleHex & destTile); //displays custom effect on the battlefield | ||||
| 	void battleTriggerEffect(const BattleTriggerEffect & bte); | ||||
|  | ||||
| 	void showBattlefieldObjects(SDL_Surface *to, const BattleHex & destTile); | ||||
| 	void showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & destTile); | ||||
|  | ||||
|  | ||||
| 	friend class CEffectAnimation; // currently, battleEffects is largely managed by CEffectAnimation, TODO: move this logic into CBattleEffectsController | ||||
|   | ||||
| @@ -72,17 +72,17 @@ CBattleFieldController::CBattleFieldController(CBattleInterface * owner): | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CBattleFieldController::showBackgroundImage(SDL_Surface *to) | ||||
| void CBattleFieldController::showBackgroundImage(std::shared_ptr<CCanvas> canvas) | ||||
| { | ||||
| 	background->draw(to, owner->pos.x, owner->pos.y); | ||||
| 	canvas->draw(background, owner->pos.topLeft()); | ||||
|  | ||||
| 	if (settings["battle"]["cellBorders"].Bool()) | ||||
| 		cellBorders->copyTo(to, owner->pos.topLeft()); | ||||
| 		canvas->draw(cellBorders, owner->pos.topLeft()); | ||||
| } | ||||
|  | ||||
| void CBattleFieldController::showBackgroundImageWithHexes(SDL_Surface *to) | ||||
| void CBattleFieldController::showBackgroundImageWithHexes(std::shared_ptr<CCanvas> canvas) | ||||
| { | ||||
| 	backgroundWithHexes->copyTo(to, owner->pos.topLeft()); | ||||
| 	canvas->draw(backgroundWithHexes, owner->pos.topLeft()); | ||||
| } | ||||
|  | ||||
| void CBattleFieldController::redrawBackgroundWithHexes() | ||||
| @@ -197,10 +197,8 @@ std::set<BattleHex> CBattleFieldController::getHighlightedHexesSpellRange() | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void CBattleFieldController::showHighlightedHexes(SDL_Surface *to) | ||||
| void CBattleFieldController::showHighlightedHexes(std::shared_ptr<CCanvas> canvas) | ||||
| { | ||||
| 	auto canvas = std::make_shared<CCanvas>(to); | ||||
|  | ||||
| 	std::set<BattleHex> hoveredStack = getHighlightedHexesStackRange(); | ||||
| 	std::set<BattleHex> hoveredMouse = getHighlightedHexesSpellRange(); | ||||
|  | ||||
|   | ||||
| @@ -51,12 +51,12 @@ class CBattleFieldController : public CIntObject | ||||
| public: | ||||
| 	CBattleFieldController(CBattleInterface * owner); | ||||
|  | ||||
| 	void showBackgroundImage(SDL_Surface *to); | ||||
| 	void showBackgroundImageWithHexes(SDL_Surface *to); | ||||
| 	void showBackgroundImage(std::shared_ptr<CCanvas> canvas); | ||||
| 	void showBackgroundImageWithHexes(std::shared_ptr<CCanvas> canvas); | ||||
|  | ||||
| 	void redrawBackgroundWithHexes(); | ||||
|  | ||||
| 	void showHighlightedHexes(SDL_Surface *to); | ||||
| 	void showHighlightedHexes(std::shared_ptr<CCanvas> canvas); | ||||
|  | ||||
| 	Rect hexPositionLocal(BattleHex hex) const; | ||||
| 	Rect hexPosition(BattleHex hex) const; | ||||
|   | ||||
| @@ -933,16 +933,16 @@ void CBattleInterface::show(SDL_Surface *to) | ||||
| 	if (stacksController->getActiveStack() != nullptr /*&& creAnims[stacksController->getActiveStack()->ID]->isIdle()*/) //show everything with range | ||||
| 	{ | ||||
| 		// FIXME: any *real* reason to keep this separate? Speed difference can't be that big // TODO: move to showAll? | ||||
| 		fieldController->showBackgroundImageWithHexes(to); | ||||
| 		fieldController->showBackgroundImageWithHexes(canvas); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		fieldController->showBackgroundImage(to); | ||||
| 		obstacleController->showAbsoluteObstacles(to); | ||||
| 		fieldController->showBackgroundImage(canvas); | ||||
| 		obstacleController->showAbsoluteObstacles(canvas); | ||||
| 		if ( siegeController ) | ||||
| 			siegeController->showAbsoluteObstacles(to); | ||||
| 			siegeController->showAbsoluteObstacles(canvas); | ||||
| 	} | ||||
| 	fieldController->showHighlightedHexes(to); | ||||
| 	fieldController->showHighlightedHexes(canvas); | ||||
|  | ||||
| 	showBattlefieldObjects(to); | ||||
| 	projectilesController->showProjectiles(canvas); | ||||
| @@ -959,36 +959,20 @@ void CBattleInterface::show(SDL_Surface *to) | ||||
| 	activateStack(); | ||||
| } | ||||
|  | ||||
| void CBattleInterface::showBattlefieldObjects(SDL_Surface *to, const BattleHex & location ) | ||||
| void CBattleInterface::showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & location ) | ||||
| { | ||||
| 	if (siegeController) | ||||
| 		siegeController->showBattlefieldObjects(to, location); | ||||
| 	obstacleController->showBattlefieldObjects(to, location); | ||||
| 	stacksController->showBattlefieldObjects(to, location); | ||||
| 	effectsController->showBattlefieldObjects(to, location); | ||||
| 		siegeController->showBattlefieldObjects(canvas, location); | ||||
| 	obstacleController->showBattlefieldObjects(canvas, location); | ||||
| 	stacksController->showBattlefieldObjects(canvas, location); | ||||
| 	effectsController->showBattlefieldObjects(canvas, location); | ||||
| } | ||||
|  | ||||
| void CBattleInterface::showBattlefieldObjects(SDL_Surface *to) | ||||
| { | ||||
| 	//auto showHexEntry = [&](BattleObjectsByHex::HexData & hex) | ||||
| 	//{ | ||||
| 	//	if (siegeController) | ||||
| 	//		siegeController->showPiecesOfWall(to, hex.walls); | ||||
| 	//	obstacleController->showObstacles(to, hex.obstacles); | ||||
| 	//	stacksController->showAliveStacks(to, hex.alive); | ||||
| 	//	effectsController->showBattleEffects(to, hex.effects); | ||||
| 	//}; | ||||
| 	auto canvas = std::make_shared<CCanvas>(to); | ||||
|  | ||||
| 	//BattleObjectsByHex objects = sortObjectsByHex(); | ||||
|  | ||||
| 	// dead stacks should be blit first | ||||
| 	//stacksController->showStacks(to, objects.beforeAll.dead); | ||||
| 	//for (auto & data : objects.hex) | ||||
| 	//	stacksController->showStacks(to, data.dead); | ||||
| 	//stacksController->showStacks(to, objects.afterAll.dead); | ||||
|  | ||||
| 	// display objects that must be blit before anything else (e.g. topmost walls) | ||||
| 	//showHexEntry(objects.beforeAll); | ||||
| 	showBattlefieldObjects(canvas, BattleHex::HEX_BEFORE_ALL); | ||||
|  | ||||
| 	// show heroes after "beforeAll" - e.g. topmost wall in siege | ||||
| 	if (attackingHero) | ||||
| @@ -996,13 +980,10 @@ void CBattleInterface::showBattlefieldObjects(SDL_Surface *to) | ||||
| 	if (defendingHero) | ||||
| 		defendingHero->show(to); | ||||
|  | ||||
| 	// actual blit of most of objects, hex by hex | ||||
| 	// NOTE: row-by-row blitting may be a better approach | ||||
| 	//for (auto &data : objects.hex) | ||||
| 	//	showHexEntry(data); | ||||
| 	for (int i = 0; i < GameConstants::BFIELD_SIZE; ++i) | ||||
| 		showBattlefieldObjects(canvas, BattleHex(i)); | ||||
|  | ||||
| 	// objects that must be blit *after* everything else - e.g. bottom tower or some spell effects | ||||
| 	//showHexEntry(objects.afterAll); | ||||
| 	showBattlefieldObjects(canvas, BattleHex::HEX_AFTER_ALL); | ||||
| } | ||||
|  | ||||
| void CBattleInterface::showInterface(SDL_Surface *to) | ||||
|   | ||||
| @@ -34,18 +34,13 @@ struct CustomEffectInfo; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
|  | ||||
| //class CLabel; | ||||
| //class CCallback; | ||||
| //class CBattleAnimation; | ||||
| class CBattleHero; | ||||
| //class CBattleConsole; | ||||
| class CCanvas; | ||||
| class CBattleResultWindow; | ||||
| class CStackQueue; | ||||
| class CPlayerInterface; | ||||
| //class CCreatureAnimation; | ||||
| class CClickableHex; | ||||
| class CAnimation; | ||||
| //class IImage; | ||||
| struct BattleEffect; | ||||
|  | ||||
| class CBattleProjectileController; | ||||
| @@ -106,7 +101,7 @@ private: | ||||
| 	void showInterface(SDL_Surface *to); | ||||
|  | ||||
| 	void showBattlefieldObjects(SDL_Surface *to); | ||||
| 	void showBattlefieldObjects(SDL_Surface *to, const BattleHex & location ); | ||||
| 	void showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & location ); | ||||
|  | ||||
| 	void setHeroAnimation(ui8 side, int phase); | ||||
| public: | ||||
|   | ||||
| @@ -295,26 +295,26 @@ CHeroInfoWindow::CHeroInfoWindow(const InfoAboutHero & hero, Point * position) | ||||
| 	icons.push_back(std::make_shared<CAnimImage>("PortraitsLarge", hero.portrait, 0, 10, 6)); | ||||
|  | ||||
| 	//primary stats | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 75, EFonts::FONT_TINY, EAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[380] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 87, EFonts::FONT_TINY, EAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[381] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 99, EFonts::FONT_TINY, EAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[382] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 111, EFonts::FONT_TINY, EAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[383] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 75, EFonts::FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[380] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 87, EFonts::FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[381] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 99, EFonts::FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[382] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 111, EFonts::FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[383] + ":")); | ||||
|  | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 87, EFonts::FONT_TINY, EAlignment::BOTTOMRIGHT, Colors::WHITE, std::to_string(attack))); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 99, EFonts::FONT_TINY, EAlignment::BOTTOMRIGHT, Colors::WHITE, std::to_string(defense))); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 111, EFonts::FONT_TINY, EAlignment::BOTTOMRIGHT, Colors::WHITE, std::to_string(power))); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 123, EFonts::FONT_TINY, EAlignment::BOTTOMRIGHT, Colors::WHITE, std::to_string(knowledge))); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 87, EFonts::FONT_TINY, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, std::to_string(attack))); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 99, EFonts::FONT_TINY, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, std::to_string(defense))); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 111, EFonts::FONT_TINY, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, std::to_string(power))); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 123, EFonts::FONT_TINY, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, std::to_string(knowledge))); | ||||
|  | ||||
| 	//morale+luck | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 131, EFonts::FONT_TINY, EAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[384] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 143, EFonts::FONT_TINY, EAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[385] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 131, EFonts::FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[384] + ":")); | ||||
| 	labels.push_back(std::make_shared<CLabel>(9, 143, EFonts::FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[385] + ":")); | ||||
|  | ||||
| 	icons.push_back(std::make_shared<CAnimImage>("IMRL22", morale + 3, 0, 47, 131)); | ||||
| 	icons.push_back(std::make_shared<CAnimImage>("ILCK22", luck + 3, 0, 47, 143)); | ||||
|  | ||||
| 	//spell points | ||||
| 	labels.push_back(std::make_shared<CLabel>(39, 174, EFonts::FONT_TINY, EAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[387])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(39, 186, EFonts::FONT_TINY, EAlignment::CENTER, Colors::WHITE, std::to_string(currentSpellPoints) + "/" + std::to_string(maxSpellPoints))); | ||||
| 	labels.push_back(std::make_shared<CLabel>(39, 174, EFonts::FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[387])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(39, 186, EFonts::FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, std::to_string(currentSpellPoints) + "/" + std::to_string(maxSpellPoints))); | ||||
| } | ||||
|  | ||||
| CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInterface *owner) | ||||
| @@ -357,29 +357,29 @@ CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInt | ||||
| 	exit->setImageOrder(1, 0, 2, 3); | ||||
|  | ||||
| 	//creating labels | ||||
| 	labels.push_back(std::make_shared<CLabel>(242,  32, FONT_BIG,    CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[392]));//window title | ||||
| 	labels.push_back(std::make_shared<CLabel>(122, 214, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[393]));//animation speed | ||||
| 	labels.push_back(std::make_shared<CLabel>(122, 293, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[394]));//music volume | ||||
| 	labels.push_back(std::make_shared<CLabel>(122, 359, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[395]));//effects' volume | ||||
| 	labels.push_back(std::make_shared<CLabel>(353,  66, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[396]));//auto - combat options | ||||
| 	labels.push_back(std::make_shared<CLabel>(353, 265, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[397]));//creature info | ||||
| 	labels.push_back(std::make_shared<CLabel>(242,  32, FONT_BIG,    ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[392]));//window title | ||||
| 	labels.push_back(std::make_shared<CLabel>(122, 214, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[393]));//animation speed | ||||
| 	labels.push_back(std::make_shared<CLabel>(122, 293, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[394]));//music volume | ||||
| 	labels.push_back(std::make_shared<CLabel>(122, 359, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[395]));//effects' volume | ||||
| 	labels.push_back(std::make_shared<CLabel>(353,  66, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[396]));//auto - combat options | ||||
| 	labels.push_back(std::make_shared<CLabel>(353, 265, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[397]));//creature info | ||||
|  | ||||
| 	//auto - combat options | ||||
| 	labels.push_back(std::make_shared<CLabel>(283,  86, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[398]));//creatures | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 116, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[399]));//spells | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 146, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[400]));//catapult | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 176, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[151]));//ballista | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 206, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[401]));//first aid tent | ||||
| 	labels.push_back(std::make_shared<CLabel>(283,  86, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[398]));//creatures | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 116, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[399]));//spells | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 146, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[400]));//catapult | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 176, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[151]));//ballista | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 206, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[401]));//first aid tent | ||||
|  | ||||
| 	//creature info | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 285, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[402]));//all stats | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 315, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[403]));//spells only | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 285, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[402]));//all stats | ||||
| 	labels.push_back(std::make_shared<CLabel>(283, 315, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[403]));//spells only | ||||
|  | ||||
| 	//general options | ||||
| 	labels.push_back(std::make_shared<CLabel>(61,  57, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[404])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(61,  90, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[405])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(61, 123, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[406])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(61, 156, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[407])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(61,  57, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[404])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(61,  90, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[405])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(61, 123, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[406])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(61, 156, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[407])); | ||||
| } | ||||
|  | ||||
| void CBattleOptionsWindow::bDefaultf() | ||||
| @@ -406,25 +406,25 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult & br, CPlayerInterfa | ||||
|  | ||||
| 	if(br.winner == 0) //attacker won | ||||
| 	{ | ||||
| 		labels.push_back(std::make_shared<CLabel>(59, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(59, 124, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410])); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		labels.push_back(std::make_shared<CLabel>(59, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(59, 124, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411])); | ||||
| 	} | ||||
|  | ||||
| 	if(br.winner == 1) | ||||
| 	{ | ||||
| 		labels.push_back(std::make_shared<CLabel>(412, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(412, 124, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410])); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		labels.push_back(std::make_shared<CLabel>(408, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(408, 124, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411])); | ||||
| 	} | ||||
|  | ||||
| 	labels.push_back(std::make_shared<CLabel>(232, 302, FONT_BIG, CENTER, Colors::YELLOW,  CGI->generaltexth->allTexts[407])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(232, 332, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[408])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(232, 428, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[409])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(232, 302, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW,  CGI->generaltexth->allTexts[407])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(232, 332, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[408])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(232, 428, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[409])); | ||||
|  | ||||
| 	std::string sideNames[2] = {"N/A", "N/A"}; | ||||
|  | ||||
| @@ -460,15 +460,15 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult & br, CPlayerInterfa | ||||
| 	} | ||||
|  | ||||
| 	//printing attacker and defender's names | ||||
| 	labels.push_back(std::make_shared<CLabel>(89, 37, FONT_SMALL, TOPLEFT, Colors::WHITE, sideNames[0])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(381, 53, FONT_SMALL, BOTTOMRIGHT, Colors::WHITE, sideNames[1])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(89, 37, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, sideNames[0])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(381, 53, FONT_SMALL, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, sideNames[1])); | ||||
|  | ||||
| 	//printing casualties | ||||
| 	for(int step = 0; step < 2; ++step) | ||||
| 	{ | ||||
| 		if(br.casualties[step].size()==0) | ||||
| 		{ | ||||
| 			labels.push_back(std::make_shared<CLabel>(235, 360 + 97 * step, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[523])); | ||||
| 			labels.push_back(std::make_shared<CLabel>(235, 360 + 97 * step, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[523])); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -479,7 +479,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult & br, CPlayerInterfa | ||||
| 				icons.push_back(std::make_shared<CAnimImage>("CPRSMALL", CGI->creatures()->getByIndex(elem.first)->getIconIndex(), 0, xPos, yPos)); | ||||
| 				std::ostringstream amount; | ||||
| 				amount<<elem.second; | ||||
| 				labels.push_back(std::make_shared<CLabel>(xPos + 16, yPos + 42, FONT_SMALL, CENTER, Colors::WHITE, amount.str())); | ||||
| 				labels.push_back(std::make_shared<CLabel>(xPos + 16, yPos + 42, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, amount.str())); | ||||
| 				xPos += 42; | ||||
| 			} | ||||
| 		} | ||||
| @@ -516,7 +516,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult & br, CPlayerInterfa | ||||
| 			boost::algorithm::replace_first(str, "%d", boost::lexical_cast<std::string>(br.exp[weAreAttacker ? 0 : 1])); | ||||
| 		} | ||||
|  | ||||
| 		description = std::make_shared<CTextBox>(str, Rect(69, 203, 330, 68), 0, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 		description = std::make_shared<CTextBox>(str, Rect(69, 203, 330, 68), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	} | ||||
| 	else // we lose | ||||
| 	{ | ||||
| @@ -544,7 +544,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult & br, CPlayerInterfa | ||||
| 		CCS->musich->playMusic(musicName, false, true); | ||||
| 		CCS->videoh->open(videoName); | ||||
|  | ||||
| 		labels.push_back(std::make_shared<CLabel>(235, 235, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[text])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(235, 235, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[text])); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -747,12 +747,12 @@ CStackQueue::StackBox::StackBox(CStackQueue * owner) | ||||
| 	if(owner->embedded) | ||||
| 	{ | ||||
| 		icon = std::make_shared<CAnimImage>(owner->icons, 0, 0, 5, 2); | ||||
| 		amount = std::make_shared<CLabel>(pos.w/2, pos.h - 7, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 		amount = std::make_shared<CLabel>(pos.w/2, pos.h - 7, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		icon = std::make_shared<CAnimImage>(owner->icons, 0, 0, 9, 1); | ||||
| 		amount = std::make_shared<CLabel>(pos.w/2, pos.h - 8, FONT_MEDIUM, CENTER, Colors::WHITE); | ||||
| 		amount = std::make_shared<CLabel>(pos.w/2, pos.h - 8, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE); | ||||
|  | ||||
| 		int icon_x = pos.w - 17; | ||||
| 		int icon_y = pos.h - 18; | ||||
|   | ||||
| @@ -109,7 +109,7 @@ void CBattleObstacleController::obstaclePlaced(const CObstacleInstance & oi) | ||||
| 	//CCS->soundh->playSound(sound); | ||||
| } | ||||
|  | ||||
| void CBattleObstacleController::showAbsoluteObstacles(SDL_Surface * to) | ||||
| void CBattleObstacleController::showAbsoluteObstacles(std::shared_ptr<CCanvas> canvas) | ||||
| { | ||||
| 	//Blit absolute obstacles | ||||
| 	for(auto & oi : owner->curInt->cb->battleGetAllObstacles()) | ||||
| @@ -118,12 +118,12 @@ void CBattleObstacleController::showAbsoluteObstacles(SDL_Surface * to) | ||||
| 		{ | ||||
| 			auto img = getObstacleImage(*oi); | ||||
| 			if(img) | ||||
| 				img->draw(to, owner->pos.x + oi->getInfo().width, owner->pos.y + oi->getInfo().height); | ||||
| 				canvas->draw(img, Point(owner->pos.x + oi->getInfo().width, owner->pos.y + oi->getInfo().height)); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CBattleObstacleController::showBattlefieldObjects(SDL_Surface *to, const BattleHex & location ) | ||||
| void CBattleObstacleController::showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & location ) | ||||
| { | ||||
| 	for (auto &obstacle : owner->curInt->cb->battleGetAllObstacles()) | ||||
| 	{ | ||||
| @@ -140,7 +140,7 @@ void CBattleObstacleController::showBattlefieldObjects(SDL_Surface *to, const Ba | ||||
| 		if(img) | ||||
| 		{ | ||||
| 			Point p = getObstaclePosition(img, *obstacle); | ||||
| 			img->draw(to, p.x, p.y); | ||||
| 			canvas->draw(img, p); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -35,9 +35,9 @@ public: | ||||
|  | ||||
| 	void obstaclePlaced(const CObstacleInstance & oi); | ||||
| 	void showObstacles(SDL_Surface *to, std::vector<std::shared_ptr<const CObstacleInstance>> &obstacles); | ||||
| 	void showAbsoluteObstacles(SDL_Surface *to); | ||||
| 	void showAbsoluteObstacles(std::shared_ptr<CCanvas> canvas); | ||||
|  | ||||
| 	void showBattlefieldObjects(SDL_Surface *to, const BattleHex & location ); | ||||
| 	void showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & location ); | ||||
|  | ||||
| 	void redrawBackgroundWithHexes(std::shared_ptr<CCanvas> to); | ||||
| }; | ||||
|   | ||||
| @@ -19,6 +19,7 @@ | ||||
| #include "../CGameInfo.h" | ||||
| #include "../CPlayerInterface.h" | ||||
| #include "../gui/CAnimation.h" | ||||
| #include "../gui/CCanvas.h" | ||||
|  | ||||
| #include "../../CCallback.h" | ||||
| #include "../../lib/NetPacks.h" | ||||
| @@ -103,12 +104,12 @@ std::string CBattleSiegeController::getWallPieceImageName(EWallVisual::EWallVisu | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CBattleSiegeController::showWallPiece(SDL_Surface *to, EWallVisual::EWallVisual what) | ||||
| void CBattleSiegeController::showWallPiece(std::shared_ptr<CCanvas> canvas, EWallVisual::EWallVisual what) | ||||
| { | ||||
| 	auto & ci = town->town->clientInfo; | ||||
| 	auto const & pos = ci.siegePositions[what]; | ||||
|  | ||||
| 	wallPieceImages[what]->draw(to, pos.x + owner->pos.x, pos.y + owner->pos.y); | ||||
| 	canvas->draw(wallPieceImages[what], owner->pos.topLeft() + Point(pos.x, pos.y)); | ||||
| } | ||||
|  | ||||
| std::string CBattleSiegeController::getBattleBackgroundName() const | ||||
| @@ -249,24 +250,16 @@ void CBattleSiegeController::gateStateChanged(const EGateState state) | ||||
| 		CCS->soundh->playSound(soundBase::DRAWBRG); | ||||
| } | ||||
|  | ||||
| void CBattleSiegeController::showAbsoluteObstacles(SDL_Surface * to) | ||||
| void CBattleSiegeController::showAbsoluteObstacles(std::shared_ptr<CCanvas> canvas) | ||||
| { | ||||
| 	auto & info = town->town->clientInfo; | ||||
|  | ||||
| 	if (getWallPieceExistance(EWallVisual::MOAT)) | ||||
| 	{ | ||||
| 		auto const & pos = info.siegePositions[EWallVisual::MOAT]; | ||||
| 		wallPieceImages[EWallVisual::MOAT]->draw(to, pos.x + owner->pos.x, pos.y + owner->pos.y); | ||||
| 	} | ||||
| 		showWallPiece(canvas, EWallVisual::MOAT); | ||||
|  | ||||
| 	if (getWallPieceExistance(EWallVisual::BACKGROUND_MOAT)) | ||||
| 	{ | ||||
| 		auto const & pos = info.siegePositions[EWallVisual::BACKGROUND_MOAT]; | ||||
| 		wallPieceImages[EWallVisual::BACKGROUND_MOAT]->draw(to, pos.x + owner->pos.x, pos.y + owner->pos.y); | ||||
| 	} | ||||
| 		showWallPiece(canvas, EWallVisual::BACKGROUND_MOAT); | ||||
| } | ||||
|  | ||||
| void CBattleSiegeController::showBattlefieldObjects(SDL_Surface *to, const BattleHex & location ) | ||||
| void CBattleSiegeController::showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & location ) | ||||
| { | ||||
| 	for (int i = EWallVisual::WALL_FIRST; i <= EWallVisual::WALL_LAST; ++i) | ||||
| 	{ | ||||
| @@ -282,7 +275,7 @@ void CBattleSiegeController::showBattlefieldObjects(SDL_Surface *to, const Battl | ||||
| 			wallPiece != EWallVisual::BOTTOM_BATTLEMENT && | ||||
| 			wallPiece != EWallVisual::UPPER_BATTLEMENT) | ||||
| 		{ | ||||
| 			showWallPiece(to, wallPiece); | ||||
| 			showWallPiece(canvas, wallPiece); | ||||
| 			continue; | ||||
| 		} | ||||
|  | ||||
| @@ -314,8 +307,8 @@ void CBattleSiegeController::showBattlefieldObjects(SDL_Surface *to, const Battl | ||||
|  | ||||
| 		if (turret) | ||||
| 		{ | ||||
| 			owner->stacksController->showStack(to, turret); | ||||
| 			showWallPiece(to, wallPiece); | ||||
| 			owner->stacksController->showStack(canvas, turret); | ||||
| 			showWallPiece(canvas, wallPiece); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -15,6 +15,7 @@ | ||||
| struct CatapultAttack; | ||||
| struct Point; | ||||
| struct SDL_Surface; | ||||
| class CCanvas; | ||||
| class CGTownInstance; | ||||
| class CBattleInterface; | ||||
| class CCreature; | ||||
| @@ -77,7 +78,7 @@ class CBattleSiegeController | ||||
| 	/// returns true if chosen wall piece should be present in current battle | ||||
| 	bool getWallPieceExistance(EWallVisual::EWallVisual what) const; | ||||
|  | ||||
| 	void showWallPiece(SDL_Surface *to, EWallVisual::EWallVisual what); | ||||
| 	void showWallPiece(std::shared_ptr<CCanvas> canvas, EWallVisual::EWallVisual what); | ||||
|  | ||||
| public: | ||||
| 	CBattleSiegeController(CBattleInterface * owner, const CGTownInstance *siegeTown); | ||||
| @@ -87,8 +88,8 @@ public: | ||||
| 	void stackIsCatapulting(const CatapultAttack & ca); | ||||
|  | ||||
| 	/// call-ins from other battle controllers | ||||
| 	void showAbsoluteObstacles(SDL_Surface * to); | ||||
| 	void showBattlefieldObjects(SDL_Surface *to, const BattleHex & location ); | ||||
| 	void showAbsoluteObstacles(std::shared_ptr<CCanvas> canvas); | ||||
| 	void showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & location ); | ||||
|  | ||||
| 	/// queries from other battle controllers | ||||
| 	bool isAttackableByCatapult(BattleHex hex) const; | ||||
|   | ||||
| @@ -20,6 +20,7 @@ | ||||
| #include "../gui/CAnimation.h" | ||||
| #include "../gui/SDL_Extensions.h" | ||||
| #include "../gui/CGuiHandler.h" | ||||
| #include "../gui/CCanvas.h" | ||||
| #include "../../lib/battle/BattleHex.h" | ||||
| #include "../CPlayerInterface.h" | ||||
| #include "CCreatureAnimation.h" | ||||
| @@ -82,7 +83,7 @@ CBattleStacksController::CBattleStacksController(CBattleInterface * owner): | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CBattleStacksController::showBattlefieldObjects(SDL_Surface *to, const BattleHex & location ) | ||||
| void CBattleStacksController::showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & location ) | ||||
| { | ||||
| 	auto getCurrentPosition = [&](const CStack *stack) -> BattleHex | ||||
| 	{ | ||||
| @@ -260,7 +261,7 @@ bool CBattleStacksController::stackNeedsAmountBox(const CStack * stack) | ||||
| 	for(auto anim : pendingAnims) //no matter what other conditions below are, hide box when creature is playing hit animation | ||||
| 	{ | ||||
| 		auto hitAnimation = dynamic_cast<CDefenceAnimation*>(anim.first); | ||||
| 		if(hitAnimation && (hitAnimation->stack->ID == stack->ID)) //we process only "current creature" as other creatures will be processed reliably on their own iteration | ||||
| 		if(hitAnimation && (hitAnimation->stack->ID == stack->ID)) | ||||
| 			return false; | ||||
| 	} | ||||
|  | ||||
| @@ -281,57 +282,58 @@ bool CBattleStacksController::stackNeedsAmountBox(const CStack * stack) | ||||
| 	return true; | ||||
| } | ||||
|  | ||||
| void CBattleStacksController::showStackAmountBox(SDL_Surface *to, const CStack * stack) | ||||
| std::shared_ptr<IImage> CBattleStacksController::getStackAmountBox(const CStack * stack) | ||||
| { | ||||
| 	auto getEffectsPositivness = [&](const std::vector<si32> & activeSpells) -> int | ||||
| 	{ | ||||
| 		int pos = 0; | ||||
| 		for (const auto & spellId : activeSpells) | ||||
| 		{ | ||||
| 			pos += CGI->spellh->objects.at(spellId)->positiveness; | ||||
| 		} | ||||
| 		return pos; | ||||
| 	}; | ||||
| 	std::vector<si32> activeSpells = stack->activeSpells(); | ||||
|  | ||||
| 	auto getAmountBoxBackground = [&](int positivness) -> auto | ||||
| 	{ | ||||
| 		if (positivness > 0) | ||||
| 	if ( activeSpells.empty()) | ||||
| 		return amountNormal; | ||||
|  | ||||
| 	int effectsPositivness = 0; | ||||
|  | ||||
| 	for ( auto const & spellID : activeSpells) | ||||
| 		effectsPositivness += CGI->spellh->objects.at(spellID)->positiveness; | ||||
|  | ||||
| 	if (effectsPositivness > 0) | ||||
| 		return amountPositive; | ||||
| 		if (positivness < 0) | ||||
|  | ||||
| 	if (effectsPositivness < 0) | ||||
| 		return amountNegative; | ||||
|  | ||||
| 	return amountEffNeutral; | ||||
| 	}; | ||||
| } | ||||
|  | ||||
| void CBattleStacksController::showStackAmountBox(std::shared_ptr<CCanvas> canvas, const CStack * stack) | ||||
| { | ||||
| 	//blitting amount background box | ||||
| 	auto amountBG = getStackAmountBox(stack); | ||||
|  | ||||
| 	const int sideShift = stack->side == BattleSide::ATTACKER ? 1 : -1; | ||||
| 	const int reverseSideShift = stack->side == BattleSide::ATTACKER ? -1 : 1; | ||||
| 	const BattleHex nextPos = stack->getPosition() + sideShift; | ||||
| 	const bool edge = stack->getPosition() % GameConstants::BFIELD_WIDTH == (stack->side == BattleSide::ATTACKER ? GameConstants::BFIELD_WIDTH - 2 : 1); | ||||
| 	const bool moveInside = !edge && !owner->fieldController->stackCountOutsideHex(nextPos); | ||||
|  | ||||
| 	int xAdd = (stack->side == BattleSide::ATTACKER ? 220 : 202) + | ||||
| 			(stack->doubleWide() ? 44 : 0) * sideShift + | ||||
| 			(moveInside ? amountNormal->width() + 10 : 0) * reverseSideShift; | ||||
| 			(moveInside ? amountBG->width() + 10 : 0) * reverseSideShift; | ||||
| 	int yAdd = 260 + ((stack->side == BattleSide::ATTACKER || moveInside) ? 0 : -15); | ||||
|  | ||||
| 	//blitting amount background box | ||||
| 	std::vector<si32> activeSpells = stack->activeSpells(); | ||||
|  | ||||
| 	auto amountBG = activeSpells.empty() ? amountNormal : getAmountBoxBackground(getEffectsPositivness(activeSpells)); | ||||
| 	amountBG->draw(to, creAnims[stack->ID]->pos.x + xAdd, creAnims[stack->ID]->pos.y + yAdd); | ||||
| 	canvas->draw(amountBG, creAnims[stack->ID]->pos.topLeft() + Point(xAdd, yAdd)); | ||||
|  | ||||
| 	//blitting amount | ||||
| 	Point textPos(creAnims[stack->ID]->pos.x + xAdd + amountNormal->width()/2, | ||||
| 			creAnims[stack->ID]->pos.y + yAdd + amountNormal->height()/2); | ||||
| 	graphics->fonts[FONT_TINY]->renderTextCenter(to, makeNumberShort(stack->getCount()), Colors::WHITE, textPos); | ||||
| 	Point textPos = creAnims[stack->ID]->pos.topLeft() + amountBG->dimensions()/2 + Point(xAdd, yAdd); | ||||
|  | ||||
| 	canvas->drawText(textPos, EFonts::FONT_TINY, Colors::WHITE, ETextAlignment::CENTER, makeNumberShort(stack->getCount())); | ||||
| } | ||||
|  | ||||
| void CBattleStacksController::showStack(SDL_Surface *to, const CStack * stack) | ||||
| void CBattleStacksController::showStack(std::shared_ptr<CCanvas> canvas, const CStack * stack) | ||||
| { | ||||
| 	creAnims[stack->ID]->nextFrame(to, facingRight(stack)); // do actual blit | ||||
| 	creAnims[stack->ID]->nextFrame(canvas, facingRight(stack)); // do actual blit | ||||
| 	creAnims[stack->ID]->incrementFrame(float(GH.mainFPSmng->getElapsedMilliseconds()) / 1000); | ||||
|  | ||||
| 	if (stackNeedsAmountBox(stack)) | ||||
| 		showStackAmountBox(to, stack); | ||||
| 		showStackAmountBox(canvas, stack); | ||||
| } | ||||
|  | ||||
| void CBattleStacksController::updateBattleAnimations() | ||||
| @@ -488,12 +490,10 @@ void CBattleStacksController::startAction(const BattleAction* action) | ||||
| 		assert(stack); | ||||
| 		owner->moveStarted = true; | ||||
| 		if (creAnims[action->stackNumber]->framesInGroup(CCreatureAnim::MOVE_START)) | ||||
| 		{ | ||||
| 			pendingAnims.push_back(std::make_pair(new CMovementStartAnimation(owner, stack), false)); | ||||
| 		} | ||||
| 			addNewAnim(new CMovementStartAnimation(owner, stack)); | ||||
|  | ||||
| 		if(shouldRotate(stack, stack->getPosition(), actionTarget.at(0).hexValue)) | ||||
| 			pendingAnims.push_back(std::make_pair(new CReverseAnimation(owner, stack, stack->getPosition(), true), false)); | ||||
| 			addNewAnim(new CReverseAnimation(owner, stack, stack->getPosition(), true)); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -15,6 +15,7 @@ struct BattleHex; | ||||
| struct StackAttackedInfo; | ||||
| struct BattleAction; | ||||
|  | ||||
| class CCanvas; | ||||
| class SpellID; | ||||
| class CBattleInterface; | ||||
| class CBattleAnimation; | ||||
| @@ -47,7 +48,9 @@ class CBattleStacksController | ||||
| 	ui32 animIDhelper; //for giving IDs for animations | ||||
|  | ||||
| 	bool stackNeedsAmountBox(const CStack * stack); | ||||
| 	void showStackAmountBox(SDL_Surface *to, const CStack * stack); | ||||
| 	void showStackAmountBox(std::shared_ptr<CCanvas> canvas, const CStack * stack); | ||||
|  | ||||
| 	std::shared_ptr<IImage> getStackAmountBox(const CStack * stack); | ||||
|  | ||||
| public: | ||||
| 	CBattleStacksController(CBattleInterface * owner); | ||||
| @@ -75,10 +78,10 @@ public: | ||||
| 	void setHoveredStack(const CStack *stack); | ||||
| 	void setSelectedStack(const CStack *stack); | ||||
|  | ||||
| 	void showAliveStack(SDL_Surface *to, const CStack * stack); | ||||
| 	void showStack(SDL_Surface *to, const CStack * stack); | ||||
| 	void showAliveStack(std::shared_ptr<CCanvas> canvas, const CStack * stack); | ||||
| 	void showStack(std::shared_ptr<CCanvas> canvas, const CStack * stack); | ||||
|  | ||||
| 	void showBattlefieldObjects(SDL_Surface *to, const BattleHex & location ); | ||||
| 	void showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & location ); | ||||
|  | ||||
| 	void addNewAnim(CBattleAnimation *anim); //adds new anim to pendingAnims | ||||
| 	void updateBattleAnimations(); | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
| #include "../../lib/CCreatureHandler.h" | ||||
|  | ||||
| #include "../gui/SDL_Extensions.h" | ||||
| #include "../gui/CCanvas.h" | ||||
|  | ||||
| static const SDL_Color creatureBlueBorder = { 0, 255, 255, 255 }; | ||||
| static const SDL_Color creatureGoldBorder = { 255, 255, 0, 255 }; | ||||
| @@ -296,7 +297,7 @@ void CCreatureAnimation::genBorderPalette(IImage::BorderPallete & target) | ||||
| 	target[2] = addColors(genShadow(64),  genBorderColor(getBorderStrength(elapsedTime), border)); | ||||
| } | ||||
|  | ||||
| void CCreatureAnimation::nextFrame(SDL_Surface * dest, bool attacker) | ||||
| void CCreatureAnimation::nextFrame(std::shared_ptr<CCanvas> canvas, bool attacker) | ||||
| { | ||||
| 	size_t frame = static_cast<size_t>(floor(currentFrame)); | ||||
|  | ||||
| @@ -314,7 +315,7 @@ void CCreatureAnimation::nextFrame(SDL_Surface * dest, bool attacker) | ||||
|  | ||||
| 		image->setBorderPallete(borderPallete); | ||||
|  | ||||
| 		image->draw(dest, pos.x, pos.y); | ||||
| 		canvas->draw(image, pos.topLeft()); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -15,6 +15,7 @@ | ||||
|  | ||||
| class CIntObject; | ||||
| class CCreatureAnimation; | ||||
| class CCanvas; | ||||
|  | ||||
| /// Namespace for some common controls of animations | ||||
| namespace AnimationControls | ||||
| @@ -98,7 +99,7 @@ public: | ||||
| 	void setType(CCreatureAnim::EAnimType type); //sets type of animation and cleares framecount | ||||
| 	CCreatureAnim::EAnimType getType() const; //returns type of animation | ||||
|  | ||||
| 	void nextFrame(SDL_Surface * dest, bool attacker); | ||||
| 	void nextFrame(std::shared_ptr<CCanvas> canvas, bool attacker); | ||||
|  | ||||
| 	// should be called every frame, return true when animation was reset to beginning | ||||
| 	bool incrementFrame(float timePassed); | ||||
|   | ||||
| @@ -14,6 +14,8 @@ | ||||
| #include "Geometries.h" | ||||
| #include "CAnimation.h" | ||||
|  | ||||
| #include "../Graphics.h" | ||||
|  | ||||
| CCanvas::CCanvas(SDL_Surface * surface): | ||||
| 	surface(surface) | ||||
| { | ||||
| @@ -37,7 +39,7 @@ void CCanvas::draw(std::shared_ptr<IImage> image, const Point & pos) | ||||
|  | ||||
| void CCanvas::draw(std::shared_ptr<CCanvas> image, const Point & pos) | ||||
| { | ||||
| 	image->copyTo(surface, pos); | ||||
| 	blitAt(image->surface, pos.x, pos.y, surface); | ||||
| } | ||||
|  | ||||
| void CCanvas::drawLine(const Point & from, const Point & dest, const SDL_Color & colorFrom, const SDL_Color & colorDest) | ||||
| @@ -45,7 +47,28 @@ void CCanvas::drawLine(const Point & from, const Point & dest, const SDL_Color & | ||||
| 	CSDL_Ext::drawLine(surface, from.x, from.y, dest.x, dest.y, colorFrom, colorDest); | ||||
| } | ||||
|  | ||||
| void CCanvas::copyTo(SDL_Surface * to, const Point & pos) | ||||
| void CCanvas::drawText(const Point & position, const EFonts & font, const SDL_Color & colorDest, ETextAlignment alignment, const std::string & text ) | ||||
| { | ||||
| 	blitAt(to, pos.x, pos.y, surface); | ||||
| 	switch (alignment) | ||||
| 	{ | ||||
| 	case ETextAlignment::TOPLEFT:      return graphics->fonts[font]->renderTextLeft  (surface, text, colorDest, position); | ||||
| 	case ETextAlignment::CENTER:       return graphics->fonts[font]->renderTextCenter(surface, text, colorDest, position); | ||||
| 	case ETextAlignment::BOTTOMRIGHT:  return graphics->fonts[font]->renderTextRight (surface, text, colorDest, position); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CCanvas::drawText(const Point & position, const EFonts & font, const SDL_Color & colorDest, ETextAlignment alignment, const std::vector<std::string> & text ) | ||||
| { | ||||
| 	switch (alignment) | ||||
| 	{ | ||||
| 	case ETextAlignment::TOPLEFT:      return graphics->fonts[font]->renderTextLinesLeft  (surface, text, colorDest, position); | ||||
| 	case ETextAlignment::CENTER:       return graphics->fonts[font]->renderTextLinesCenter(surface, text, colorDest, position); | ||||
| 	case ETextAlignment::BOTTOMRIGHT:  return graphics->fonts[font]->renderTextLinesRight (surface, text, colorDest, position); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
| SDL_Surface * CCanvas::getSurface() | ||||
| { | ||||
| 	return surface; | ||||
| } | ||||
|   | ||||
| @@ -9,31 +9,42 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| #include "Geometries.h" | ||||
|  | ||||
| struct SDL_Color; | ||||
| struct SDL_Surface; | ||||
| struct Point; | ||||
| class IImage; | ||||
| enum EFonts : int; | ||||
|  | ||||
| /// Class that represents surface for drawing on | ||||
| class CCanvas | ||||
| { | ||||
| 	SDL_Surface * surface; | ||||
| public: | ||||
| 	// constructs canvas using existing surface. Caller maintains ownership on the surface | ||||
|  | ||||
| 	/// constructs canvas using existing surface. Caller maintains ownership on the surface | ||||
| 	CCanvas(SDL_Surface * surface); | ||||
|  | ||||
| 	/// constructs canvas of specified size | ||||
| 	CCanvas(const Point & size); | ||||
|  | ||||
| 	~CCanvas(); | ||||
|  | ||||
| 	// renders image onto this canvas | ||||
| 	/// renders image onto this canvas | ||||
| 	void draw(std::shared_ptr<IImage> image, const Point & pos); | ||||
|  | ||||
| 	// renders another canvas onto this canvas | ||||
| 	/// renders another canvas onto this canvas | ||||
| 	void draw(std::shared_ptr<CCanvas> image, const Point & pos); | ||||
|  | ||||
| 	// renders continuous, 1-pixel wide line with color gradient | ||||
| 	/// renders continuous, 1-pixel wide line with color gradient | ||||
| 	void drawLine(const Point & from, const Point & dest, const SDL_Color & colorFrom, const SDL_Color & colorDest); | ||||
|  | ||||
| 	// for compatibility, copies content of this canvas onto SDL_Surface | ||||
| 	void copyTo(SDL_Surface * to, const Point & pos); | ||||
| 	/// renders single line of text with specified parameters | ||||
| 	void drawText(const Point & position, const EFonts & font, const SDL_Color & colorDest, ETextAlignment alignment, const std::string & text ); | ||||
|  | ||||
| 	/// renders multiple lines of text with specified parameters | ||||
| 	void drawText(const Point & position, const EFonts & font, const SDL_Color & colorDest, ETextAlignment alignment, const std::vector<std::string> & text ); | ||||
|  | ||||
| 	/// for compatibility, returns pointer to internal SDL surface | ||||
| 	SDL_Surface * getSurface(); | ||||
| }; | ||||
|   | ||||
| @@ -165,8 +165,6 @@ public: | ||||
| 	//request complete redraw of this object | ||||
| 	void redraw() override; | ||||
|  | ||||
| 	enum EAlignment {TOPLEFT, CENTER, BOTTOMRIGHT}; | ||||
|  | ||||
| 	bool isItInLoc(const SDL_Rect &rect, int x, int y); | ||||
| 	bool isItInLoc(const SDL_Rect &rect, const Point &p); | ||||
| 	const Rect & center(const Rect &r, bool propagate = true); //sets pos so that r will be in the center of screen, assigns sizes of r to pos, returns new position | ||||
|   | ||||
| @@ -12,6 +12,8 @@ | ||||
| #include <SDL_video.h> | ||||
| #include "../../lib/int3.h" | ||||
|  | ||||
| enum class ETextAlignment {TOPLEFT, CENTER, BOTTOMRIGHT}; | ||||
|  | ||||
| struct SDL_MouseMotionEvent; | ||||
|  | ||||
| // A point with x/y coordinate, used mostly for graphic rendering | ||||
|   | ||||
| @@ -75,25 +75,25 @@ CBonusSelection::CBonusSelection() | ||||
| 	buttonRestart = std::make_shared<CButton>(Point(475, 536), "CBRESTB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::restartMap, this), SDLK_RETURN); | ||||
| 	buttonBack = std::make_shared<CButton>(Point(624, 536), "CBCANCB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::goBack, this), SDLK_ESCAPE); | ||||
|  | ||||
| 	campaignName = std::make_shared<CLabel>(481, 28, FONT_BIG, EAlignment::TOPLEFT, Colors::YELLOW, CSH->si->getCampaignName()); | ||||
| 	campaignName = std::make_shared<CLabel>(481, 28, FONT_BIG, ETextAlignment::TOPLEFT, Colors::YELLOW, CSH->si->getCampaignName()); | ||||
|  | ||||
| 	iconsMapSizes = std::make_shared<CAnimImage>("SCNRMPSZ", 4, 0, 735, 26); | ||||
|  | ||||
| 	labelCampaignDescription = std::make_shared<CLabel>(481, 63, FONT_SMALL, EAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[38]); | ||||
| 	labelCampaignDescription = std::make_shared<CLabel>(481, 63, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[38]); | ||||
| 	campaignDescription = std::make_shared<CTextBox>(getCampaign()->camp->header.description, Rect(480, 86, 286, 117), 1); | ||||
|  | ||||
| 	mapName = std::make_shared<CLabel>(481, 219, FONT_BIG, EAlignment::TOPLEFT, Colors::YELLOW, CSH->mi->getName()); | ||||
| 	labelMapDescription = std::make_shared<CLabel>(481, 253, FONT_SMALL, EAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[496]); | ||||
| 	mapName = std::make_shared<CLabel>(481, 219, FONT_BIG, ETextAlignment::TOPLEFT, Colors::YELLOW, CSH->mi->getName()); | ||||
| 	labelMapDescription = std::make_shared<CLabel>(481, 253, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[496]); | ||||
| 	mapDescription = std::make_shared<CTextBox>("", Rect(480, 280, 286, 117), 1); | ||||
|  | ||||
| 	labelChooseBonus = std::make_shared<CLabel>(511, 432, FONT_SMALL, EAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[71]); | ||||
| 	labelChooseBonus = std::make_shared<CLabel>(511, 432, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[71]); | ||||
| 	groupBonuses = std::make_shared<CToggleGroup>(std::bind(&IServerAPI::setCampaignBonus, CSH, _1)); | ||||
|  | ||||
| 	flagbox = std::make_shared<CFlagBox>(Rect(486, 407, 335, 23)); | ||||
|  | ||||
| 	std::vector<std::string> difficulty; | ||||
| 	boost::split(difficulty, CGI->generaltexth->allTexts[492], boost::is_any_of(" ")); | ||||
| 	labelDifficulty = std::make_shared<CLabel>(689, 432, FONT_MEDIUM, EAlignment::TOPLEFT, Colors::WHITE, difficulty.back()); | ||||
| 	labelDifficulty = std::make_shared<CLabel>(689, 432, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, difficulty.back()); | ||||
|  | ||||
| 	for(size_t b = 0; b < difficultyIcons.size(); ++b) | ||||
| 	{ | ||||
|   | ||||
| @@ -117,8 +117,8 @@ InfoCard::InfoCard() | ||||
| 	pos.x += 393; | ||||
| 	pos.y += 6; | ||||
|  | ||||
| 	labelSaveDate = std::make_shared<CLabel>(158, 19, FONT_SMALL, TOPLEFT, Colors::WHITE); | ||||
| 	mapName = std::make_shared<CLabel>(26, 39, FONT_BIG, TOPLEFT, Colors::YELLOW); | ||||
| 	labelSaveDate = std::make_shared<CLabel>(158, 19, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 	mapName = std::make_shared<CLabel>(26, 39, FONT_BIG, ETextAlignment::TOPLEFT, Colors::YELLOW); | ||||
| 	Rect descriptionRect(26, 149, 320, 115); | ||||
| 	mapDescription = std::make_shared<CTextBox>("", descriptionRect, 1); | ||||
| 	playerListBg = std::make_shared<CPicture>("CHATPLUG.bmp", 16, 276); | ||||
| @@ -126,7 +126,7 @@ InfoCard::InfoCard() | ||||
|  | ||||
| 	if(SEL->screenType == ESelectionScreen::campaignList) | ||||
| 	{ | ||||
| 		labelCampaignDescription = std::make_shared<CLabel>(26, 132, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[38]); | ||||
| 		labelCampaignDescription = std::make_shared<CLabel>(26, 132, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[38]); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| @@ -154,24 +154,24 @@ InfoCard::InfoCard() | ||||
| 		} | ||||
|  | ||||
| 		flagbox = std::make_shared<CFlagBox>(Rect(24, 400, 335, 23)); | ||||
| 		labelMapDiff = std::make_shared<CLabel>(33, 430, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[494]); | ||||
| 		labelPlayerDifficulty = std::make_shared<CLabel>(133, 430, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[492] + ":"); | ||||
| 		labelRating = std::make_shared<CLabel>(290, 430, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[218] + ":"); | ||||
| 		labelScenarioName = std::make_shared<CLabel>(26, 22, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[495]); | ||||
| 		labelScenarioDescription = std::make_shared<CLabel>(26, 132, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[496]); | ||||
| 		labelVictoryCondition = std::make_shared<CLabel>(26, 283, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[497]); | ||||
| 		labelLossCondition = std::make_shared<CLabel>(26, 339, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[498]); | ||||
| 		labelMapDiff = std::make_shared<CLabel>(33, 430, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[494]); | ||||
| 		labelPlayerDifficulty = std::make_shared<CLabel>(133, 430, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[492] + ":"); | ||||
| 		labelRating = std::make_shared<CLabel>(290, 430, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[218] + ":"); | ||||
| 		labelScenarioName = std::make_shared<CLabel>(26, 22, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[495]); | ||||
| 		labelScenarioDescription = std::make_shared<CLabel>(26, 132, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[496]); | ||||
| 		labelVictoryCondition = std::make_shared<CLabel>(26, 283, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[497]); | ||||
| 		labelLossCondition = std::make_shared<CLabel>(26, 339, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[498]); | ||||
| 		iconsVictoryCondition = std::make_shared<CAnimImage>("SCNRVICT", 0, 0, 24, 302); | ||||
| 		iconsLossCondition = std::make_shared<CAnimImage>("SCNRLOSS", 0, 0, 24, 359); | ||||
|  | ||||
| 		labelVictoryConditionText = std::make_shared<CLabel>(60, 307, FONT_SMALL, TOPLEFT, Colors::WHITE); | ||||
| 		labelLossConditionText = std::make_shared<CLabel>(60, 366, FONT_SMALL, TOPLEFT, Colors::WHITE); | ||||
| 		labelVictoryConditionText = std::make_shared<CLabel>(60, 307, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 		labelLossConditionText = std::make_shared<CLabel>(60, 366, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
|  | ||||
| 		labelDifficulty = std::make_shared<CLabel>(62, 472, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 		labelDifficultyPercent = std::make_shared<CLabel>(311, 472, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 		labelDifficulty = std::make_shared<CLabel>(62, 472, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 		labelDifficultyPercent = std::make_shared<CLabel>(311, 472, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
|  | ||||
| 		labelGroupPlayersAssigned = std::make_shared<CLabelGroup>(FONT_SMALL, TOPLEFT, Colors::WHITE); | ||||
| 		labelGroupPlayersUnassigned = std::make_shared<CLabelGroup>(FONT_SMALL, TOPLEFT, Colors::WHITE); | ||||
| 		labelGroupPlayersAssigned = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 		labelGroupPlayersUnassigned = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 		disableLabelRedraws(); | ||||
| 	} | ||||
| 	setChat(false); | ||||
| @@ -219,8 +219,8 @@ void InfoCard::changeSelection() | ||||
|  | ||||
| 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; | ||||
| 	// FIXME: We recreate them each time because CLabelGroup don't use smart pointers | ||||
| 	labelGroupPlayersAssigned = std::make_shared<CLabelGroup>(FONT_SMALL, TOPLEFT, Colors::WHITE); | ||||
| 	labelGroupPlayersUnassigned = std::make_shared<CLabelGroup>(FONT_SMALL, TOPLEFT, Colors::WHITE); | ||||
| 	labelGroupPlayersAssigned = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 	labelGroupPlayersUnassigned = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 	if(!showChat) | ||||
| 	{ | ||||
| 		labelGroupPlayersAssigned->disable(); | ||||
| @@ -346,8 +346,8 @@ CFlagBox::CFlagBox(const Rect & rect) | ||||
| 	pos.h = rect.h; | ||||
| 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; | ||||
|  | ||||
| 	labelAllies = std::make_shared<CLabel>(0, 0, FONT_SMALL, EAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[390] + ":"); | ||||
| 	labelEnemies = std::make_shared<CLabel>(133, 0, FONT_SMALL, EAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[391] + ":"); | ||||
| 	labelAllies = std::make_shared<CLabel>(0, 0, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[390] + ":"); | ||||
| 	labelEnemies = std::make_shared<CLabel>(133, 0, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[391] + ":"); | ||||
|  | ||||
| 	iconsTeamFlags = std::make_shared<CAnimation>("ITGFLAGS.DEF"); | ||||
| 	iconsTeamFlags->preload(); | ||||
| @@ -389,8 +389,8 @@ CFlagBox::CFlagBoxTooltipBox::CFlagBoxTooltipBox(std::shared_ptr<CAnimation> ico | ||||
| 	pos.w = 256; | ||||
| 	pos.h = 90 + 50 * SEL->getMapInfo()->mapHeader->howManyTeams; | ||||
|  | ||||
| 	labelTeamAlignment = std::make_shared<CLabel>(128, 30, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[657]); | ||||
| 	labelGroupTeams = std::make_shared<CLabelGroup>(FONT_SMALL, EAlignment::CENTER, Colors::WHITE); | ||||
| 	labelTeamAlignment = std::make_shared<CLabel>(128, 30, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[657]); | ||||
| 	labelGroupTeams = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	for(int i = 0; i < SEL->getMapInfo()->mapHeader->howManyTeams; i++) | ||||
| 	{ | ||||
| 		std::vector<ui8> flags; | ||||
|   | ||||
| @@ -38,18 +38,18 @@ OptionsTab::OptionsTab() : humanPlayers(0) | ||||
| 	OBJ_CONSTRUCTION; | ||||
| 	background = std::make_shared<CPicture>("ADVOPTBK", 0, 6); | ||||
| 	pos = background->pos; | ||||
| 	labelTitle = std::make_shared<CLabel>(222, 30, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[515]); | ||||
| 	labelSubTitle = std::make_shared<CMultiLineLabel>(Rect(60, 44, 320, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, EAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[516]); | ||||
| 	labelTitle = std::make_shared<CLabel>(222, 30, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[515]); | ||||
| 	labelSubTitle = std::make_shared<CMultiLineLabel>(Rect(60, 44, 320, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[516]); | ||||
|  | ||||
| 	labelPlayerNameAndHandicap = std::make_shared<CMultiLineLabel>(Rect(58, 86, 100, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, EAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[517]); | ||||
| 	labelStartingTown = std::make_shared<CMultiLineLabel>(Rect(163, 86, 70, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, EAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[518]); | ||||
| 	labelStartingHero = std::make_shared<CMultiLineLabel>(Rect(239, 86, 70, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, EAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[519]); | ||||
| 	labelStartingBonus = std::make_shared<CMultiLineLabel>(Rect(315, 86, 70, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, EAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[520]); | ||||
| 	labelPlayerNameAndHandicap = std::make_shared<CMultiLineLabel>(Rect(58, 86, 100, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[517]); | ||||
| 	labelStartingTown = std::make_shared<CMultiLineLabel>(Rect(163, 86, 70, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[518]); | ||||
| 	labelStartingHero = std::make_shared<CMultiLineLabel>(Rect(239, 86, 70, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[519]); | ||||
| 	labelStartingBonus = std::make_shared<CMultiLineLabel>(Rect(315, 86, 70, (int)graphics->fonts[EFonts::FONT_SMALL]->getLineHeight()*2), EFonts::FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[520]); | ||||
| 	if(SEL->screenType == ESelectionScreen::newGame || SEL->screenType == ESelectionScreen::loadGame || SEL->screenType == ESelectionScreen::scenarioInfo) | ||||
| 	{ | ||||
| 		sliderTurnDuration = std::make_shared<CSlider>(Point(55, 551), 194, std::bind(&IServerAPI::setTurnLength, CSH, _1), 1, (int)GameConstants::POSSIBLE_TURNTIME.size(), (int)GameConstants::POSSIBLE_TURNTIME.size(), true, CSlider::BLUE); | ||||
| 		labelPlayerTurnDuration = std::make_shared<CLabel>(222, 538, FONT_SMALL, EAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[521]); | ||||
| 		labelTurnDurationValue = std::make_shared<CLabel>(319, 559, FONT_SMALL, EAlignment::CENTER, Colors::WHITE); | ||||
| 		labelPlayerTurnDuration = std::make_shared<CLabel>(222, 538, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[521]); | ||||
| 		labelTurnDurationValue = std::make_shared<CLabel>(319, 559, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -368,8 +368,8 @@ void OptionsTab::CPlayerOptionTooltipBox::genHeader() | ||||
| 	backgroundTexture = std::make_shared<CFilledTexture>("DIBOXBCK", pos); | ||||
| 	updateShadow(); | ||||
|  | ||||
| 	labelTitle = std::make_shared<CLabel>(pos.w / 2 + 8, 21, FONT_MEDIUM, CENTER, Colors::YELLOW, getTitle()); | ||||
| 	labelSubTitle = std::make_shared<CLabel>(pos.w / 2, 88, FONT_SMALL, CENTER, Colors::WHITE, getSubtitle()); | ||||
| 	labelTitle = std::make_shared<CLabel>(pos.w / 2 + 8, 21, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, getTitle()); | ||||
| 	labelSubTitle = std::make_shared<CLabel>(pos.w / 2, 88, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, getSubtitle()); | ||||
| 	image = std::make_shared<CAnimImage>(getImageName(), getImageIndex(), 0, pos.w / 2 - 24, 45); | ||||
| } | ||||
|  | ||||
| @@ -377,7 +377,7 @@ void OptionsTab::CPlayerOptionTooltipBox::genTownWindow() | ||||
| { | ||||
| 	pos = Rect(0, 0, 228, 290); | ||||
| 	genHeader(); | ||||
| 	labelAssociatedCreatures = std::make_shared<CLabel>(pos.w / 2 + 8, 122, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[79]); | ||||
| 	labelAssociatedCreatures = std::make_shared<CLabel>(pos.w / 2 + 8, 122, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[79]); | ||||
| 	auto factionIndex = settings.castle >= CGI->townh->size() ? 0 : settings.castle; | ||||
| 	std::vector<std::shared_ptr<CComponent>> components; | ||||
| 	const CTown * town = (*CGI->townh)[factionIndex]->town; | ||||
| @@ -394,11 +394,11 @@ void OptionsTab::CPlayerOptionTooltipBox::genHeroWindow() | ||||
| { | ||||
| 	pos = Rect(0, 0, 292, 226); | ||||
| 	genHeader(); | ||||
| 	labelHeroSpeciality = std::make_shared<CLabel>(pos.w / 2 + 4, 117, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[78]); | ||||
| 	labelHeroSpeciality = std::make_shared<CLabel>(pos.w / 2 + 4, 117, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[78]); | ||||
| 	auto heroIndex = settings.hero >= CGI->heroh->size() ? 0 : settings.hero; | ||||
|  | ||||
| 	imageSpeciality = std::make_shared<CAnimImage>("UN44", (*CGI->heroh)[heroIndex]->imageIndex, 0, pos.w / 2 - 22, 134); | ||||
| 	labelSpecialityName = std::make_shared<CLabel>(pos.w / 2, 188, FONT_SMALL, CENTER, Colors::WHITE, (*CGI->heroh)[heroIndex]->specName); | ||||
| 	labelSpecialityName = std::make_shared<CLabel>(pos.w / 2, 188, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, (*CGI->heroh)[heroIndex]->specName); | ||||
| } | ||||
|  | ||||
| void OptionsTab::CPlayerOptionTooltipBox::genBonusWindow() | ||||
| @@ -406,7 +406,7 @@ void OptionsTab::CPlayerOptionTooltipBox::genBonusWindow() | ||||
| 	pos = Rect(0, 0, 228, 162); | ||||
| 	genHeader(); | ||||
|  | ||||
| 	textBonusDescription = std::make_shared<CTextBox>(getDescription(), Rect(10, 100, pos.w - 20, 70), 0, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 	textBonusDescription = std::make_shared<CTextBox>(getDescription(), Rect(10, 100, pos.w - 20, 70), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| } | ||||
|  | ||||
| OptionsTab::SelectedBox::SelectedBox(Point position, PlayerSettings & settings, SelType type) | ||||
| @@ -415,7 +415,7 @@ OptionsTab::SelectedBox::SelectedBox(Point position, PlayerSettings & settings, | ||||
| 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; | ||||
|  | ||||
| 	image = std::make_shared<CAnimImage>(getImageName(), getImageIndex()); | ||||
| 	subtitle = std::make_shared<CLabel>(23, 39, FONT_TINY, CENTER, Colors::WHITE, getName()); | ||||
| 	subtitle = std::make_shared<CLabel>(23, 39, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, getName()); | ||||
|  | ||||
| 	pos = image->pos; | ||||
| } | ||||
| @@ -479,8 +479,8 @@ OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry(const PlayerSettings & S, con | ||||
| 	}; | ||||
|  | ||||
| 	background = std::make_shared<CPicture>(bgs[s.color.getNum()], 0, 0); | ||||
| 	labelPlayerName = std::make_shared<CLabel>(55, 10, EFonts::FONT_SMALL, EAlignment::CENTER, Colors::WHITE, s.name); | ||||
| 	labelWhoCanPlay = std::make_shared<CMultiLineLabel>(Rect(6, 23, 45, (int)graphics->fonts[EFonts::FONT_TINY]->getLineHeight()*2), EFonts::FONT_TINY, EAlignment::CENTER, Colors::WHITE, CGI->generaltexth->arraytxt[206 + whoCanPlay]); | ||||
| 	labelPlayerName = std::make_shared<CLabel>(55, 10, EFonts::FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, s.name); | ||||
| 	labelWhoCanPlay = std::make_shared<CMultiLineLabel>(Rect(6, 23, 45, (int)graphics->fonts[EFonts::FONT_TINY]->getLineHeight()*2), EFonts::FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->arraytxt[206 + whoCanPlay]); | ||||
|  | ||||
| 	if(SEL->screenType == ESelectionScreen::newGame) | ||||
| 	{ | ||||
|   | ||||
| @@ -35,10 +35,10 @@ RandomMapTab::RandomMapTab() | ||||
| 	OBJ_CONSTRUCTION; | ||||
| 	background = std::make_shared<CPicture>("RANMAPBK", 0, 6); | ||||
|  | ||||
| 	labelHeadlineBig = std::make_shared<CLabel>(222, 36, FONT_BIG, EAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[738]); | ||||
| 	labelHeadlineSmall = std::make_shared<CLabel>(222, 56, FONT_SMALL, EAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[739]); | ||||
| 	labelHeadlineBig = std::make_shared<CLabel>(222, 36, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[738]); | ||||
| 	labelHeadlineSmall = std::make_shared<CLabel>(222, 56, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[739]); | ||||
|  | ||||
| 	labelMapSize = std::make_shared<CLabel>(104, 97, FONT_SMALL, EAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[752]); | ||||
| 	labelMapSize = std::make_shared<CLabel>(104, 97, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[752]); | ||||
| 	groupMapSize = std::make_shared<CToggleGroup>(0); | ||||
| 	groupMapSize->pos.y += 81; | ||||
| 	groupMapSize->pos.x += 158; | ||||
| @@ -61,7 +61,7 @@ RandomMapTab::RandomMapTab() | ||||
| 		updateMapInfoByHost(); | ||||
| 	}); | ||||
|  | ||||
| 	labelGroupForOptions = std::make_shared<CLabelGroup>(FONT_SMALL, EAlignment::TOPLEFT, Colors::WHITE); | ||||
| 	labelGroupForOptions = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 	// Create number defs list | ||||
| 	std::vector<std::string> numberDefs; | ||||
| 	for(int i = 0; i <= 8; ++i) | ||||
|   | ||||
| @@ -141,7 +141,7 @@ SelectionTab::SelectionTab(ESelectionScreen Type) | ||||
| 		pos = background->pos; | ||||
| 		inputName = std::make_shared<CTextInput>(inputNameRect, Point(-32, -25), "GSSTRIP.bmp", 0); | ||||
| 		inputName->filters += CTextInput::filenameFilter; | ||||
| 		labelMapSizes = std::make_shared<CLabel>(87, 62, FONT_SMALL, EAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[510]); | ||||
| 		labelMapSizes = std::make_shared<CLabel>(87, 62, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[510]); | ||||
|  | ||||
| 		int sizes[] = {36, 72, 108, 144, 0}; | ||||
| 		const char * filterIconNmes[] = {"SCSMBUT.DEF", "SCMDBUT.DEF", "SCLGBUT.DEF", "SCXLBUT.DEF", "SCALBUT.DEF"}; | ||||
| @@ -199,7 +199,7 @@ SelectionTab::SelectionTab(ESelectionScreen Type) | ||||
| 	for(int i = 0; i < positionsToShow; i++) | ||||
| 		listItems.push_back(std::make_shared<ListItem>(Point(30, 129 + i * 25), iconsMapFormats, iconsVictoryCondition, iconsLossCondition)); | ||||
|  | ||||
| 	labelTabTitle = std::make_shared<CLabel>(205, 28, FONT_MEDIUM, EAlignment::CENTER, Colors::YELLOW, tabTitle); | ||||
| 	labelTabTitle = std::make_shared<CLabel>(205, 28, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, tabTitle); | ||||
| 	slider = std::make_shared<CSlider>(Point(372, 86), tabType != ESelectionScreen::saveGame ? 480 : 430, std::bind(&SelectionTab::sliderMove, this, _1), positionsToShow, (int)curItems.size(), 0, false, CSlider::BLUE); | ||||
| 	filter(0); | ||||
| } | ||||
| @@ -622,13 +622,13 @@ SelectionTab::ListItem::ListItem(Point position, std::shared_ptr<CAnimation> ico | ||||
| 	: CIntObject(LCLICK, position) | ||||
| { | ||||
| 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; | ||||
| 	labelName = std::make_shared<CLabel>(184, 0, FONT_SMALL, EAlignment::CENTER, Colors::WHITE); | ||||
| 	labelName = std::make_shared<CLabel>(184, 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	labelName->setAutoRedraw(false); | ||||
| 	labelAmountOfPlayers = std::make_shared<CLabel>(8, 0, FONT_SMALL, EAlignment::CENTER, Colors::WHITE); | ||||
| 	labelAmountOfPlayers = std::make_shared<CLabel>(8, 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	labelAmountOfPlayers->setAutoRedraw(false); | ||||
| 	labelNumberOfCampaignMaps = std::make_shared<CLabel>(8, 0, FONT_SMALL, EAlignment::CENTER, Colors::WHITE); | ||||
| 	labelNumberOfCampaignMaps = std::make_shared<CLabel>(8, 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	labelNumberOfCampaignMaps->setAutoRedraw(false); | ||||
| 	labelMapSizeLetter = std::make_shared<CLabel>(41, 0, FONT_SMALL, EAlignment::CENTER, Colors::WHITE); | ||||
| 	labelMapSizeLetter = std::make_shared<CLabel>(41, 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	labelMapSizeLetter->setAutoRedraw(false); | ||||
| 	// FIXME: This -12 should not be needed, but for some reason CAnimImage displaced otherwise | ||||
| 	iconFormat = std::make_shared<CAnimImage>(iconsFormats, 0, 0, 59, -12); | ||||
|   | ||||
| @@ -104,7 +104,7 @@ CCampaignScreen::CCampaignButton::CCampaignButton(const JsonNode & config) | ||||
| 		addUsedEvents(LCLICK | HOVER); | ||||
| 		graphicsImage = std::make_shared<CPicture>(config["image"].String()); | ||||
|  | ||||
| 		hoverLabel = std::make_shared<CLabel>(pos.w / 2, pos.h + 20, FONT_MEDIUM, CENTER, Colors::YELLOW, ""); | ||||
| 		hoverLabel = std::make_shared<CLabel>(pos.w / 2, pos.h + 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, ""); | ||||
| 		parent->addChild(hoverLabel.get()); | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -414,7 +414,7 @@ CMultiPlayers::CMultiPlayers(const std::string & firstPlayer, ESelectionScreen S | ||||
|  | ||||
| 	std::string text = CGI->generaltexth->allTexts[446]; | ||||
| 	boost::replace_all(text, "\t", "\n"); | ||||
| 	textTitle = std::make_shared<CTextBox>(text, Rect(25, 20, 315, 50), 0, FONT_BIG, CENTER, Colors::WHITE); //HOTSEAT	Please enter names | ||||
| 	textTitle = std::make_shared<CTextBox>(text, Rect(25, 20, 315, 50), 0, FONT_BIG, ETextAlignment::CENTER, Colors::WHITE); //HOTSEAT	Please enter names | ||||
|  | ||||
| 	for(int i = 0; i < inputNames.size(); i++) | ||||
| 	{ | ||||
| @@ -462,7 +462,7 @@ CSimpleJoinScreen::CSimpleJoinScreen(bool host) | ||||
| 	background = std::make_shared<CPicture>("MUDIALOG.bmp"); // address background | ||||
| 	pos = background->center(); //center, window has size of bg graphic (x,y = 396,278 w=232 h=212) | ||||
|  | ||||
| 	textTitle = std::make_shared<CTextBox>("", Rect(20, 20, 205, 50), 0, FONT_BIG, CENTER, Colors::WHITE); | ||||
| 	textTitle = std::make_shared<CTextBox>("", Rect(20, 20, 205, 50), 0, FONT_BIG, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	inputAddress = std::make_shared<CTextInput>(Rect(25, 68, 175, 16), *background.get()); | ||||
| 	inputPort = std::make_shared<CTextInput>(Rect(25, 115, 175, 16), *background.get()); | ||||
| 	if(host && !settings["session"]["donotstartserver"].Bool()) | ||||
|   | ||||
| @@ -33,7 +33,7 @@ CPrologEpilogVideo::CPrologEpilogVideo(CCampaignScenario::SScenarioPrologEpilog | ||||
| 	// MPTODO: Custom campaign crashing on this? | ||||
| //	voiceSoundHandle = CCS->soundh->playSound(CCampaignHandler::prologVoiceName(spe.prologVideo)); | ||||
|  | ||||
| 	text = std::make_shared<CMultiLineLabel>(Rect(100, 500, 600, 100), EFonts::FONT_BIG, CENTER, Colors::METALLIC_GOLD, spe.prologText); | ||||
| 	text = std::make_shared<CMultiLineLabel>(Rect(100, 500, 600, 100), EFonts::FONT_BIG, ETextAlignment::CENTER, Colors::METALLIC_GOLD, spe.prologText); | ||||
| 	text->scrollTextTo(-100); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -30,7 +30,7 @@ CreditsScreen::CreditsScreen(Rect rect) | ||||
| 	std::string text((char *)textFile.first.get(), textFile.second); | ||||
| 	size_t firstQuote = text.find('\"') + 1; | ||||
| 	text = text.substr(firstQuote, text.find('\"', firstQuote) - firstQuote); | ||||
| 	credits = std::make_shared<CMultiLineLabel>(Rect(pos.w - 350, 0, 350, 600), FONT_CREDITS, CENTER, Colors::WHITE, text); | ||||
| 	credits = std::make_shared<CMultiLineLabel>(Rect(pos.w - 350, 0, 350, 600), FONT_CREDITS, ETextAlignment::CENTER, Colors::WHITE, text); | ||||
| 	credits->scrollTextTo(-600); // move all text below the screen | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -705,7 +705,7 @@ CInfoBar::VisibleDateInfo::VisibleDateInfo() | ||||
| 	else | ||||
| 		labelText = CGI->generaltexth->allTexts[64] + " " + boost::lexical_cast<std::string>(LOCPLINT->cb->getDate(Date::DAY_OF_WEEK)); | ||||
|  | ||||
| 	label = std::make_shared<CLabel>(95, 31, FONT_MEDIUM, CENTER, Colors::WHITE, labelText); | ||||
| 	label = std::make_shared<CLabel>(95, 31, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, labelText); | ||||
|  | ||||
| 	forceRefresh.push_back(label); | ||||
| } | ||||
| @@ -771,8 +771,8 @@ CInfoBar::VisibleGameStatusInfo::VisibleGameStatusInfo() | ||||
|  | ||||
| 	//generate widgets | ||||
| 	background = std::make_shared<CPicture>("ADSTATIN"); | ||||
| 	allyLabel = std::make_shared<CLabel>(10, 106, FONT_SMALL, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[390] + ":"); | ||||
| 	enemyLabel = std::make_shared<CLabel>(10, 136, FONT_SMALL, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[391] + ":"); | ||||
| 	allyLabel = std::make_shared<CLabel>(10, 106, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[390] + ":"); | ||||
| 	enemyLabel = std::make_shared<CLabel>(10, 136, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[391] + ":"); | ||||
|  | ||||
| 	int posx = allyLabel->pos.w + allyLabel->pos.x - pos.x + 4; | ||||
| 	for(PlayerColor & player : allies) | ||||
| @@ -794,7 +794,7 @@ CInfoBar::VisibleGameStatusInfo::VisibleGameStatusInfo() | ||||
| 	{ | ||||
| 		hallIcons.push_back(std::make_shared<CAnimImage>("itmtl", i, 0, 6 + 42 * (int)i , 11)); | ||||
| 		if(halls[i]) | ||||
| 			hallLabels.push_back(std::make_shared<CLabel>( 26 + 42 * (int)i, 64, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(halls[i]))); | ||||
| 			hallLabels.push_back(std::make_shared<CLabel>( 26 + 42 * (int)i, 64, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(halls[i]))); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -807,7 +807,7 @@ CInfoBar::VisibleComponentInfo::VisibleComponentInfo(const Component & compToDis | ||||
| 	comp = std::make_shared<CComponent>(compToDisplay); | ||||
| 	comp->moveTo(Point(pos.x+47, pos.y+50)); | ||||
|  | ||||
| 	text = std::make_shared<CTextBox>(message, Rect(10, 4, 160, 50), 0, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 	text = std::make_shared<CTextBox>(message, Rect(10, 4, 160, 50), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| } | ||||
|  | ||||
| void CInfoBar::playNewDaySound() | ||||
| @@ -1137,7 +1137,7 @@ void CInGameConsole::startEnteringText() | ||||
|  | ||||
| 		enteredText = "_"; | ||||
|  | ||||
| 		statusBar->alignment = TOPLEFT; | ||||
| 		statusBar->alignment = ETextAlignment::TOPLEFT; | ||||
| 		statusBar->write(enteredText); | ||||
| 		statusBar->lock(true); | ||||
| 	} | ||||
| @@ -1161,7 +1161,7 @@ void CInGameConsole::endEnteringText(bool printEnteredText) | ||||
|  | ||||
| 	if(statusBar) | ||||
| 	{ | ||||
| 		statusBar->alignment = CENTER; | ||||
| 		statusBar->alignment = ETextAlignment::CENTER; | ||||
| 	} | ||||
| 	GH.statusbar->lock(false); | ||||
| 	GH.statusbar->clear(); | ||||
|   | ||||
| @@ -77,7 +77,7 @@ void CButton::addCallback(std::function<void()> callback) | ||||
| void CButton::addTextOverlay(const std::string & Text, EFonts font, SDL_Color color) | ||||
| { | ||||
| 	OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE); | ||||
| 	addOverlay(std::make_shared<CLabel>(pos.w/2, pos.h/2, font, CENTER, color, Text)); | ||||
| 	addOverlay(std::make_shared<CLabel>(pos.w/2, pos.h/2, font, ETextAlignment::CENTER, color, Text)); | ||||
| 	update(); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -74,7 +74,7 @@ void CComponent::init(Etype Type, int Subtype, int Val, ESize imageSize) | ||||
| 	for(auto & line : textLines) | ||||
| 	{ | ||||
| 		int height = static_cast<int>(graphics->fonts[font]->getLineHeight()); | ||||
| 		auto label = std::make_shared<CLabel>(pos.w/2, pos.h + height/2, font, CENTER, Colors::WHITE, line); | ||||
| 		auto label = std::make_shared<CLabel>(pos.w/2, pos.h + height/2, font, ETextAlignment::CENTER, Colors::WHITE, line); | ||||
|  | ||||
| 		pos.h += height; | ||||
| 		if(label->pos.w > pos.w) | ||||
| @@ -423,7 +423,7 @@ void CComponentBox::placeComponents(bool selectable) | ||||
| 				{ | ||||
| 					Point orPos = Point(currentX - freeSpace, currentY) + getOrTextPos(prevComp.get(), iter->get()); | ||||
|  | ||||
| 					orLabels.push_back(std::make_shared<CLabel>(orPos.x, orPos.y, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[4])); | ||||
| 					orLabels.push_back(std::make_shared<CLabel>(orPos.x, orPos.y, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[4])); | ||||
| 				} | ||||
| 				currentX += getDistance(prevComp.get(), iter->get()); | ||||
| 			} | ||||
|   | ||||
| @@ -418,7 +418,7 @@ CGarrisonSlot::CGarrisonSlot(CGarrisonInt * Owner, int x, int y, SlotID IID, CGa | ||||
| 		pos.h = 64; | ||||
| 	} | ||||
|  | ||||
| 	stackCount = std::make_shared<CLabel>(pos.w, pos.h, owner->smallIcons ? FONT_TINY : FONT_MEDIUM, BOTTOMRIGHT, Colors::WHITE); | ||||
| 	stackCount = std::make_shared<CLabel>(pos.w, pos.h, owner->smallIcons ? FONT_TINY : FONT_MEDIUM, ETextAlignment::BOTTOMRIGHT, Colors::WHITE); | ||||
|  | ||||
| 	update(); | ||||
| } | ||||
|   | ||||
| @@ -223,7 +223,7 @@ void CArmyTooltip::init(const InfoAboutArmy &army) | ||||
| { | ||||
| 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(66, 2, FONT_SMALL, TOPLEFT, Colors::WHITE, army.name); | ||||
| 	title = std::make_shared<CLabel>(66, 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, army.name); | ||||
|  | ||||
| 	std::vector<Point> slotsPos; | ||||
| 	slotsPos.push_back(Point(36, 73)); | ||||
| @@ -256,7 +256,7 @@ void CArmyTooltip::init(const InfoAboutArmy &army) | ||||
| 				subtitle = CGI->generaltexth->arraytxt[171 + 3*(slot.second.count)]; | ||||
| 		} | ||||
|  | ||||
| 		subtitles.push_back(std::make_shared<CLabel>(slotsPos[slot.first.getNum()].x + 17, slotsPos[slot.first.getNum()].y + 41, FONT_TINY, CENTER, Colors::WHITE, subtitle)); | ||||
| 		subtitles.push_back(std::make_shared<CLabel>(slotsPos[slot.first.getNum()].x + 17, slotsPos[slot.first.getNum()].y + 41, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, subtitle)); | ||||
| 	} | ||||
|  | ||||
| } | ||||
| @@ -281,10 +281,10 @@ void CHeroTooltip::init(const InfoAboutHero & hero) | ||||
| 	if(hero.details) | ||||
| 	{ | ||||
| 		for(size_t i = 0; i < hero.details->primskills.size(); i++) | ||||
| 			labels.push_back(std::make_shared<CLabel>(75 + 28 * (int)i, 58, FONT_SMALL, CENTER, Colors::WHITE, | ||||
| 			labels.push_back(std::make_shared<CLabel>(75 + 28 * (int)i, 58, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, | ||||
| 					   boost::lexical_cast<std::string>(hero.details->primskills[i]))); | ||||
|  | ||||
| 		labels.push_back(std::make_shared<CLabel>(158, 98, FONT_TINY, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(hero.details->mana))); | ||||
| 		labels.push_back(std::make_shared<CLabel>(158, 98, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(hero.details->mana))); | ||||
|  | ||||
| 		morale = std::make_shared<CAnimImage>("IMRL22", hero.details->morale + 3, 0, 5, 74); | ||||
| 		luck = std::make_shared<CAnimImage>("ILCK22", hero.details->luck + 3, 0, 5, 91); | ||||
| @@ -324,7 +324,7 @@ void CTownTooltip::init(const InfoAboutTown & town) | ||||
|  | ||||
| 		if(town.details->goldIncome) | ||||
| 		{ | ||||
| 			income = std::make_shared<CLabel>(157, 58, FONT_TINY, CENTER, Colors::WHITE, | ||||
| 			income = std::make_shared<CLabel>(157, 58, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, | ||||
| 					   boost::lexical_cast<std::string>(town.details->goldIncome)); | ||||
| 		} | ||||
| 		if(town.details->garrisonedHero) //garrisoned hero icon | ||||
| @@ -452,7 +452,7 @@ CCreaturePic::CCreaturePic(int x, int y, const CCreature * cre, bool Big, bool A | ||||
| 	anim->clipRect(cre->isDoubleWide()?170:150, 155, bg->pos.w, bg->pos.h); | ||||
| 	anim->startPreview(cre->hasBonusOfType(Bonus::SIEGE_WEAPON)); | ||||
|  | ||||
| 	amount = std::make_shared<CLabel>(bg->pos.w, bg->pos.h, FONT_MEDIUM, BOTTOMRIGHT, Colors::WHITE); | ||||
| 	amount = std::make_shared<CLabel>(bg->pos.w, bg->pos.h, FONT_MEDIUM, ETextAlignment::BOTTOMRIGHT, Colors::WHITE); | ||||
|  | ||||
| 	pos.w = bg->pos.w; | ||||
| 	pos.h = bg->pos.h; | ||||
|   | ||||
| @@ -36,7 +36,7 @@ void CLabel::showAll(SDL_Surface * to) | ||||
|  | ||||
| } | ||||
|  | ||||
| CLabel::CLabel(int x, int y, EFonts Font, EAlignment Align, const SDL_Color & Color, const std::string & Text) | ||||
| CLabel::CLabel(int x, int y, EFonts Font, ETextAlignment Align, const SDL_Color & Color, const std::string & Text) | ||||
| 	: CTextContainer(Align, Font, Color), text(Text) | ||||
| { | ||||
| 	type |= REDRAW_PARENT; | ||||
| @@ -45,7 +45,7 @@ CLabel::CLabel(int x, int y, EFonts Font, EAlignment Align, const SDL_Color & Co | ||||
| 	pos.y += y; | ||||
| 	pos.w = pos.h = 0; | ||||
|  | ||||
| 	if(alignment == TOPLEFT) // causes issues for MIDDLE | ||||
| 	if(alignment == ETextAlignment::TOPLEFT) // causes issues for MIDDLE | ||||
| 	{ | ||||
| 		pos.w = (int)graphics->fonts[font]->getStringWidth(visibleText().c_str()); | ||||
| 		pos.h = (int)graphics->fonts[font]->getLineHeight(); | ||||
| @@ -96,7 +96,7 @@ size_t CLabel::getWidth() | ||||
| 	return graphics->fonts[font]->getStringWidth(visibleText());; | ||||
| } | ||||
|  | ||||
| CMultiLineLabel::CMultiLineLabel(Rect position, EFonts Font, EAlignment Align, const SDL_Color & Color, const std::string & Text) : | ||||
| CMultiLineLabel::CMultiLineLabel(Rect position, EFonts Font, ETextAlignment Align, const SDL_Color & Color, const std::string & Text) : | ||||
| 	CLabel(position.x, position.y, Font, Align, Color, Text), | ||||
| 	visibleSize(0, 0, position.w, position.h) | ||||
| { | ||||
| @@ -137,19 +137,19 @@ void CTextContainer::blitLine(SDL_Surface * to, Rect destRect, std::string what) | ||||
|  | ||||
| 	// input is rect in which given text should be placed | ||||
| 	// calculate proper position for top-left corner of the text | ||||
| 	if(alignment == TOPLEFT) | ||||
| 	if(alignment == ETextAlignment::TOPLEFT) | ||||
| 	{ | ||||
| 		where.x += getBorderSize().x; | ||||
| 		where.y += getBorderSize().y; | ||||
| 	} | ||||
|  | ||||
| 	if(alignment == CENTER) | ||||
| 	if(alignment == ETextAlignment::CENTER) | ||||
| 	{ | ||||
| 		where.x += (int(destRect.w) - int(f->getStringWidth(what))) / 2; | ||||
| 		where.y += (int(destRect.h) - int(f->getLineHeight())) / 2; | ||||
| 	} | ||||
|  | ||||
| 	if(alignment == BOTTOMRIGHT) | ||||
| 	if(alignment == ETextAlignment::BOTTOMRIGHT) | ||||
| 	{ | ||||
| 		where.x += getBorderSize().x + destRect.w - (int)f->getStringWidth(what); | ||||
| 		where.y += getBorderSize().y + destRect.h - (int)f->getLineHeight(); | ||||
| @@ -178,7 +178,7 @@ void CTextContainer::blitLine(SDL_Surface * to, Rect destRect, std::string what) | ||||
| 	} while(begin++ != std::string::npos); | ||||
| } | ||||
|  | ||||
| CTextContainer::CTextContainer(EAlignment alignment, EFonts font, SDL_Color color) : | ||||
| CTextContainer::CTextContainer(ETextAlignment alignment, EFonts font, SDL_Color color) : | ||||
| 	alignment(alignment), | ||||
| 	font(font), | ||||
| 	color(color) | ||||
| @@ -252,15 +252,15 @@ Rect CMultiLineLabel::getTextLocation() | ||||
|  | ||||
| 	switch(alignment) | ||||
| 	{ | ||||
| 	case TOPLEFT:     return Rect(pos.topLeft(), textSize); | ||||
| 	case CENTER:      return Rect(pos.topLeft() + textOffset / 2, textSize); | ||||
| 	case BOTTOMRIGHT: return Rect(pos.topLeft() + textOffset, textSize); | ||||
| 	case ETextAlignment::TOPLEFT:     return Rect(pos.topLeft(), textSize); | ||||
| 	case ETextAlignment::CENTER:      return Rect(pos.topLeft() + textOffset / 2, textSize); | ||||
| 	case ETextAlignment::BOTTOMRIGHT: return Rect(pos.topLeft() + textOffset, textSize); | ||||
| 	} | ||||
| 	assert(0); | ||||
| 	return Rect(); | ||||
| } | ||||
|  | ||||
| CLabelGroup::CLabelGroup(EFonts Font, EAlignment Align, const SDL_Color & Color) | ||||
| CLabelGroup::CLabelGroup(EFonts Font, ETextAlignment Align, const SDL_Color & Color) | ||||
| 	: font(Font), align(Align), color(Color) | ||||
| { | ||||
| 	defActions = 255 - DISPOSE; | ||||
| @@ -277,7 +277,7 @@ size_t CLabelGroup::currentSize() const | ||||
| 	return labels.size(); | ||||
| } | ||||
|  | ||||
| CTextBox::CTextBox(std::string Text, const Rect & rect, int SliderStyle, EFonts Font, EAlignment Align, const SDL_Color & Color) : | ||||
| CTextBox::CTextBox(std::string Text, const Rect & rect, int SliderStyle, EFonts Font, ETextAlignment Align, const SDL_Color & Color) : | ||||
| 	sliderStyle(SliderStyle), | ||||
| 	slider(nullptr) | ||||
| { | ||||
| @@ -356,7 +356,7 @@ void CGStatusBar::clear() | ||||
| 	setText(""); | ||||
| } | ||||
|  | ||||
| CGStatusBar::CGStatusBar(std::shared_ptr<CPicture> background_, EFonts Font, EAlignment Align, const SDL_Color & Color) | ||||
| CGStatusBar::CGStatusBar(std::shared_ptr<CPicture> background_, EFonts Font, ETextAlignment Align, const SDL_Color & Color) | ||||
| 	: CLabel(background_->pos.x, background_->pos.y, Font, Align, Color, "") | ||||
| { | ||||
| 	background = background_; | ||||
| @@ -368,7 +368,7 @@ CGStatusBar::CGStatusBar(std::shared_ptr<CPicture> background_, EFonts Font, EAl | ||||
| } | ||||
|  | ||||
| CGStatusBar::CGStatusBar(int x, int y, std::string name, int maxw) | ||||
| 	: CLabel(x, y, FONT_SMALL, CENTER) | ||||
| 	: CLabel(x, y, FONT_SMALL, ETextAlignment::CENTER) | ||||
| { | ||||
| 	OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE); | ||||
| 	background = std::make_shared<CPicture>(name); | ||||
| @@ -401,9 +401,9 @@ Point CGStatusBar::getBorderSize() | ||||
|  | ||||
| 	switch(alignment) | ||||
| 	{ | ||||
| 	case TOPLEFT:     return Point(borderSize.x, borderSize.y); | ||||
| 	case CENTER:      return Point(pos.w / 2, pos.h / 2); | ||||
| 	case BOTTOMRIGHT: return Point(pos.w - borderSize.x, pos.h - borderSize.y); | ||||
| 	case ETextAlignment::TOPLEFT:     return Point(borderSize.x, borderSize.y); | ||||
| 	case ETextAlignment::CENTER:      return Point(pos.w / 2, pos.h / 2); | ||||
| 	case ETextAlignment::BOTTOMRIGHT: return Point(pos.w - borderSize.x, pos.h - borderSize.y); | ||||
| 	} | ||||
| 	assert(0); | ||||
| 	return Point(); | ||||
| @@ -415,7 +415,7 @@ void CGStatusBar::lock(bool shouldLock) | ||||
| } | ||||
|  | ||||
| CTextInput::CTextInput(const Rect & Pos, EFonts font, const CFunctionList<void(const std::string &)> & CB) | ||||
| 	: CLabel(Pos.x, Pos.y, font, CENTER), | ||||
| 	: CLabel(Pos.x, Pos.y, font, ETextAlignment::CENTER), | ||||
| 	cb(CB), | ||||
| 	CFocusable(std::make_shared<CKeyboardFocusListener>(this)) | ||||
| { | ||||
|   | ||||
| @@ -25,10 +25,10 @@ protected: | ||||
| 	/// do actual blitting of line. Text "what" will be placed at "where" and aligned according to alignment | ||||
| 	void blitLine(SDL_Surface * to, Rect where, std::string what); | ||||
|  | ||||
| 	CTextContainer(EAlignment alignment, EFonts font, SDL_Color color); | ||||
| 	CTextContainer(ETextAlignment alignment, EFonts font, SDL_Color color); | ||||
|  | ||||
| public: | ||||
| 	EAlignment alignment; | ||||
| 	ETextAlignment alignment; | ||||
| 	EFonts font; | ||||
| 	SDL_Color color; // default font color. Can be overridden by placing "{}" into the string | ||||
| }; | ||||
| @@ -52,7 +52,7 @@ public: | ||||
| 	virtual void setColor(const SDL_Color & Color); | ||||
| 	size_t getWidth(); | ||||
|  | ||||
| 	CLabel(int x = 0, int y = 0, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, | ||||
| 	CLabel(int x = 0, int y = 0, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, | ||||
| 		const SDL_Color & Color = Colors::WHITE, const std::string & Text = ""); | ||||
| 	void showAll(SDL_Surface * to) override; //shows statusbar (with current text) | ||||
| }; | ||||
| @@ -62,10 +62,10 @@ class CLabelGroup : public CIntObject | ||||
| { | ||||
| 	std::vector<std::shared_ptr<CLabel>> labels; | ||||
| 	EFonts font; | ||||
| 	EAlignment align; | ||||
| 	ETextAlignment align; | ||||
| 	SDL_Color color; | ||||
| public: | ||||
| 	CLabelGroup(EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color & Color = Colors::WHITE); | ||||
| 	CLabelGroup(EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const SDL_Color & Color = Colors::WHITE); | ||||
| 	void add(int x = 0, int y = 0, const std::string & text = ""); | ||||
| 	size_t currentSize() const; | ||||
| }; | ||||
| @@ -86,7 +86,7 @@ public: | ||||
| 	// total size of text, x = longest line of text, y = total height of lines | ||||
| 	Point textSize; | ||||
|  | ||||
| 	CMultiLineLabel(Rect position, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color & Color = Colors::WHITE, const std::string & Text = ""); | ||||
| 	CMultiLineLabel(Rect position, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const SDL_Color & Color = Colors::WHITE, const std::string & Text = ""); | ||||
|  | ||||
| 	void setText(const std::string & Txt) override; | ||||
| 	void showAll(SDL_Surface * to) override; | ||||
| @@ -106,7 +106,7 @@ public: | ||||
| 	std::shared_ptr<CMultiLineLabel> label; | ||||
| 	std::shared_ptr<CSlider> slider; | ||||
|  | ||||
| 	CTextBox(std::string Text, const Rect & rect, int SliderStyle, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color & Color = Colors::WHITE); | ||||
| 	CTextBox(std::string Text, const Rect & rect, int SliderStyle, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const SDL_Color & Color = Colors::WHITE); | ||||
|  | ||||
| 	void resize(Point newSize); | ||||
| 	void setText(const std::string & Txt); | ||||
| @@ -119,7 +119,7 @@ class CGStatusBar : public CLabel, public std::enable_shared_from_this<CGStatusB | ||||
| 	bool textLock; //Used for blocking changes to the text | ||||
| 	void init(); | ||||
|  | ||||
| 	CGStatusBar(std::shared_ptr<CPicture> background_, EFonts Font = FONT_SMALL, EAlignment Align = CENTER, const SDL_Color & Color = Colors::WHITE); | ||||
| 	CGStatusBar(std::shared_ptr<CPicture> background_, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::CENTER, const SDL_Color & Color = Colors::WHITE); | ||||
| 	CGStatusBar(int x, int y, std::string name, int maxw = -1); | ||||
| protected: | ||||
| 	Point getBorderSize() override; | ||||
|   | ||||
| @@ -692,19 +692,19 @@ CAdvMapInt::CAdvMapInt(): | ||||
| 	for (int i = 0; i < 5; ++i) | ||||
| 	{ | ||||
| 		panelWorldView->addChildIcon(std::pair<int, Point>(i, Point(5, 58 + i * 20)), iconColorMultiplier); | ||||
| 		panelWorldView->addChildToPanel(std::make_shared<CLabel>(wvLeft + 45, 263 + i * 20, EFonts::FONT_SMALL, EAlignment::TOPLEFT, | ||||
| 		panelWorldView->addChildToPanel(std::make_shared<CLabel>(wvLeft + 45, 263 + i * 20, EFonts::FONT_SMALL, ETextAlignment::TOPLEFT, | ||||
| 												Colors::WHITE, CGI->generaltexth->allTexts[612 + i])); | ||||
| 	} | ||||
| 	for (int i = 0; i < 7; ++i) | ||||
| 	{ | ||||
| 		panelWorldView->addChildIcon(std::pair<int, Point>(i +  5, Point(5, 182 + i * 20)), iconColorMultiplier); | ||||
| 		panelWorldView->addChildIcon(std::pair<int, Point>(i + 12, Point(160, 182 + i * 20)), iconColorMultiplier); | ||||
| 		panelWorldView->addChildToPanel(std::make_shared<CLabel>(wvLeft + 45, 387 + i * 20, EFonts::FONT_SMALL, EAlignment::TOPLEFT, | ||||
| 		panelWorldView->addChildToPanel(std::make_shared<CLabel>(wvLeft + 45, 387 + i * 20, EFonts::FONT_SMALL, ETextAlignment::TOPLEFT, | ||||
| 												Colors::WHITE, CGI->generaltexth->allTexts[619 + i])); | ||||
| 	} | ||||
| 	panelWorldView->addChildToPanel(std::make_shared<CLabel>(wvLeft +   5, 367, EFonts::FONT_SMALL, EAlignment::TOPLEFT, | ||||
| 	panelWorldView->addChildToPanel(std::make_shared<CLabel>(wvLeft +   5, 367, EFonts::FONT_SMALL, ETextAlignment::TOPLEFT, | ||||
| 											Colors::WHITE, CGI->generaltexth->allTexts[617])); | ||||
| 	panelWorldView->addChildToPanel(std::make_shared<CLabel>(wvLeft + 45, 367, EFonts::FONT_SMALL, EAlignment::TOPLEFT, | ||||
| 	panelWorldView->addChildToPanel(std::make_shared<CLabel>(wvLeft + 45, 367, EFonts::FONT_SMALL, ETextAlignment::TOPLEFT, | ||||
| 											Colors::WHITE, CGI->generaltexth->allTexts[618])); | ||||
|  | ||||
| 	activeMapPanel = panelMain; | ||||
| @@ -1804,7 +1804,7 @@ void CAdvMapInt::tileRClicked(const int3 &mapPos) | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	CRClickPopup::createAndPush(obj, GH.current->motion, CENTER); | ||||
| 	CRClickPopup::createAndPush(obj, GH.current->motion, ETextAlignment::CENTER); | ||||
| } | ||||
|  | ||||
| void CAdvMapInt::enterCastingMode(const CSpell * sp) | ||||
|   | ||||
| @@ -275,19 +275,19 @@ CDwellingInfoBox::CDwellingInfoBox(int centerX, int centerY, const CGTownInstanc | ||||
|  | ||||
| 	const CCreature * creature = CGI->creh->objects.at(Town->creatures.at(level).second.back()); | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(80, 30, FONT_SMALL, CENTER, Colors::WHITE, creature->namePl); | ||||
| 	title = std::make_shared<CLabel>(80, 30, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, creature->namePl); | ||||
| 	animation = std::make_shared<CCreaturePic>(30, 44, creature, true, true); | ||||
|  | ||||
| 	std::string text = boost::lexical_cast<std::string>(Town->creatures.at(level).first); | ||||
| 	available = std::make_shared<CLabel>(80,190, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[217] + text); | ||||
| 	costPerTroop = std::make_shared<CLabel>(80, 227, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[346]); | ||||
| 	available = std::make_shared<CLabel>(80,190, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[217] + text); | ||||
| 	costPerTroop = std::make_shared<CLabel>(80, 227, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[346]); | ||||
|  | ||||
| 	for(int i = 0; i<GameConstants::RESOURCE_QUANTITY; i++) | ||||
| 	{ | ||||
| 		if(creature->cost[i]) | ||||
| 		{ | ||||
| 			resPicture.push_back(std::make_shared<CAnimImage>("RESOURCE", i, 0, 0, 0)); | ||||
| 			resAmount.push_back(std::make_shared<CLabel>(0,0, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(creature->cost[i]))); | ||||
| 			resAmount.push_back(std::make_shared<CLabel>(0,0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(creature->cost[i]))); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -996,14 +996,14 @@ CCreaInfo::CCreaInfo(Point position, const CGTownInstance * Town, int Level, boo | ||||
|  | ||||
| 	if(compact) | ||||
| 	{ | ||||
| 		label = std::make_shared<CLabel>(40, 32, FONT_TINY, BOTTOMRIGHT, Colors::WHITE, value); | ||||
| 		label = std::make_shared<CLabel>(40, 32, FONT_TINY, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, value); | ||||
| 		pos.x += 8; | ||||
| 		pos.w = 32; | ||||
| 		pos.h = 32; | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		label = std::make_shared<CLabel>(24, 40, FONT_SMALL, CENTER, Colors::WHITE, value); | ||||
| 		label = std::make_shared<CLabel>(24, 40, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, value); | ||||
| 		pos.w = 48; | ||||
| 		pos.h = 48; | ||||
| 	} | ||||
| @@ -1143,8 +1143,8 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst | ||||
| 	garr->type |= REDRAW_PARENT; | ||||
|  | ||||
| 	heroes = std::make_shared<HeroSlots>(town, Point(241, 387), Point(241, 483), garr, true); | ||||
| 	title = std::make_shared<CLabel>(85, 387, FONT_MEDIUM, TOPLEFT, Colors::WHITE, town->name); | ||||
| 	income = std::make_shared<CLabel>(195, 443, FONT_SMALL, CENTER); | ||||
| 	title = std::make_shared<CLabel>(85, 387, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, town->name); | ||||
| 	income = std::make_shared<CLabel>(195, 443, FONT_SMALL, ETextAlignment::CENTER); | ||||
| 	icon = std::make_shared<CAnimImage>("ITPT", 0, 0, 15, 387); | ||||
|  | ||||
| 	exit = std::make_shared<CButton>(Point(744, 544), "TSBTNS", CButton::tooltip(CGI->generaltexth->tcommands[8]), [&](){close();}, SDLK_RETURN); | ||||
| @@ -1307,7 +1307,7 @@ CHallInterface::CBuildingBox::CBuildingBox(int x, int y, const CGTownInstance * | ||||
| 	header = std::make_shared<CAnimImage>("TPTHBAR", panelIndex[state], 0, 1, 73); | ||||
| 	if(iconIndex[state] >=0) | ||||
| 		mark = std::make_shared<CAnimImage>("TPTHCHK", iconIndex[state], 0, 136, 56); | ||||
| 	name = std::make_shared<CLabel>(75, 81, FONT_SMALL, CENTER, Colors::WHITE, building->Name()); | ||||
| 	name = std::make_shared<CLabel>(75, 81, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, building->Name()); | ||||
|  | ||||
| 	//todo: add support for all possible states | ||||
| 	if(state >= EBuildingState::BUILDING_ERROR) | ||||
| @@ -1359,7 +1359,7 @@ CHallInterface::CHallInterface(const CGTownInstance * Town): | ||||
| 	auto statusbarBackground = std::make_shared<CPicture>(*background, barRect, 5, 556, false); | ||||
| 	statusbar = CGStatusBar::create(statusbarBackground); | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(399, 12, FONT_MEDIUM, CENTER, Colors::WHITE, town->town->buildings.at(BuildingID(town->hallLevel()+BuildingID::VILLAGE_HALL))->Name()); | ||||
| 	title = std::make_shared<CLabel>(399, 12, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, town->town->buildings.at(BuildingID(town->hallLevel()+BuildingID::VILLAGE_HALL))->Name()); | ||||
| 	exit = std::make_shared<CButton>(Point(748, 556), "TPMAGE1.DEF", CButton::tooltip(CGI->generaltexth->hcommands[8]), [&](){close();}, SDLK_RETURN); | ||||
| 	exit->assignedKeys.insert(SDLK_ESCAPE); | ||||
|  | ||||
| @@ -1406,9 +1406,9 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin | ||||
| 	auto statusbarBackground = std::make_shared<CPicture>(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26); | ||||
| 	statusbar = CGStatusBar::create(statusbarBackground); | ||||
|  | ||||
| 	name = std::make_shared<CLabel>(197, 30, FONT_MEDIUM, CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->hcommands[7]) % building->Name())); | ||||
| 	description = std::make_shared<CTextBox>(building->Description(), Rect(33, 135, 329, 67), 0, FONT_MEDIUM, CENTER); | ||||
| 	stateText = std::make_shared<CTextBox>(getTextForState(state), Rect(33, 216, 329, 67), 0, FONT_SMALL, CENTER); | ||||
| 	name = std::make_shared<CLabel>(197, 30, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->hcommands[7]) % building->Name())); | ||||
| 	description = std::make_shared<CTextBox>(building->Description(), Rect(33, 135, 329, 67), 0, FONT_MEDIUM, ETextAlignment::CENTER); | ||||
| 	stateText = std::make_shared<CTextBox>(getTextForState(state), Rect(33, 216, 329, 67), 0, FONT_SMALL, ETextAlignment::CENTER); | ||||
|  | ||||
| 	//Create components for all required resources | ||||
| 	std::vector<std::shared_ptr<CComponent>> components; | ||||
| @@ -1507,8 +1507,8 @@ void LabeledValue::init(std::string nameText, std::string descr, int min, int ma | ||||
| 		if(min != max) | ||||
| 			valueText += '-' + boost::lexical_cast<std::string>(max); | ||||
| 	} | ||||
| 	name = std::make_shared<CLabel>(3, 0, FONT_SMALL, TOPLEFT, Colors::WHITE, nameText); | ||||
| 	value = std::make_shared<CLabel>(pos.w-3, pos.h-2, FONT_SMALL, BOTTOMRIGHT, Colors::WHITE, valueText); | ||||
| 	name = std::make_shared<CLabel>(3, 0, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, nameText); | ||||
| 	value = std::make_shared<CLabel>(pos.w-3, pos.h-2, FONT_SMALL, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, valueText); | ||||
| } | ||||
|  | ||||
| void LabeledValue::hover(bool on) | ||||
| @@ -1533,7 +1533,7 @@ CFortScreen::CFortScreen(const CGTownInstance * town): | ||||
| 		fortSize--; | ||||
|  | ||||
| 	const CBuilding * fortBuilding = town->town->buildings.at(BuildingID(town->fortLevel()+6)); | ||||
| 	title = std::make_shared<CLabel>(400, 12, FONT_BIG, CENTER, Colors::WHITE, fortBuilding->Name()); | ||||
| 	title = std::make_shared<CLabel>(400, 12, FONT_BIG, ETextAlignment::CENTER, Colors::WHITE, fortBuilding->Name()); | ||||
|  | ||||
| 	std::string text = boost::str(boost::format(CGI->generaltexth->fcommands[6]) % fortBuilding->Name()); | ||||
| 	exit = std::make_shared<CButton>(Point(748, 556), "TPMAGE1", CButton::tooltip(text), [&](){ close(); }, SDLK_RETURN); | ||||
| @@ -1620,13 +1620,13 @@ CFortScreen::RecruitArea::RecruitArea(int posX, int posY, const CGTownInstance * | ||||
| 	if(getMyBuilding() != nullptr) | ||||
| 	{ | ||||
| 		buildingIcon = std::make_shared<CAnimImage>(town->town->clientInfo.buildingsIcons, getMyBuilding()->bid, 0, 4, 21); | ||||
| 		buildingName = std::make_shared<CLabel>(78, 101, FONT_SMALL, CENTER, Colors::WHITE, getMyBuilding()->Name()); | ||||
| 		buildingName = std::make_shared<CLabel>(78, 101, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, getMyBuilding()->Name()); | ||||
|  | ||||
| 		if(vstd::contains(town->builtBuildings, getMyBuilding()->bid)) | ||||
| 		{ | ||||
| 			ui32 available = town->creatures[level].first; | ||||
| 			std::string availableText = CGI->generaltexth->allTexts[217]+ boost::lexical_cast<std::string>(available); | ||||
| 			availableCount = std::make_shared<CLabel>(78, 119, FONT_SMALL, CENTER, Colors::WHITE, availableText); | ||||
| 			availableCount = std::make_shared<CLabel>(78, 119, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, availableText); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -1634,7 +1634,7 @@ CFortScreen::RecruitArea::RecruitArea(int posX, int posY, const CGTownInstance * | ||||
| 	{ | ||||
| 		hoverText = boost::str(boost::format(CGI->generaltexth->tcommands[21]) % getMyCreature()->namePl); | ||||
| 		new CCreaturePic(159, 4, getMyCreature(), false); | ||||
| 		new CLabel(78,  11, FONT_SMALL, CENTER, Colors::WHITE, getMyCreature()->namePl); | ||||
| 		new CLabel(78,  11, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, getMyCreature()->namePl); | ||||
|  | ||||
| 		Rect sizes(287, 4, 96, 18); | ||||
| 		values.push_back(std::make_shared<LabeledValue>(sizes, CGI->generaltexth->allTexts[190], CGI->generaltexth->fcommands[0], getMyCreature()->getAttack(false))); | ||||
| @@ -1797,10 +1797,10 @@ CBlacksmithDialog::CBlacksmithDialog(bool possible, CreatureID creMachineID, Art | ||||
| 	anim = std::make_shared<CCreatureAnim>(64, 50, creature->animDefName); | ||||
| 	anim->clipRect(113,125,200,150); | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(165, 28, FONT_BIG, CENTER, Colors::YELLOW, | ||||
| 	title = std::make_shared<CLabel>(165, 28, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, | ||||
| 	            boost::str(boost::format(CGI->generaltexth->allTexts[274]) % creature->nameSing)); | ||||
| 	costText = std::make_shared<CLabel>(165, 218, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->jktexts[43]); | ||||
| 	costValue = std::make_shared<CLabel>(165, 290, FONT_MEDIUM, CENTER, Colors::WHITE, | ||||
| 	costText = std::make_shared<CLabel>(165, 218, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->jktexts[43]); | ||||
| 	costValue = std::make_shared<CLabel>(165, 290, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, | ||||
| 	                boost::lexical_cast<std::string>(aid.toArtifact(CGI->artifacts())->getPrice())); | ||||
|  | ||||
| 	std::string text = boost::str(boost::format(CGI->generaltexth->allTexts[595]) % creature->nameSing); | ||||
|   | ||||
| @@ -239,8 +239,8 @@ CStackWindow::BonusLineSection::BonusLineSection(CStackWindow * owner, size_t li | ||||
| 		{ | ||||
| 			BonusInfo & bi = parent->activeBonuses[bonusIndex]; | ||||
| 			icon[leftRight] = std::make_shared<CPicture>(bi.imagePath, position.x, position.y); | ||||
| 			name[leftRight] = std::make_shared<CLabel>(position.x + 60, position.y + 2, FONT_SMALL, TOPLEFT, Colors::WHITE, bi.name); | ||||
| 			description[leftRight] = std::make_shared<CMultiLineLabel>(Rect(position.x + 60, position.y + 17, 137, 30), FONT_SMALL, TOPLEFT, Colors::WHITE, bi.description); | ||||
| 			name[leftRight] = std::make_shared<CLabel>(position.x + 60, position.y + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, bi.name); | ||||
| 			description[leftRight] = std::make_shared<CMultiLineLabel>(Rect(position.x + 60, position.y + 17, 137, 30), FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, bi.description); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -511,7 +511,7 @@ CStackWindow::MainSection::MainSection(CStackWindow * owner, int yOffset, bool s | ||||
| 		animation->setAmount(parent->info->creatureCount); | ||||
| 	} | ||||
|  | ||||
| 	name = std::make_shared<CLabel>(215, 12, FONT_SMALL, CENTER, Colors::YELLOW, parent->info->getName()); | ||||
| 	name = std::make_shared<CLabel>(215, 12, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, parent->info->getName()); | ||||
|  | ||||
| 	int dmgMultiply = 1; | ||||
| 	if(parent->info->owner && parent->info->stackNode->hasBonusOfType(Bonus::SIEGE_WEAPON)) | ||||
| @@ -585,7 +585,7 @@ CStackWindow::MainSection::MainSection(CStackWindow * owner, int yOffset, bool s | ||||
| 			expArea->text = parent->generateStackExpDescription(); | ||||
| 		} | ||||
| 		expLabel = std::make_shared<CLabel>( | ||||
| 				pos.x + 21, pos.y + 52, FONT_SMALL, CENTER, Colors::WHITE, | ||||
| 				pos.x + 21, pos.y + 52, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, | ||||
| 				makeNumberShort<TExpType>(stack->experience, 6)); | ||||
| 	} | ||||
|  | ||||
| @@ -630,7 +630,7 @@ std::string CStackWindow::MainSection::getBackgroundName(bool showExp, bool show | ||||
| void CStackWindow::MainSection::addStatLabel(EStat index, int64_t value1, int64_t value2) | ||||
| { | ||||
| 	const auto title = statNames.at(static_cast<size_t>(index)); | ||||
| 	stats.push_back(std::make_shared<CLabel>(145, 32 + (int)index*19, FONT_SMALL, TOPLEFT, Colors::WHITE, title)); | ||||
| 	stats.push_back(std::make_shared<CLabel>(145, 32 + (int)index*19, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, title)); | ||||
|  | ||||
| 	const bool useRange = value1 != value2; | ||||
| 	std::string formatStr = useRange ? statFormats.at(static_cast<size_t>(index)) : "%d"; | ||||
| @@ -640,7 +640,7 @@ void CStackWindow::MainSection::addStatLabel(EStat index, int64_t value1, int64_ | ||||
| 	if(useRange) | ||||
| 		fmt % value2; | ||||
|  | ||||
| 	stats.push_back(std::make_shared<CLabel>(307, 48 + (int)index*19, FONT_SMALL, BOTTOMRIGHT, Colors::WHITE, fmt.str())); | ||||
| 	stats.push_back(std::make_shared<CLabel>(307, 48 + (int)index*19, FONT_SMALL, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, fmt.str())); | ||||
| } | ||||
|  | ||||
| void CStackWindow::MainSection::addStatLabel(EStat index, int64_t value) | ||||
|   | ||||
| @@ -108,18 +108,18 @@ CHeroWindow::CHeroWindow(const CGHeroInstance * hero) | ||||
| 	curHero = hero; | ||||
|  | ||||
| 	banner = std::make_shared<CAnimImage>("CREST58", LOCPLINT->playerID.getNum(), 0, 606, 8); | ||||
| 	name = std::make_shared<CLabel>(190, 38, EFonts::FONT_BIG, EAlignment::CENTER, Colors::YELLOW); | ||||
| 	title = std::make_shared<CLabel>(190, 65, EFonts::FONT_MEDIUM, EAlignment::CENTER, Colors::WHITE); | ||||
| 	name = std::make_shared<CLabel>(190, 38, EFonts::FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW); | ||||
| 	title = std::make_shared<CLabel>(190, 65, EFonts::FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE); | ||||
|  | ||||
| 	statusbar = CGStatusBar::create(7, 559, "ADROLLVR.bmp", 660); | ||||
|  | ||||
| 	quitButton = std::make_shared<CButton>(Point(609, 516), "hsbtns.def", CButton::tooltip(heroscrn[17]), [=](){ close(); }, SDLK_RETURN); | ||||
| 	quitButton->assignedKeys.insert(SDLK_ESCAPE); | ||||
|  | ||||
| 	dismissLabel = std::make_shared<CTextBox>(CGI->generaltexth->jktexts[8], Rect(370, 430, 65, 35), 0, FONT_SMALL, TOPLEFT, Colors::WHITE); | ||||
| 	dismissLabel = std::make_shared<CTextBox>(CGI->generaltexth->jktexts[8], Rect(370, 430, 65, 35), 0, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 	dismissButton = std::make_shared<CButton>(Point(454, 429), "hsbtns2.def", CButton::tooltip(heroscrn[28]), [=](){ dismissCurrent(); }, SDLK_d); | ||||
|  | ||||
| 	questlogLabel = std::make_shared<CTextBox>(CGI->generaltexth->jktexts[9], Rect(510, 430, 65, 35), 0, FONT_SMALL, TOPLEFT, Colors::WHITE); | ||||
| 	questlogLabel = std::make_shared<CTextBox>(CGI->generaltexth->jktexts[9], Rect(510, 430, 65, 35), 0, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 	questlogButton = std::make_shared<CButton>(Point(314, 429), "hsbtns4.def", CButton::tooltip(heroscrn[0]), [=](){ LOCPLINT->showQuestLog(); }, SDLK_q); | ||||
|  | ||||
| 	formations = std::make_shared<CToggleGroup>(0); | ||||
| @@ -148,7 +148,7 @@ CHeroWindow::CHeroWindow(const CGHeroInstance * hero) | ||||
| 		area->hoverText = boost::str(boost::format(CGI->generaltexth->heroscrn[1]) % CGI->generaltexth->primarySkillNames[v]); | ||||
| 		primSkillAreas.push_back(area); | ||||
|  | ||||
| 		auto value = std::make_shared<CLabel>(53 + 70 * v, 166, FONT_SMALL, CENTER); | ||||
| 		auto value = std::make_shared<CLabel>(53 + 70 * v, 166, FONT_SMALL, ETextAlignment::CENTER); | ||||
| 		primSkillValues.push_back(value); | ||||
| 	} | ||||
|  | ||||
| @@ -183,19 +183,19 @@ CHeroWindow::CHeroWindow(const CGHeroInstance * hero) | ||||
| 		int x = (i % 2) ? 212 : 68; | ||||
| 		int y = 280 + 48 * (i/2); | ||||
|  | ||||
| 		secSkillValues.push_back(std::make_shared<CLabel>(x, y, FONT_SMALL, TOPLEFT)); | ||||
| 		secSkillNames.push_back(std::make_shared<CLabel>(x, y+20, FONT_SMALL, TOPLEFT)); | ||||
| 		secSkillValues.push_back(std::make_shared<CLabel>(x, y, FONT_SMALL, ETextAlignment::TOPLEFT)); | ||||
| 		secSkillNames.push_back(std::make_shared<CLabel>(x, y+20, FONT_SMALL, ETextAlignment::TOPLEFT)); | ||||
| 	} | ||||
|  | ||||
| 	// various texts | ||||
| 	labels.push_back(std::make_shared<CLabel>(52, 99, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[1])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(123, 99, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[2])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(193, 99, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[3])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(262, 99, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[4])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(52, 99, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[1])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(123, 99, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[2])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(193, 99, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[3])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(262, 99, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[4])); | ||||
|  | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 183, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->jktexts[5])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 232, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->jktexts[6])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(213, 232, FONT_SMALL, TOPLEFT, Colors::YELLOW, CGI->generaltexth->jktexts[7])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 183, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->jktexts[5])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(69, 232, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->jktexts[6])); | ||||
| 	labels.push_back(std::make_shared<CLabel>(213, 232, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->jktexts[7])); | ||||
|  | ||||
| 	update(hero); | ||||
| } | ||||
|   | ||||
| @@ -54,20 +54,20 @@ InfoBox::InfoBox(Point position, InfoPos Pos, InfoSize Size, std::shared_ptr<IIn | ||||
| 	switch(infoPos) | ||||
| 	{ | ||||
| 	case POS_CORNER: | ||||
| 		value = std::make_shared<CLabel>(pos.w, pos.h, font, BOTTOMRIGHT, Colors::WHITE, data->getValueText()); | ||||
| 		value = std::make_shared<CLabel>(pos.w, pos.h, font, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, data->getValueText()); | ||||
| 		break; | ||||
| 	case POS_INSIDE: | ||||
| 		value = std::make_shared<CLabel>(pos.w/2, pos.h-6, font, CENTER, Colors::WHITE, data->getValueText()); | ||||
| 		value = std::make_shared<CLabel>(pos.w/2, pos.h-6, font, ETextAlignment::CENTER, Colors::WHITE, data->getValueText()); | ||||
| 		break; | ||||
| 	case POS_UP_DOWN: | ||||
| 		name = std::make_shared<CLabel>(pos.w/2, -12, font, CENTER, Colors::WHITE, data->getNameText()); | ||||
| 		name = std::make_shared<CLabel>(pos.w/2, -12, font, ETextAlignment::CENTER, Colors::WHITE, data->getNameText()); | ||||
| 		FALLTHROUGH; | ||||
| 	case POS_DOWN: | ||||
| 		value = std::make_shared<CLabel>(pos.w/2, pos.h+8, font, CENTER, Colors::WHITE, data->getValueText()); | ||||
| 		value = std::make_shared<CLabel>(pos.w/2, pos.h+8, font, ETextAlignment::CENTER, Colors::WHITE, data->getValueText()); | ||||
| 		break; | ||||
| 	case POS_RIGHT: | ||||
| 		name = std::make_shared<CLabel>(pos.w+6, 6, font, TOPLEFT, Colors::WHITE, data->getNameText()); | ||||
| 		value = std::make_shared<CLabel>(pos.w+6, pos.h-16, font, TOPLEFT, Colors::WHITE, data->getValueText()); | ||||
| 		name = std::make_shared<CLabel>(pos.w+6, 6, font, ETextAlignment::TOPLEFT, Colors::WHITE, data->getNameText()); | ||||
| 		value = std::make_shared<CLabel>(pos.w+6, pos.h-16, font, ETextAlignment::TOPLEFT, Colors::WHITE, data->getValueText()); | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
| @@ -601,7 +601,7 @@ void CKingdomInterface::generateMinesList(const std::vector<const CGObjectInstan | ||||
| 	incomeArea = std::make_shared<CHoverableArea>(); | ||||
| 	incomeArea->pos = Rect(pos.x+580, pos.y+31+footerPos, 136, 68); | ||||
| 	incomeArea->hoverText = CGI->generaltexth->allTexts[255]; | ||||
| 	incomeAmount = std::make_shared<CLabel>(628, footerPos + 70, FONT_SMALL, TOPLEFT, Colors::WHITE, boost::lexical_cast<std::string>(totalIncome)); | ||||
| 	incomeAmount = std::make_shared<CLabel>(628, footerPos + 70, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, boost::lexical_cast<std::string>(totalIncome)); | ||||
| } | ||||
|  | ||||
| void CKingdomInterface::generateButtons() | ||||
| @@ -682,8 +682,8 @@ CKingdHeroList::CKingdHeroList(size_t maxSize) | ||||
| 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); | ||||
| 	title = std::make_shared<CPicture>("OVTITLE",16,0); | ||||
| 	title->colorize(LOCPLINT->playerID); | ||||
| 	heroLabel = std::make_shared<CLabel>(150, 10, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[0]); | ||||
| 	skillsLabel = std::make_shared<CLabel>(500, 10, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[1]); | ||||
| 	heroLabel = std::make_shared<CLabel>(150, 10, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->overview[0]); | ||||
| 	skillsLabel = std::make_shared<CLabel>(500, 10, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->overview[1]); | ||||
|  | ||||
| 	ui32 townCount = LOCPLINT->cb->howManyHeroes(false); | ||||
| 	ui32 size = conf.go()->ac.overviewSize*116 + 19; | ||||
| @@ -722,9 +722,9 @@ CKingdTownList::CKingdTownList(size_t maxSize) | ||||
| 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); | ||||
| 	title = std::make_shared<CPicture>("OVTITLE", 16, 0); | ||||
| 	title->colorize(LOCPLINT->playerID); | ||||
| 	townLabel = std::make_shared<CLabel>(146, 10,FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[3]); | ||||
| 	garrHeroLabel = std::make_shared<CLabel>(375, 10, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[4]); | ||||
| 	visitHeroLabel = std::make_shared<CLabel>(608, 10, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[5]); | ||||
| 	townLabel = std::make_shared<CLabel>(146, 10,FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->overview[3]); | ||||
| 	garrHeroLabel = std::make_shared<CLabel>(375, 10, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->overview[4]); | ||||
| 	visitHeroLabel = std::make_shared<CLabel>(608, 10, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->overview[5]); | ||||
|  | ||||
| 	ui32 townCount = LOCPLINT->cb->howManyTowns(); | ||||
| 	ui32 size = conf.go()->ac.overviewSize*116 + 19; | ||||
| @@ -767,9 +767,9 @@ CTownItem::CTownItem(const CGTownInstance * Town) | ||||
| { | ||||
| 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); | ||||
| 	background = std::make_shared<CAnimImage>("OVSLOT", 6); | ||||
| 	name = std::make_shared<CLabel>(74, 8, FONT_SMALL, TOPLEFT, Colors::WHITE, town->name); | ||||
| 	name = std::make_shared<CLabel>(74, 8, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, town->name); | ||||
|  | ||||
| 	income = std::make_shared<CLabel>( 190, 60, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(town->dailyIncome()[Res::GOLD])); | ||||
| 	income = std::make_shared<CLabel>( 190, 60, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(town->dailyIncome()[Res::GOLD])); | ||||
| 	hall = std::make_shared<CTownInfo>( 69, 31, town, true); | ||||
| 	fort = std::make_shared<CTownInfo>(111, 31, town, false); | ||||
|  | ||||
| @@ -863,7 +863,7 @@ CHeroItem::CHeroItem(const CGHeroInstance * Hero) | ||||
| 	arts2->recActions = SHARE_POS; | ||||
| 	backpack->recActions = SHARE_POS; | ||||
|  | ||||
| 	name = std::make_shared<CLabel>(75, 7, FONT_SMALL, TOPLEFT, Colors::WHITE, hero->name); | ||||
| 	name = std::make_shared<CLabel>(75, 7, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, hero->name); | ||||
|  | ||||
| 	//layout is not trivial: MACH4 - catapult - excluded, MISC[x] rearranged | ||||
| 	assert(arts1->arts.size() == 9); | ||||
| @@ -919,8 +919,8 @@ CHeroItem::CHeroItem(const CGHeroInstance * Hero) | ||||
| 	portrait = std::make_shared<CAnimImage>("PortraitsLarge", hero->portrait, 0, 5, 6); | ||||
| 	heroArea = std::make_shared<CHeroArea>(5, 6, hero); | ||||
|  | ||||
| 	name = std::make_shared<CLabel>(73, 7, FONT_SMALL, TOPLEFT, Colors::WHITE, hero->name); | ||||
| 	artsText = std::make_shared<CLabel>(320, 55, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->overview[2]); | ||||
| 	name = std::make_shared<CLabel>(73, 7, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, hero->name); | ||||
| 	artsText = std::make_shared<CLabel>(320, 55, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->overview[2]); | ||||
|  | ||||
| 	for(size_t i=0; i<GameConstants::PRIMARY_SKILLS; i++) | ||||
| 	{ | ||||
|   | ||||
| @@ -130,11 +130,11 @@ CQuestLog::CQuestLog (const std::vector<QuestInfo> & Quests) | ||||
|  | ||||
| 	minimap = std::make_shared<CQuestMinimap>(Rect(12, 12, 169, 169)); | ||||
| 	// TextBox have it's own 4 pixel padding from top at least for English. To achieve 10px from both left and top only add 6px margin | ||||
| 	description = std::make_shared<CTextBox>("", Rect(205, 18, 385, DESCRIPTION_HEIGHT_MAX), CSlider::BROWN, FONT_MEDIUM, TOPLEFT, Colors::WHITE); | ||||
| 	description = std::make_shared<CTextBox>("", Rect(205, 18, 385, DESCRIPTION_HEIGHT_MAX), CSlider::BROWN, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 	ok = std::make_shared<CButton>(Point(539, 398), "IOKAY.DEF", CGI->generaltexth->zelp[445], std::bind(&CQuestLog::close, this), SDLK_RETURN); | ||||
| 	// Both button and lable are shifted to -2px by x and y to not make them actually look like they're on same line with quests list and ok button | ||||
| 	hideCompleteButton = std::make_shared<CToggleButton>(Point(10, 396), "sysopchk.def", CButton::tooltip(texts["hideComplete"]), std::bind(&CQuestLog::toggleComplete, this, _1)); | ||||
| 	hideCompleteLabel = std::make_shared<CLabel>(46, 398, FONT_MEDIUM, TOPLEFT, Colors::WHITE, texts["hideComplete"]["label"].String()); | ||||
| 	hideCompleteLabel = std::make_shared<CLabel>(46, 398, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, texts["hideComplete"]["label"].String()); | ||||
| 	slider = std::make_shared<CSlider>(Point(166, 195), 191, std::bind(&CQuestLog::sliderMoved, this, _1), QUEST_COUNT, 0, false, CSlider::BROWN); | ||||
|  | ||||
| 	recreateLabelList(); | ||||
| @@ -175,7 +175,7 @@ void CQuestLog::recreateLabelList() | ||||
| 			else | ||||
| 				text.addReplacement(quests[i].obj->getObjectName()); //get name of the object | ||||
| 		} | ||||
| 		auto label = std::make_shared<CQuestLabel>(Rect(13, 195, 149,31), FONT_SMALL, TOPLEFT, Colors::WHITE, text.toString()); | ||||
| 		auto label = std::make_shared<CQuestLabel>(Rect(13, 195, 149,31), FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, text.toString()); | ||||
| 		label->disable(); | ||||
|  | ||||
| 		label->callback = std::bind(&CQuestLog::selectQuest, this, i, currentLabel); | ||||
|   | ||||
| @@ -43,8 +43,8 @@ class CQuestLabel : public LRClickableAreaWText, public CMultiLineLabel | ||||
| public: | ||||
| 	std::function<void()> callback; | ||||
|  | ||||
| 	CQuestLabel(Rect position, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE, const std::string &Text =  "") | ||||
| 		: CMultiLineLabel (position, FONT_SMALL, TOPLEFT, Colors::WHITE, Text){}; | ||||
| 	CQuestLabel(Rect position, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const SDL_Color &Color = Colors::WHITE, const std::string &Text =  "") | ||||
| 		: CMultiLineLabel (position, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, Text){}; | ||||
| 	void clickLeft(tribool down, bool previousState) override; | ||||
| 	void showAll(SDL_Surface * to) override; | ||||
| }; | ||||
|   | ||||
| @@ -183,7 +183,7 @@ CSpellWindow::CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _m | ||||
|  | ||||
| 	for(auto item : schoolBorders) | ||||
| 		item->preload(); | ||||
| 	mana = std::make_shared<CLabel>(435, 426, FONT_SMALL, CENTER, Colors::YELLOW, boost::lexical_cast<std::string>(myHero->mana)); | ||||
| 	mana = std::make_shared<CLabel>(435, 426, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, boost::lexical_cast<std::string>(myHero->mana)); | ||||
| 	statusBar = CGStatusBar::create(7, 569, "Spelroll.bmp"); | ||||
|  | ||||
| 	SDL_Rect temp_rect = genRect(45, 35, 479 + pos.x, 405 + pos.y); | ||||
| @@ -508,9 +508,9 @@ CSpellWindow::SpellArea::SpellArea(SDL_Rect pos, CSpellWindow * owner) | ||||
| 	image = std::make_shared<CAnimImage>(owner->spellIcons, 0, 0); | ||||
| 	image->visible = false; | ||||
|  | ||||
| 	name = std::make_shared<CLabel>(39, 70, FONT_TINY, CENTER); | ||||
| 	level = std::make_shared<CLabel>(39, 82, FONT_TINY, CENTER); | ||||
| 	cost = std::make_shared<CLabel>(39, 94, FONT_TINY, CENTER); | ||||
| 	name = std::make_shared<CLabel>(39, 70, FONT_TINY, ETextAlignment::CENTER); | ||||
| 	level = std::make_shared<CLabel>(39, 82, FONT_TINY, ETextAlignment::CENTER); | ||||
| 	cost = std::make_shared<CLabel>(39, 94, FONT_TINY, ETextAlignment::CENTER); | ||||
|  | ||||
| 	for(auto l : {name, level, cost}) | ||||
| 		l->autoRedraw = false; | ||||
|   | ||||
| @@ -703,7 +703,7 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket * Market, const CGHeroInsta | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	titleLabel = std::make_shared<CLabel>(300, 27, FONT_BIG, CENTER, Colors::YELLOW, title); | ||||
| 	titleLabel = std::make_shared<CLabel>(300, 27, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, title); | ||||
|  | ||||
| 	initItems(false); | ||||
| 	initItems(true); | ||||
| @@ -730,15 +730,15 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket * Market, const CGHeroInsta | ||||
| 	case EMarketMode::RESOURCE_RESOURCE: | ||||
| 	case EMarketMode::RESOURCE_PLAYER: | ||||
| 	case EMarketMode::RESOURCE_ARTIFACT: | ||||
| 		labels.push_back(std::make_shared<CLabel>(154, 148, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[270])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(154, 148, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[270])); | ||||
| 		break; | ||||
| 	case EMarketMode::CREATURE_RESOURCE: | ||||
| 		//%s's Creatures | ||||
| 		labels.push_back(std::make_shared<CLabel>(152, 102, FONT_SMALL, CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name))); | ||||
| 		labels.push_back(std::make_shared<CLabel>(152, 102, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name))); | ||||
| 		break; | ||||
| 	case EMarketMode::ARTIFACT_RESOURCE: | ||||
| 		//%s's Artifacts | ||||
| 		labels.push_back(std::make_shared<CLabel>(152, 56, FONT_SMALL, CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->allTexts[271]) % hero->name))); | ||||
| 		labels.push_back(std::make_shared<CLabel>(152, 56, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->allTexts[271]) % hero->name))); | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
| @@ -751,16 +751,16 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket * Market, const CGHeroInsta | ||||
| 	case EMarketMode::CREATURE_RESOURCE: | ||||
| 	case EMarketMode::RESOURCE_ARTIFACT: | ||||
| 	case EMarketMode::ARTIFACT_RESOURCE: | ||||
| 		labels.push_back(std::make_shared<CLabel>(445, 148, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[168])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(445, 148, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[168])); | ||||
| 		traderTextRect = Rect(316, 48, 260, 75); | ||||
| 		break; | ||||
| 	case EMarketMode::RESOURCE_PLAYER: | ||||
| 		labels.push_back(std::make_shared<CLabel>(445, 55, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[169])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(445, 55, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[169])); | ||||
| 		traderTextRect = Rect(28, 48, 260, 75); | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
| 	traderText = std::make_shared<CTextBox>("", traderTextRect, 0, FONT_SMALL, CENTER); | ||||
| 	traderText = std::make_shared<CTextBox>("", traderTextRect, 0, FONT_SMALL, ETextAlignment::CENTER); | ||||
| 	int specialOffset = mode == EMarketMode::ARTIFACT_RESOURCE ? 35 : 0; //in selling artifacts mode we need to move res-res and art-res buttons down | ||||
|  | ||||
| 	if(printButtonFor(EMarketMode::RESOURCE_PLAYER)) | ||||
| @@ -1094,14 +1094,14 @@ CAltarWindow::CAltarWindow(const IMarket * Market, const CGHeroInstance * Hero, | ||||
| 	if(Mode == EMarketMode::CREATURE_EXP) | ||||
| 	{ | ||||
| 		//%s's Creatures | ||||
| 		labels.push_back(std::make_shared<CLabel>(155, 30, FONT_SMALL, CENTER, Colors::YELLOW, | ||||
| 		labels.push_back(std::make_shared<CLabel>(155, 30, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, | ||||
| 				   boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name))); | ||||
|  | ||||
| 		//Altar of Sacrifice | ||||
| 		labels.push_back(std::make_shared<CLabel>(450, 30, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[479])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(450, 30, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[479])); | ||||
|  | ||||
| 		 //To sacrifice creatures, move them from your army on to the Altar and click Sacrifice | ||||
| 		new CTextBox(CGI->generaltexth->allTexts[480], Rect(320, 56, 256, 40), 0, FONT_SMALL, CENTER, Colors::YELLOW); | ||||
| 		new CTextBox(CGI->generaltexth->allTexts[480], Rect(320, 56, 256, 40), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW); | ||||
|  | ||||
| 		slider = std::make_shared<CSlider>(Point(231,481),137,std::bind(&CAltarWindow::sliderMoved,this,_1),0,0); | ||||
| 		max = std::make_shared<CButton>(Point(147, 520), "IRCBTNS.DEF", CGI->generaltexth->zelp[578], std::bind(&CSlider::moveToMax, slider)); | ||||
| @@ -1115,9 +1115,9 @@ CAltarWindow::CAltarWindow(const IMarket * Market, const CGHeroInstance * Hero, | ||||
| 	else | ||||
| 	{ | ||||
| 		//Sacrifice artifacts for experience | ||||
| 		labels.push_back(std::make_shared<CLabel>(450, 34, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[477])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(450, 34, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[477])); | ||||
| 		//%s's Creatures | ||||
| 		labels.push_back(std::make_shared<CLabel>(302, 423, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[478])); | ||||
| 		labels.push_back(std::make_shared<CLabel>(302, 423, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[478])); | ||||
|  | ||||
| 		sacrificeAll = std::make_shared<CButton>(Point(393, 520), "ALTFILL.DEF", CGI->generaltexth->zelp[571], std::bind(&CAltarWindow::SacrificeAll,this)); | ||||
| 		sacrificeAll->block(hero->artifactsInBackpack.empty() && hero->artifactsWorn.empty()); | ||||
| @@ -1131,9 +1131,9 @@ CAltarWindow::CAltarWindow(const IMarket * Market, const CGHeroInstance * Hero, | ||||
| 	} | ||||
|  | ||||
| 	//Experience needed to reach next level | ||||
| 	texts.push_back(std::make_shared<CTextBox>(CGI->generaltexth->allTexts[475], Rect(15, 415, 125, 50), 0, FONT_SMALL, CENTER, Colors::YELLOW)); | ||||
| 	texts.push_back(std::make_shared<CTextBox>(CGI->generaltexth->allTexts[475], Rect(15, 415, 125, 50), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW)); | ||||
| 	//Total experience on the Altar | ||||
| 	texts.push_back(std::make_shared<CTextBox>(CGI->generaltexth->allTexts[476], Rect(15, 495, 125, 40), 0, FONT_SMALL, CENTER, Colors::YELLOW)); | ||||
| 	texts.push_back(std::make_shared<CTextBox>(CGI->generaltexth->allTexts[476], Rect(15, 495, 125, 40), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW)); | ||||
|  | ||||
| 	statusBar = CGStatusBar::create(std::make_shared<CPicture>(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26)); | ||||
|  | ||||
| @@ -1160,8 +1160,8 @@ CAltarWindow::CAltarWindow(const IMarket * Market, const CGHeroInstance * Hero, | ||||
| 	expPerUnit.resize(GameConstants::ARMY_SIZE, 0); | ||||
| 	getExpValues(); | ||||
|  | ||||
| 	expToLevel = std::make_shared<CLabel>(73, 475, FONT_SMALL, CENTER); | ||||
| 	expOnAltar = std::make_shared<CLabel>(73, 543, FONT_SMALL, CENTER); | ||||
| 	expToLevel = std::make_shared<CLabel>(73, 475, FONT_SMALL, ETextAlignment::CENTER); | ||||
| 	expOnAltar = std::make_shared<CLabel>(73, 543, FONT_SMALL, ETextAlignment::CENTER); | ||||
|  | ||||
| 	setExpToLevel(); | ||||
| 	calcTotalExp(); | ||||
|   | ||||
| @@ -55,8 +55,8 @@ void CreaturePurchaseCard::switchCreatureLevel() | ||||
|  | ||||
| void CreaturePurchaseCard::initAmountInfo() | ||||
| { | ||||
| 	availableAmount = std::make_shared<CLabel>(pos.x + 25, pos.y + 146, FONT_SMALL, CENTER, Colors::YELLOW); | ||||
| 	purchaseAmount = std::make_shared<CLabel>(pos.x + 76, pos.y + 146, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 	availableAmount = std::make_shared<CLabel>(pos.x + 25, pos.y + 146, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW); | ||||
| 	purchaseAmount = std::make_shared<CLabel>(pos.x + 76, pos.y + 146, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	updateAmountInfo(0); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -212,15 +212,15 @@ CRecruitmentWindow::CRecruitmentWindow(const CGDwelling * Dwelling, int Level, c | ||||
| 	buyButton = std::make_shared<CButton>(Point(212, 313), "IBY6432.DEF", CGI->generaltexth->zelp[554], std::bind(&CRecruitmentWindow::buy, this), SDLK_RETURN); | ||||
| 	cancelButton = std::make_shared<CButton>(Point(290, 313), "ICN6432.DEF", CGI->generaltexth->zelp[555], std::bind(&CRecruitmentWindow::close, this), SDLK_ESCAPE); | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(243, 32, FONT_BIG, CENTER, Colors::YELLOW); | ||||
| 	availableValue = std::make_shared<CLabel>(205, 253, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 	toRecruitValue = std::make_shared<CLabel>(279, 253, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 	title = std::make_shared<CLabel>(243, 32, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW); | ||||
| 	availableValue = std::make_shared<CLabel>(205, 253, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	toRecruitValue = std::make_shared<CLabel>(279, 253, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
|  | ||||
| 	costPerTroopValue = std::make_shared<CreatureCostBox>(Rect(65, 222, 97, 74), CGI->generaltexth->allTexts[346]); | ||||
| 	totalCostValue = std::make_shared<CreatureCostBox>(Rect(323, 222, 97, 74), CGI->generaltexth->allTexts[466]); | ||||
|  | ||||
| 	availableTitle = std::make_shared<CLabel>(205, 233, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[465]); | ||||
| 	toRecruitTitle = std::make_shared<CLabel>(279, 233, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[16]); | ||||
| 	availableTitle = std::make_shared<CLabel>(205, 233, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[465]); | ||||
| 	toRecruitTitle = std::make_shared<CLabel>(279, 233, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[16]); | ||||
|  | ||||
| 	availableCreaturesChanged(); | ||||
| } | ||||
| @@ -333,7 +333,7 @@ CSplitWindow::CSplitWindow(const CCreature * creature, std::function<void(int, i | ||||
|  | ||||
| 	std::string titleStr = CGI->generaltexth->allTexts[256]; | ||||
| 	boost::algorithm::replace_first(titleStr,"%s", creature->namePl); | ||||
| 	title = std::make_shared<CLabel>(150, 34, FONT_BIG, CENTER, Colors::YELLOW, titleStr); | ||||
| 	title = std::make_shared<CLabel>(150, 34, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, titleStr); | ||||
| } | ||||
|  | ||||
| void CSplitWindow::setAmountText(std::string text, bool left) | ||||
| @@ -404,15 +404,15 @@ CLevelWindow::CLevelWindow(const CGHeroInstance * hero, PrimarySkill::PrimarySki | ||||
| 	ok = std::make_shared<CButton>(Point(297, 413), "IOKAY", CButton::tooltip(), std::bind(&CLevelWindow::close, this), SDLK_RETURN); | ||||
|  | ||||
| 	//%s has gained a level. | ||||
| 	mainTitle = std::make_shared<CLabel>(192, 33, FONT_MEDIUM, CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->allTexts[444]) % hero->name)); | ||||
| 	mainTitle = std::make_shared<CLabel>(192, 33, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->allTexts[444]) % hero->name)); | ||||
|  | ||||
| 	//%s is now a level %d %s. | ||||
| 	levelTitle = std::make_shared<CLabel>(192, 162, FONT_MEDIUM, CENTER, Colors::WHITE, | ||||
| 	levelTitle = std::make_shared<CLabel>(192, 162, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, | ||||
| 		boost::str(boost::format(CGI->generaltexth->allTexts[445]) % hero->name % hero->level % hero->type->heroClass->name)); | ||||
|  | ||||
| 	skillIcon = std::make_shared<CAnimImage>("PSKIL42", pskill, 0, 174, 190); | ||||
|  | ||||
| 	skillValue = std::make_shared<CLabel>(192, 253, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->primarySkillNames[pskill] + " +1"); | ||||
| 	skillValue = std::make_shared<CLabel>(192, 253, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->primarySkillNames[pskill] + " +1"); | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -447,12 +447,12 @@ CSystemOptionsWindow::CSystemOptionsWindow() | ||||
| 	onFullscreenChanged(settings.listen["video"]["fullscreen"]) | ||||
| { | ||||
| 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); | ||||
| 	title = std::make_shared<CLabel>(242, 32, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[568]); | ||||
| 	title = std::make_shared<CLabel>(242, 32, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[568]); | ||||
|  | ||||
| 	const JsonNode & texts = CGI->generaltexth->localizedTexts["systemOptions"]; | ||||
|  | ||||
| 	//left window section | ||||
| 	leftGroup = std::make_shared<CLabelGroup>(FONT_MEDIUM, CENTER, Colors::YELLOW); | ||||
| 	leftGroup = std::make_shared<CLabelGroup>(FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW); | ||||
| 	leftGroup->add(122,  64, CGI->generaltexth->allTexts[569]); | ||||
| 	leftGroup->add(122, 130, CGI->generaltexth->allTexts[570]); | ||||
| 	leftGroup->add(122, 196, CGI->generaltexth->allTexts[571]); | ||||
| @@ -461,7 +461,7 @@ CSystemOptionsWindow::CSystemOptionsWindow() | ||||
| 	leftGroup->add(122, 412, CGI->generaltexth->allTexts[395]); | ||||
|  | ||||
| 	//right section | ||||
| 	rightGroup = std::make_shared<CLabelGroup>(FONT_MEDIUM, TOPLEFT, Colors::WHITE); | ||||
| 	rightGroup = std::make_shared<CLabelGroup>(FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE); | ||||
| 	rightGroup->add(282, 57,  CGI->generaltexth->allTexts[572]); | ||||
| 	rightGroup->add(282, 89,  CGI->generaltexth->allTexts[573]); | ||||
| 	rightGroup->add(282, 121, CGI->generaltexth->allTexts[574]); | ||||
| @@ -555,7 +555,7 @@ CSystemOptionsWindow::CSystemOptionsWindow() | ||||
| 	gameResButton = std::make_shared<CButton>(Point(28, 275),"buttons/resolution", CButton::tooltip(texts["resolutionButton"]), std::bind(&CSystemOptionsWindow::selectGameRes, this), SDLK_g); | ||||
|  | ||||
| 	const auto & screenRes = settings["video"]["screenRes"]; | ||||
| 	gameResLabel = std::make_shared<CLabel>(170, 292, FONT_MEDIUM, CENTER, Colors::YELLOW, resolutionToString(screenRes["width"].Integer(), screenRes["height"].Integer())); | ||||
| 	gameResLabel = std::make_shared<CLabel>(170, 292, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, resolutionToString(screenRes["width"].Integer(), screenRes["height"].Integer())); | ||||
| } | ||||
|  | ||||
| void CSystemOptionsWindow::selectGameRes() | ||||
| @@ -666,11 +666,11 @@ CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj) | ||||
| 	h1 = std::make_shared<HeroPortrait>(selected, 0, 72, 299, h[0]); | ||||
| 	h2 = std::make_shared<HeroPortrait>(selected, 1, 162, 299, h[1]); | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(200, 35, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[37]); | ||||
| 	cost = std::make_shared<CLabel>(320, 328, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(GameConstants::HERO_GOLD_COST)); | ||||
| 	title = std::make_shared<CLabel>(200, 35, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[37]); | ||||
| 	cost = std::make_shared<CLabel>(320, 328, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(GameConstants::HERO_GOLD_COST)); | ||||
|  | ||||
| 	auto rumorText = boost::str(boost::format(CGI->generaltexth->allTexts[216]) % LOCPLINT->cb->getTavernRumor(tavernObj)); | ||||
| 	rumor = std::make_shared<CTextBox>(rumorText, Rect(32, 190, 330, 68), 0, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 	rumor = std::make_shared<CTextBox>(rumorText, Rect(32, 190, 330, 68), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
|  | ||||
| 	statusbar = CGStatusBar::create(std::make_shared<CPicture>(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26)); | ||||
| 	cancel = std::make_shared<CButton>(Point(310, 428), "ICANCEL.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[7]), std::bind(&CTavernWindow::close, this), SDLK_ESCAPE); | ||||
| @@ -1082,8 +1082,8 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2, | ||||
| 		return boost::str(fmt); | ||||
| 	}; | ||||
|  | ||||
| 	titles[0] = std::make_shared<CLabel>(147, 25, FONT_SMALL, CENTER, Colors::WHITE, genTitle(heroInst[0])); | ||||
| 	titles[1] = std::make_shared<CLabel>(653, 25, FONT_SMALL, CENTER, Colors::WHITE, genTitle(heroInst[1])); | ||||
| 	titles[0] = std::make_shared<CLabel>(147, 25, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, genTitle(heroInst[0])); | ||||
| 	titles[1] = std::make_shared<CLabel>(653, 25, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, genTitle(heroInst[1])); | ||||
|  | ||||
| 	auto PSKIL32 = std::make_shared<CAnimation>("PSKIL32"); | ||||
| 	PSKIL32->preload(); | ||||
| @@ -1105,7 +1105,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2, | ||||
| 		herosWArt[leftRight] = std::make_shared<CHeroWithMaybePickedArtifact>(this, hero); | ||||
|  | ||||
| 		for(int m=0; m<GameConstants::PRIMARY_SKILLS; ++m) | ||||
| 			primSkillValues[leftRight].push_back(std::make_shared<CLabel>(352 + (qeLayout ? 96 : 93) * leftRight, (qeLayout ? 22 : 35) + (qeLayout ? 26 : 36) * m, FONT_SMALL, CENTER, Colors::WHITE)); | ||||
| 			primSkillValues[leftRight].push_back(std::make_shared<CLabel>(352 + (qeLayout ? 96 : 93) * leftRight, (qeLayout ? 22 : 35) + (qeLayout ? 26 : 36) * m, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE)); | ||||
|  | ||||
|  | ||||
| 		for(int m=0; m < hero->secSkills.size(); ++m) | ||||
| @@ -1114,10 +1114,10 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2, | ||||
| 		specImages[leftRight] = std::make_shared<CAnimImage>("UN32", hero->type->imageIndex, 0, 67 + 490 * leftRight, qeLayout ? 41 : 45); | ||||
|  | ||||
| 		expImages[leftRight] = std::make_shared<CAnimImage>(PSKIL32, 4, 0, 103 + 490 * leftRight, qeLayout ? 41 : 45); | ||||
| 		expValues[leftRight] = std::make_shared<CLabel>(119 + 490 * leftRight, qeLayout ? 66 : 71, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 		expValues[leftRight] = std::make_shared<CLabel>(119 + 490 * leftRight, qeLayout ? 66 : 71, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
|  | ||||
| 		manaImages[leftRight] = std::make_shared<CAnimImage>(PSKIL32, 5, 0, 139 + 490 * leftRight, qeLayout ? 41 : 45); | ||||
| 		manaValues[leftRight] = std::make_shared<CLabel>(155 + 490 * leftRight, qeLayout ? 66 : 71, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 		manaValues[leftRight] = std::make_shared<CLabel>(155 + 490 * leftRight, qeLayout ? 66 : 71, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	} | ||||
|  | ||||
| 	portraits[0] = std::make_shared<CAnimImage>("PortraitsLarge", heroInst[0]->portrait, 0, 257, 13); | ||||
| @@ -1316,8 +1316,8 @@ CShipyardWindow::CShipyardWindow(const std::vector<si32> & cost, int state, int | ||||
| 	std::string goldValue = boost::lexical_cast<std::string>(cost[Res::GOLD]); | ||||
| 	std::string woodValue = boost::lexical_cast<std::string>(cost[Res::WOOD]); | ||||
|  | ||||
| 	goldCost = std::make_shared<CLabel>(118, 294, FONT_SMALL, CENTER, Colors::WHITE, goldValue); | ||||
| 	woodCost = std::make_shared<CLabel>(212, 294, FONT_SMALL, CENTER, Colors::WHITE, woodValue); | ||||
| 	goldCost = std::make_shared<CLabel>(118, 294, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, goldValue); | ||||
| 	woodCost = std::make_shared<CLabel>(212, 294, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, woodValue); | ||||
|  | ||||
| 	goldPic = std::make_shared<CAnimImage>("RESOURCE", Res::GOLD, 0, 100, 244); | ||||
| 	woodPic = std::make_shared<CAnimImage>("RESOURCE", Res::WOOD, 0, 196, 244); | ||||
| @@ -1337,8 +1337,8 @@ CShipyardWindow::CShipyardWindow(const std::vector<si32> & cost, int state, int | ||||
|  | ||||
| 	statusbar = CGStatusBar::create(std::make_shared<CPicture>(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26)); | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(164, 27,  FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[13]); | ||||
| 	costLabel = std::make_shared<CLabel>(164, 220, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->jktexts[14]); | ||||
| 	title = std::make_shared<CLabel>(164, 27,  FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[13]); | ||||
| 	costLabel = std::make_shared<CLabel>(164, 220, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->jktexts[14]); | ||||
| } | ||||
|  | ||||
| CPuzzleWindow::CPuzzleWindow(const int3 & GrailPos, double discoveredRatio) | ||||
| @@ -1355,7 +1355,7 @@ CPuzzleWindow::CPuzzleWindow(const int3 & GrailPos, double discoveredRatio) | ||||
| 	quitb->setBorderColor(Colors::METALLIC_GOLD); | ||||
|  | ||||
| 	logo = std::make_shared<CPicture>("PUZZLOGO", 607, 3); | ||||
| 	title = std::make_shared<CLabel>(700, 95, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[463]); | ||||
| 	title = std::make_shared<CLabel>(700, 95, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[463]); | ||||
| 	resDataBar = std::make_shared<CResDataBar>("ARESBAR.bmp", 3, 575, 32, 2, 85, 85); | ||||
|  | ||||
| 	int faction = LOCPLINT->cb->getStartInfo()->playerInfos.find(LOCPLINT->playerID)->second.castle; | ||||
| @@ -1452,7 +1452,7 @@ CTransformerWindow::CItem::CItem(CTransformerWindow * parent_, int size_, int id | ||||
| 	pos.x += 45  + (id%3)*83 + id/6*83; | ||||
| 	pos.y += 109 + (id/3)*98; | ||||
| 	icon = std::make_shared<CAnimImage>("TWCRPORT", parent->army->getCreature(SlotID(id))->idNumber + 2); | ||||
| 	count = std::make_shared<CLabel>(28, 76,FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(size)); | ||||
| 	count = std::make_shared<CLabel>(28, 76,FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(size)); | ||||
| } | ||||
|  | ||||
| void CTransformerWindow::makeDeal() | ||||
| @@ -1502,10 +1502,10 @@ CTransformerWindow::CTransformerWindow(const CGHeroInstance * _hero, const CGTow | ||||
| 	cancel = std::make_shared<CButton>(Point(392, 416), "ICANCEL.DEF", CGI->generaltexth->zelp[592], [&](){ close(); },SDLK_ESCAPE); | ||||
| 	statusbar = CGStatusBar::create(std::make_shared<CPicture>(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26)); | ||||
|  | ||||
| 	titleLeft = std::make_shared<CLabel>(153, 29,FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[485]);//holding area | ||||
| 	titleRight = std::make_shared<CLabel>(153+295, 29, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[486]);//transformer | ||||
| 	helpLeft = std::make_shared<CTextBox>(CGI->generaltexth->allTexts[487], Rect(26,  56, 255, 40), 0, FONT_MEDIUM, CENTER, Colors::YELLOW);//move creatures to create skeletons | ||||
| 	helpRight = std::make_shared<CTextBox>(CGI->generaltexth->allTexts[488], Rect(320, 56, 255, 40), 0, FONT_MEDIUM, CENTER, Colors::YELLOW);//creatures here will become skeletons | ||||
| 	titleLeft = std::make_shared<CLabel>(153, 29,FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[485]);//holding area | ||||
| 	titleRight = std::make_shared<CLabel>(153+295, 29, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[486]);//transformer | ||||
| 	helpLeft = std::make_shared<CTextBox>(CGI->generaltexth->allTexts[487], Rect(26,  56, 255, 40), 0, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW);//move creatures to create skeletons | ||||
| 	helpRight = std::make_shared<CTextBox>(CGI->generaltexth->allTexts[488], Rect(320, 56, 255, 40), 0, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW);//creatures here will become skeletons | ||||
| } | ||||
|  | ||||
| CUniversityWindow::CItem::CItem(CUniversityWindow * _parent, int _ID, int X, int Y) | ||||
| @@ -1522,8 +1522,8 @@ CUniversityWindow::CItem::CItem(CUniversityWindow * _parent, int _ID, int X, int | ||||
|  | ||||
| 	icon = std::make_shared<CAnimImage>("SECSKILL", _ID * 3 + 3, 0); | ||||
|  | ||||
| 	name = std::make_shared<CLabel>(22, -13, FONT_SMALL, CENTER, Colors::WHITE, CGI->skillh->skillName(ID)); | ||||
| 	level = std::make_shared<CLabel>(22, 57, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->levels[0]); | ||||
| 	name = std::make_shared<CLabel>(22, -13, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->skillh->skillName(ID)); | ||||
| 	level = std::make_shared<CLabel>(22, 57, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->levels[0]); | ||||
|  | ||||
| 	pos.h = icon->pos.h; | ||||
| 	pos.w = icon->pos.w; | ||||
| @@ -1604,8 +1604,8 @@ CUniversityWindow::CUniversityWindow(const CGHeroInstance * _hero, const IMarket | ||||
|  | ||||
| 	titlePic->center(Point(232 + pos.x, 76 + pos.y)); | ||||
|  | ||||
| 	clerkSpeech = std::make_shared<CTextBox>(CGI->generaltexth->allTexts[603], Rect(24, 129, 413, 70), 0, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 	title = std::make_shared<CLabel>(231, 26, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[602]); | ||||
| 	clerkSpeech = std::make_shared<CTextBox>(CGI->generaltexth->allTexts[603], Rect(24, 129, 413, 70), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	title = std::make_shared<CLabel>(231, 26, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[602]); | ||||
|  | ||||
| 	std::vector<int> goods = market->availableItemsIds(EMarketMode::RESOURCE_SKILL); | ||||
| 	assert(goods.size() == 4); | ||||
| @@ -1634,14 +1634,14 @@ CUnivConfirmWindow::CUnivConfirmWindow(CUniversityWindow * owner_, int SKILL, bo | ||||
| 	boost::replace_first(text, "%s", CGI->skillh->skillName(SKILL)); | ||||
| 	boost::replace_first(text, "%d", "2000"); | ||||
|  | ||||
| 	clerkSpeech = std::make_shared<CTextBox>(text, Rect(24, 129, 413, 70), 0, FONT_SMALL, CENTER, Colors::WHITE); | ||||
| 	clerkSpeech = std::make_shared<CTextBox>(text, Rect(24, 129, 413, 70), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); | ||||
|  | ||||
| 	name = std::make_shared<CLabel>(230, 37,  FONT_SMALL, CENTER, Colors::WHITE, CGI->skillh->skillName(SKILL)); | ||||
| 	name = std::make_shared<CLabel>(230, 37,  FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->skillh->skillName(SKILL)); | ||||
| 	icon = std::make_shared<CAnimImage>("SECSKILL", SKILL*3+3, 0, 211, 51); | ||||
| 	level = std::make_shared<CLabel>(230, 107, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->levels[1]); | ||||
| 	level = std::make_shared<CLabel>(230, 107, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->levels[1]); | ||||
|  | ||||
| 	costIcon = std::make_shared<CAnimImage>("RESOURCE", Res::GOLD, 0, 210, 210); | ||||
| 	cost = std::make_shared<CLabel>(230, 267, FONT_SMALL, CENTER, Colors::WHITE, "2000"); | ||||
| 	cost = std::make_shared<CLabel>(230, 267, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, "2000"); | ||||
|  | ||||
| 	std::string hoverText = CGI->generaltexth->allTexts[609]; | ||||
| 	boost::replace_first(hoverText, "%s", CGI->generaltexth->levels[0]+ " " + CGI->skillh->skillName(SKILL)); | ||||
| @@ -1694,7 +1694,7 @@ CGarrisonWindow::CGarrisonWindow(const CArmedInstance * up, const CGHeroInstance | ||||
| 			logGlobal->error("Invalid armed instance for garrison window."); | ||||
| 		} | ||||
| 	} | ||||
| 	title = std::make_shared<CLabel>(275, 30, FONT_BIG, CENTER, Colors::YELLOW, titleText); | ||||
| 	title = std::make_shared<CLabel>(275, 30, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, titleText); | ||||
|  | ||||
| 	banner = std::make_shared<CAnimImage>("CREST58", up->getOwner().getNum(), 0, 28, 124); | ||||
| 	portrait = std::make_shared<CAnimImage>("PortraitsLarge", down->portrait, 0, 29, 222); | ||||
| @@ -1712,14 +1712,14 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance * visitor, const CGObjectI | ||||
| { | ||||
| 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(325, 32, FONT_BIG, CENTER, Colors::YELLOW, fort->getObjectName()); | ||||
| 	title = std::make_shared<CLabel>(325, 32, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, fort->getObjectName()); | ||||
|  | ||||
| 	heroPic = std::make_shared<CHeroArea>(30, 60, hero); | ||||
|  | ||||
| 	for(int i=0; i < resCount; i++) | ||||
| 	{ | ||||
| 		totalIcons[i] = std::make_shared<CAnimImage>("SMALRES", i, 0, 104 + 76 * i, 237); | ||||
| 		totalLabels[i] = std::make_shared<CLabel>(166 + 76 * i, 253, FONT_SMALL, BOTTOMRIGHT); | ||||
| 		totalLabels[i] = std::make_shared<CLabel>(166 + 76 * i, 253, FONT_SMALL, ETextAlignment::BOTTOMRIGHT); | ||||
| 	} | ||||
|  | ||||
| 	for(int i = 0; i < slotsCount; i++) | ||||
| @@ -1731,7 +1731,7 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance * visitor, const CGObjectI | ||||
| 		for(int j : {0,1}) | ||||
| 		{ | ||||
| 			slotIcons[i][j] = std::make_shared<CAnimImage>("SMALRES", 0, 0, 104 + 76 * i, 128 + 20 * j); | ||||
| 			slotLabels[i][j] = std::make_shared<CLabel>(168 + 76 * i, 144 + 20 * j, FONT_SMALL, BOTTOMRIGHT); | ||||
| 			slotLabels[i][j] = std::make_shared<CLabel>(168 + 76 * i, 144 + 20 * j, FONT_SMALL, ETextAlignment::BOTTOMRIGHT); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -1944,7 +1944,7 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner): | ||||
|  | ||||
| 		std::string text = CGI->generaltexth->jktexts[24+g]; | ||||
| 		boost::algorithm::trim_if(text,boost::algorithm::is_any_of("\"")); | ||||
| 		rowHeaders.push_back(std::make_shared<CLabel>(135, y, FONT_MEDIUM, CENTER, Colors::YELLOW, text)); | ||||
| 		rowHeaders.push_back(std::make_shared<CLabel>(135, y, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, text)); | ||||
| 	} | ||||
|  | ||||
| 	auto PRSTRIPS = std::make_shared<CAnimation>("PRSTRIPS"); | ||||
| @@ -1954,7 +1954,7 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner): | ||||
| 		columnBackgrounds.push_back(std::make_shared<CAnimImage>(PRSTRIPS, g-1, 0, 250 + 66*g, 7)); | ||||
|  | ||||
| 	for(int g=0; g<tgi.playerColors.size(); ++g) | ||||
| 		columnHeaders.push_back(std::make_shared<CLabel>(283 + 66*g, 24, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[16+g])); | ||||
| 		columnHeaders.push_back(std::make_shared<CLabel>(283 + 66*g, 24, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[16+g])); | ||||
|  | ||||
| 	auto itgflags = std::make_shared<CAnimation>("itgflags"); | ||||
| 	itgflags->preload(); | ||||
| @@ -2003,11 +2003,11 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner): | ||||
| 			if(iter.second.details) | ||||
| 			{ | ||||
| 				primSkillHeaders.push_back(std::make_shared<CTextBox>(CGI->generaltexth->allTexts[184], Rect(260 + 66*counter, 396, 52, 64), | ||||
| 					0, FONT_TINY, TOPLEFT, Colors::WHITE)); | ||||
| 					0, FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE)); | ||||
|  | ||||
| 				for(int i=0; i<iter.second.details->primskills.size(); ++i) | ||||
| 				{ | ||||
| 					primSkillValues.push_back(std::make_shared<CLabel>(310 + 66 * counter, 407 + 11*i, FONT_TINY, BOTTOMRIGHT, Colors::WHITE, | ||||
| 					primSkillValues.push_back(std::make_shared<CLabel>(310 + 66 * counter, 407 + 11*i, FONT_TINY, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, | ||||
| 							   boost::lexical_cast<std::string>(iter.second.details->primskills[i]))); | ||||
| 				} | ||||
| 			} | ||||
| @@ -2038,7 +2038,7 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner): | ||||
| 			text = CGI->generaltexth->arraytxt[168 + it.second]; | ||||
| 		} | ||||
|  | ||||
| 		personalities.push_back(std::make_shared<CLabel>(283 + 66*counter, 459, FONT_SMALL, CENTER, Colors::WHITE, text)); | ||||
| 		personalities.push_back(std::make_shared<CLabel>(283 + 66*counter, 459, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, text)); | ||||
|  | ||||
| 		counter++; | ||||
| 	} | ||||
| @@ -2055,7 +2055,7 @@ CObjectListWindow::CItem::CItem(CObjectListWindow * _parent, size_t _id, std::st | ||||
|  | ||||
| 	type |= REDRAW_PARENT; | ||||
|  | ||||
| 	text = std::make_shared<CLabel>(pos.w/2, pos.h/2, FONT_SMALL, CENTER, Colors::WHITE, _text); | ||||
| 	text = std::make_shared<CLabel>(pos.w/2, pos.h/2, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, _text); | ||||
| 	select(index == parent->selected); | ||||
| } | ||||
|  | ||||
| @@ -2108,8 +2108,8 @@ void CObjectListWindow::init(std::shared_ptr<CIntObject> titleWidget_, std::stri | ||||
| { | ||||
| 	titleWidget = titleWidget_; | ||||
|  | ||||
| 	title = std::make_shared<CLabel>(152, 27, FONT_BIG, CENTER, Colors::YELLOW, _title); | ||||
| 	descr = std::make_shared<CLabel>(145, 133, FONT_SMALL, CENTER, Colors::WHITE, _descr); | ||||
| 	title = std::make_shared<CLabel>(152, 27, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, _title); | ||||
| 	descr = std::make_shared<CLabel>(145, 133, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, _descr); | ||||
| 	exit = std::make_shared<CButton>( Point(228, 402), "ICANCEL.DEF", CButton::tooltip(), std::bind(&CObjectListWindow::exitPressed, this), SDLK_ESCAPE); | ||||
|  | ||||
| 	if(titleWidget) | ||||
|   | ||||
| @@ -77,7 +77,7 @@ CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperl | ||||
| 		buttons[i]->addCallback(std::bind(&CInfoWindow::close, this)); //each button will close the window apart from call-defined actions | ||||
| 	} | ||||
|  | ||||
| 	text = std::make_shared<CTextBox>(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::WHITE); | ||||
| 	text = std::make_shared<CTextBox>(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE); | ||||
|  | ||||
| 	buttons.front()->assignedKeys.insert(SDLK_RETURN); //first button - reacts on enter | ||||
| 	buttons.back()->assignedKeys.insert(SDLK_ESCAPE); //last button - reacts on escape | ||||
| @@ -131,7 +131,7 @@ CInfoWindow::CInfoWindow(std::string Text, PlayerColor player, const TCompsInfo | ||||
| 		buttons.push_back(button); | ||||
| 	} | ||||
|  | ||||
| 	text = std::make_shared<CTextBox>(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::WHITE); | ||||
| 	text = std::make_shared<CTextBox>(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE); | ||||
| 	if(!text->slider) | ||||
| 	{ | ||||
| 		text->resize(text->label->textSize); | ||||
| @@ -218,18 +218,18 @@ CInfoPopup::CInfoPopup(SDL_Surface * Bitmap, int x, int y, bool Free) | ||||
| } | ||||
|  | ||||
|  | ||||
| CInfoPopup::CInfoPopup(SDL_Surface * Bitmap, const Point &p, EAlignment alignment, bool Free) | ||||
| CInfoPopup::CInfoPopup(SDL_Surface * Bitmap, const Point &p, ETextAlignment alignment, bool Free) | ||||
|  : free(Free),bitmap(Bitmap) | ||||
| { | ||||
| 	switch(alignment) | ||||
| 	{ | ||||
| 	case BOTTOMRIGHT: | ||||
| 	case ETextAlignment::BOTTOMRIGHT: | ||||
| 		init(p.x - Bitmap->w, p.y - Bitmap->h); | ||||
| 		break; | ||||
| 	case CENTER: | ||||
| 	case ETextAlignment::CENTER: | ||||
| 		init(p.x - Bitmap->w/2, p.y - Bitmap->h/2); | ||||
| 		break; | ||||
| 	case TOPLEFT: | ||||
| 	case ETextAlignment::TOPLEFT: | ||||
| 		init(p.x, p.y); | ||||
| 		break; | ||||
| 	default: | ||||
| @@ -324,7 +324,7 @@ void CRClickPopup::createAndPush(const std::string & txt, std::shared_ptr<CCompo | ||||
| 	createAndPush(txt, intComps); | ||||
| } | ||||
|  | ||||
| void CRClickPopup::createAndPush(const CGObjectInstance * obj, const Point & p, EAlignment alignment) | ||||
| void CRClickPopup::createAndPush(const CGObjectInstance * obj, const Point & p, ETextAlignment alignment) | ||||
| { | ||||
| 	auto iWin = createInfoWin(p, obj); //try get custom infowindow for this obj | ||||
| 	if(iWin) | ||||
|   | ||||
| @@ -83,7 +83,7 @@ public: | ||||
| 	static std::shared_ptr<WindowBase> createInfoWin(Point position, const CGObjectInstance * specific); | ||||
| 	static void createAndPush(const std::string & txt, const CInfoWindow::TCompsInfo &comps = CInfoWindow::TCompsInfo()); | ||||
| 	static void createAndPush(const std::string & txt, std::shared_ptr<CComponent> component); | ||||
| 	static void createAndPush(const CGObjectInstance * obj, const Point & p, EAlignment alignment = BOTTOMRIGHT); | ||||
| 	static void createAndPush(const CGObjectInstance * obj, const Point & p, ETextAlignment alignment = ETextAlignment::BOTTOMRIGHT); | ||||
| }; | ||||
|  | ||||
| /// popup displayed on R-click | ||||
| @@ -103,7 +103,7 @@ public: | ||||
| 	void close() override; | ||||
| 	void show(SDL_Surface * to) override; | ||||
| 	CInfoPopup(SDL_Surface * Bitmap, int x, int y, bool Free=false); | ||||
| 	CInfoPopup(SDL_Surface * Bitmap, const Point &p, EAlignment alignment, bool Free=false); | ||||
| 	CInfoPopup(SDL_Surface * Bitmap, const Point &p, ETextAlignment alignment, bool Free=false); | ||||
| 	CInfoPopup(SDL_Surface * Bitmap = nullptr, bool Free = false); | ||||
|  | ||||
| 	void init(int x, int y); | ||||
|   | ||||
| @@ -168,7 +168,7 @@ | ||||
| 		"targetType": "NO_TARGET", | ||||
|  | ||||
| 		"animation":{ | ||||
| 			//missing | ||||
| 			"affect":["SP10_"] | ||||
| 		}, | ||||
| 		"sounds": { | ||||
| 			"cast": "PARALYZE" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user