1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
vcmi/client/battle/BattleOverlayLogVisualizer.cpp

42 lines
1.2 KiB
C++
Raw Normal View History

2024-08-06 21:29:04 +02:00
/*
* BattleOverlayLogVisualizer.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "BattleOverlayLogVisualizer.h"
#include "BattleInterface.h"
#include "BattleFieldController.h"
#include "../render/Canvas.h"
#include "../render/Colors.h"
#include "../render/EFont.h"
2024-08-10 18:13:09 +02:00
#include "../render/IFont.h"
#include "../render/IRenderHandler.h"
2024-08-06 21:29:04 +02:00
#include "../gui/TextAlignment.h"
#include "../gui/CGuiHandler.h"
2024-08-10 18:13:09 +02:00
#include "../render/Graphics.h"
2024-08-06 21:29:04 +02:00
BattleOverlayLogVisualizer::BattleOverlayLogVisualizer(
BattleRenderer::RendererRef & target,
BattleInterface & owner)
: target(target), owner(owner)
{
}
void BattleOverlayLogVisualizer::drawText(BattleHex hex, int lineNumber, const std::string & text)
2024-08-06 21:29:04 +02:00
{
2024-08-10 18:13:09 +02:00
Point offset = owner.fieldController->hexPositionLocal(hex).topLeft() + Point(20, 20);
const auto & font = GH.renderHandler().loadFont(FONT_TINY);
int h = font->getLineHeight();
2024-08-06 21:29:04 +02:00
2024-08-10 18:13:09 +02:00
offset.y += h * lineNumber;
target.drawText(offset, EFonts::FONT_TINY, Colors::YELLOW, ETextAlignment::TOPCENTER, text);
2024-08-06 21:29:04 +02:00
}