SPARK
0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Text.h
1
#pragma once
2
3
#include "spark/core/Component.h"
4
5
#include "spark/math/Vector2.h"
6
#include "spark/rtti/HasRtti.h"
7
8
namespace
spark::core::components
9
{
10
class
Text
final :
public
Component
11
{
12
DECLARE_SPARK_RTTI(
Text
,
Component
)
13
SPARK_ALLOW_PRIVATE_SERIALIZATION
14
15
public
:
16
explicit
Text
(
GameObject
* parent)
17
:
Component
(parent) {}
18
19
explicit
Text
(
GameObject
* parent, std::string content,
const
math::Vector2<float>
offset, std::filesystem::path font_path =
""
)
20
:
Component
(parent), m_content(std::move(content)), m_offset(offset), m_fontPath(std::move(font_path)) {}
21
22
void
render
()
const override
23
{
24
//core::Renderer2D::DrawText(m_content, Transform::LocalToWorld(gameObject()->transform()) + m_offset, 72, m_fontPath);
25
}
26
27
private
:
28
std::string m_content;
29
math::Vector2<float>
m_offset;
30
std::filesystem::path m_fontPath;
31
};
32
}
33
34
IMPLEMENT_SPARK_RTTI(
spark::core::components::Text
)
spark::core::Component
A component that can be attached to a GameObject to provide additional functionality.
Definition
Component.h:20
spark::core::Component::Component
Component(GameObject *parent)
Instantiates a new Component.
Definition
Component.cpp:7
spark::core::GameObject
A GameObject is any object in the game. It contains a list of components that provides functionality ...
Definition
GameObject.h:26
spark::core::components::Text
Definition
Text.h:11
spark::core::components::Text::render
void render() const override
Renders the component.
Definition
Text.h:22
spark::math::Vector2
A vector with two components.
Definition
Vector2.h:13
sources
spark
core
include
spark
core
components
Text.h
Generated by
1.11.0