Fillwave
10.0.0
Main Page
Classes
Files
File List
inc
flw
flf
hud
Text.h
1
#pragma once
2
3
/*
4
* The MIT License (MIT)
5
*
6
* Copyright (c) 2018 Filip Wasil and Fillwave community members
7
*
8
* Permission is hereby granted, free of charge, to any person
9
* obtaining a copy of this software and associated documentation files (the "Software"),
10
* to deal in the Software without restriction, including without limitation the rights
11
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
12
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13
*
14
* The above copyright notice and this permission notice shall be included
15
* in all copies or substantial portions of the Software.
16
*
17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
*/
23
24
#include <flw/flc/buffers/mVertexBufferText.h>
25
#include <flw/flc/pipeline/Program.h>
26
27
#include <flw/flf/hud/base/Sprite.h>
28
#include <flw/cmn/resources/FontLoader.h>
29
#include <flw/flf/models/base/IReloadable.h>
30
#include <map>
31
32
namespace
flw
{
33
34
class
Engine;
35
36
enum class
ETextEffect {
37
none
38
, bold
39
};
40
41
namespace
flf {
42
47
class
Text
:
public
IReloadable
,
public
Sprite
{
48
public
:
49
Text
(
const
std::string &text,
50
flc::Texture2D
*texture,
51
glm::vec2 position,
52
Engine
* engine,
53
GLfloat scale,
54
Font *font,
55
glm::vec4 color = glm::vec4(1.0, 1.0, 1.0, 1.0),
56
ETextEffect effect = ETextEffect::none);
57
58
~
Text
()
override
=
default
;
59
60
void
draw()
override
;
61
62
void
editAspectRatio(
Engine
*engine);
63
64
void
editString(std::string text);
65
66
void
editColor(glm::vec4 color);
67
68
void
editSize(GLfloat size);
69
70
void
editPosition(glm::vec2 position);
71
72
private
:
73
/* Text */
74
std::string mText;
75
glm::vec4 mColor;
76
Font* mFont;
77
flc::VertexBufferText
* mVBO;
78
79
/* IHUD */
80
Engine
* mEngine;
81
GLint mUniformLocationCacheColor;
82
GLint mViewportWidth;
83
GLint mViewportHeight;
84
85
flc::Program
* createProgram(
Engine
* engine, ETextEffect effect);
86
87
void
createVBO();
88
89
void
clearVBO();
90
91
void
initVBO()
override
;
92
93
void
initVAO()
override
;
94
95
void
initBuffers()
override
;
96
97
void
initPipeline()
override
;
98
99
void
initUniformsCache()
override
;
100
};
101
102
}
/* flf */
103
}
/* flw */
flw
Definition:
Aliases.h:30
flw::flf::IReloadable
Encapsulates reloadable objects.
Definition:
IReloadable.h:35
flw::flf::Sprite
HUD base element.
Definition:
Sprite.h:37
flw::flc::Texture2D
Single GLSL 2D Texture object.
Definition:
Texture2D.h:36
flw::flc::VertexBufferText
Vertex buffer specialized with VertexText data structure.
Definition:
mVertexBufferText.h:42
flw::Engine
Fillwave engine core.
Definition:
Engine.h:85
flw::flc::Program
Single GLSL program object.
Definition:
Program.h:37
flw::flf::Text
2D Text on the screen.
Definition:
Text.h:47
Generated on Tue Oct 2 2018 22:13:43 for Fillwave by
1.8.11