39 lines
810 B
C++
39 lines
810 B
C++
|
#include "textsfml.h"
|
||
|
|
||
|
TextSFML::TextSFML(const std::shared_ptr<sf::RenderTarget>& render_target,
|
||
|
const std::shared_ptr<const sf::Font>& font) :
|
||
|
_render_target(render_target)
|
||
|
{
|
||
|
_text.setFont(*font);
|
||
|
}
|
||
|
|
||
|
void TextSFML::setString(const std::string& string)
|
||
|
{
|
||
|
_text.setString(string);
|
||
|
}
|
||
|
|
||
|
void TextSFML::setCharacterSize(std::size_t pixels)
|
||
|
{
|
||
|
_text.setCharacterSize(pixels);
|
||
|
}
|
||
|
|
||
|
void TextSFML::setPosition(const kku::Point& point)
|
||
|
{
|
||
|
_text.setPosition(point.x, point.y);
|
||
|
}
|
||
|
|
||
|
void TextSFML::move(const kku::Vector2<float>& delta)
|
||
|
{
|
||
|
_text.move({delta.first, delta.second});
|
||
|
}
|
||
|
|
||
|
void TextSFML::setColor(const kku::Color& color)
|
||
|
{
|
||
|
_text.setFillColor(sf::Color{color.red, color.green, color.blue, color.alpha});
|
||
|
}
|
||
|
|
||
|
void TextSFML::display()
|
||
|
{
|
||
|
_render_target->draw(_text);
|
||
|
}
|