JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
TextLine.hpp
Go to the documentation of this file.
1// Copyright 2020-2025 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#include "Mat3.hpp"
8#include "Vec2.hpp"
9
10#include <memory>
11
12namespace jngl {
13
14class Font;
15class FontImpl;
16
18class TextLine {
19public:
21 void step();
22 void draw() const;
23 void draw(Mat3 modelview) const;
24 void setText(std::string);
25 std::string getText() const;
26
28 Vec2 getSize() const;
29
30 double getWidth() const;
31 double getHeight() const;
32 void setCenter(double x, double y);
33 void setCenter(Vec2);
34 double getX() const;
35 void setX(double);
36 double getY() const;
37 void setY(double);
38 void setPos(double, double);
39
40private:
41 std::string text;
43 Vec2 position;
44};
45
46} // namespace jngl
Contains jngl::Mat3 class.
Contains jngl::Vec2 class.
Font loaded from a TTF or OTF file.
Definition font.hpp:20
3x3 matrix
Definition Mat3.hpp:18
Rectangle shaped text (in contrast to jngl::Text this only represents one line)
Definition TextLine.hpp:18
Vec2 getSize() const
Returns {width, height}.
Two-dimensional vector.
Definition Vec2.hpp:36
JNGL's main namespace.
jngl::Mat3 modelview()
Returns a copy of the global ModelView matrix.