JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
jngl
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
12
namespace
jngl
{
13
14
class
Font;
15
class
FontImpl;
16
18
class
TextLine
{
19
public
:
20
TextLine
(
Font
&,
std::string
text);
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
40
private
:
41
std::string
text;
42
std::shared_ptr<FontImpl>
fontImpl;
43
Vec2
position;
44
};
45
46
}
// namespace jngl
Mat3.hpp
Contains jngl::Mat3 class.
Vec2.hpp
Contains jngl::Vec2 class.
std::string
jngl::Font
Font loaded from a TTF or OTF file.
Definition
font.hpp:20
jngl::Mat3
3x3 matrix
Definition
Mat3.hpp:18
jngl::TextLine
Rectangle shaped text (in contrast to jngl::Text this only represents one line)
Definition
TextLine.hpp:18
jngl::TextLine::getSize
Vec2 getSize() const
Returns {width, height}.
jngl::Vec2
Two-dimensional vector.
Definition
Vec2.hpp:36
std::function
memory
jngl
JNGL's main namespace.
Definition
Achievement.hpp:10
jngl::modelview
jngl::Mat3 modelview()
Returns a copy of the global ModelView matrix.