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-2022 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 "Drawable.hpp"
8#include "Mat3.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
27 Vec2 getSize() const;
28 double getWidth() const;
29 double getHeight() const;
30 void setCenter(double x, double y);
31 void setCenter(Vec2);
32 double getX() const;
33 void setX(double);
34 double getY() const;
35 void setY(double);
36 void setPos(double, double);
37
38private:
39 std::string text;
41 Vec2 position;
42};
43
44} // namespace jngl
Contains jngl::Drawable class.
Contains jngl::Mat3 class.
Font loaded from a TTF or OTF file.
Definition: font.hpp:19
3x3 matrix
Definition: Mat3.hpp:18
Rectangle shaped text (in contrast to jngl::Text this only represents one line)
Definition: TextLine.hpp:18
Two-dimensional vector.
Definition: Vec2.hpp:32
JNGL's main namespace.
Definition: Achievement.hpp:10
jngl::Mat3 modelview()
Returns a copy of the global ModelView matrix.