JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
jngl
Label.hpp
Go to the documentation of this file.
1
// Copyright 2020-2024 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 "
Rgb.hpp
"
8
#include "
TextLine.hpp
"
9
#include "
Widget.hpp
"
10
#include "
text.hpp
"
11
12
namespace
jngl
{
13
15
class
Label
:
public
Widget
{
16
public
:
17
explicit
Label
(
const
std::string
& str,
Font
&,
Rgb
,
Vec2
position
);
18
19
void
drawSelf
(
jngl::Mat3
)
const override
;
20
22
void
setAlpha
(
float
alpha);
23
25
void
setAlign
(
Alignment
);
26
28
float
getWidth
()
const
;
29
30
protected
:
31
float
alpha = 1.f;
32
33
private
:
34
jngl::TextLine
text;
35
jngl::Rgb
color;
36
};
37
38
}
// namespace jngl
Rgb.hpp
Contains jngl::Rgb class.
TextLine.hpp
Contains jngl::TextLine class.
Widget.hpp
Contains jngl::Container class.
std::string
jngl::Font
Font loaded from a TTF or OTF file.
Definition
font.hpp:20
jngl::Label
Simple Widget displaying a line of text.
Definition
Label.hpp:15
jngl::Label::setAlpha
void setAlpha(float alpha)
Set font color alpha from 0...1.
jngl::Label::drawSelf
void drawSelf(jngl::Mat3) const override
Override this function to draw the widget.
jngl::Label::setAlign
void setAlign(Alignment)
How to align the label's text, default is CENTER.
jngl::Label::getWidth
float getWidth() const
Returns the width of the underlying jngl::TextLine.
jngl::Mat3
3x3 matrix
Definition
Mat3.hpp:18
jngl::Rgb
Object representing a RGB color, new version of jngl::Color (which will be deprecated in the future)
Definition
Rgb.hpp:15
jngl::TextLine
Rectangle shaped text (in contrast to jngl::Text this only represents one line)
Definition
TextLine.hpp:18
jngl::Vec2
Two-dimensional vector.
Definition
Vec2.hpp:36
jngl::Widget
Definition
Widget.hpp:18
jngl::Widget::position
jngl::Vec2 position
Center.
Definition
Widget.hpp:59
jngl
JNGL's main namespace.
Definition
Achievement.hpp:10
jngl::Alignment
Alignment
How multiple lines should be aligned in a text block.
Definition
text.hpp:17
text.hpp