/* * ===================================================================================== * * Filename: Text.hpp * * Description: * * Created: 24/06/2018 01:48:24 * * Author: Quentin Bazin, * * ===================================================================================== */ #ifndef TEXT_HPP_ #define TEXT_HPP_ #include #include "Sprite.hpp" class Text : public IDrawable, public Transformable { public: Text(); const std::string &text() const { return m_text; } void setText(const std::string &text) { m_text = text; updateTextSprites(); } const Vector2i &getSize() const { return m_size; } private: void draw(RenderTarget &target, RenderStates states) const override; void updateTextSprites(); void updateCharWidth(); std::string m_text; std::vector m_textSprites; int m_charWidth[256]; Texture &m_texture; VertexBuffer m_vbo; Vector2i m_size; }; #endif // TEXT_HPP_