-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextModule.hpp
More file actions
92 lines (58 loc) · 2.25 KB
/
Copy pathTextModule.hpp
File metadata and controls
92 lines (58 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
** EPITECH PROJECT, 2020
** TextModule.hpp
** File description:
** header for TextModule.c
*/
#pragma once
#include <myxmlpp.hpp>
#include <memory>
#include "Polymorph/Types.hpp"
#include "GraphicalAPI/GraphicalInterfaces/ITextModule.hpp"
#include "Config/XmlComponent.hpp"
namespace Polymorph
{
class TextModule
{
////////////////////// CONSTRUCTORS/DESTRUCTORS /////////////////////////
public:
explicit TextModule(std::shared_ptr<myxmlpp::Node> &data,
Config::XmlComponent &manager);
TextModule(std::string str, float size);
~TextModule() = default;
//////////////////////--------------------------/////////////////////////
///////////////////////////// PROPERTIES ////////////////////////////////
public:
private:
using TextModuleLoader = Polymorph::ITextModule *(*)(
const std::string &text);
using FontModuleLoader = Polymorph::IFontModule *(*)(
const std::string &filepath);
static inline TextModuleLoader _c_text = nullptr;
static inline FontModuleLoader _c_font = nullptr;
std::unique_ptr<Polymorph::ITextModule> _text;
std::unique_ptr<Polymorph::IFontModule> _font;
std::string _textString;
std::string _fontFilepath;
float _fontSize;
float _lineSpacing;
Color _color;
//////////////////////--------------------------/////////////////////////
/////////////////////////////// METHODS /////////////////////////////////
public:
void setPosition(Vector2 position);
void setString(const std::string &content);
std::string getString();
void setFont(const std::string &fontPath);
void setFontSize(float fontSize);
float getFontSize();
void setSpacing(float lineSpacing);
float getSpacing();
void setColor(Color color);
Color getColor();
void draw();
private:
void _loadModules();
//////////////////////--------------------------/////////////////////////
};
}