BattleOverlayLogVisualizer.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * BattleOverlayLogVisualizer.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "BattleOverlayLogVisualizer.h"
  12. #include "BattleInterface.h"
  13. #include "BattleFieldController.h"
  14. #include "../render/Canvas.h"
  15. #include "../render/Colors.h"
  16. #include "../render/EFont.h"
  17. #include "../render/IFont.h"
  18. #include "../gui/TextAlignment.h"
  19. #include "../render/Graphics.h"
  20. BattleOverlayLogVisualizer::BattleOverlayLogVisualizer(
  21. BattleRenderer::RendererRef & target,
  22. BattleInterface & owner)
  23. : target(target), owner(owner)
  24. {
  25. }
  26. void BattleOverlayLogVisualizer::drawText(BattleHex hex, int lineNumber, std::string text)
  27. {
  28. Point offset = owner.fieldController->hexPositionLocal(hex).topLeft() + Point(20, 20);
  29. int h = graphics->fonts[EFonts::FONT_TINY]->getLineHeight();
  30. offset.y += h * lineNumber;
  31. target.drawText(offset, EFonts::FONT_TINY, Colors::YELLOW, ETextAlignment::TOPCENTER, text);
  32. }