NGL
6.5
The NCCA Graphics Library
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
Text.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2011 Jon Macey
3
4
This program is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
#ifndef TEXT_H_
18
#define TEXT_H_
19
20
21
//----------------------------------------------------------------------------------------------------------------------
37
//----------------------------------------------------------------------------------------------------------------------
38
// must include types.h first for Real and GLEW if required
39
40
#include "
Colour.h
"
41
#include "
Types.h
"
42
#include "
Vec2.h
"
43
#include "
VAOFactory.h
"
44
#include "
SimpleVAO.h
"
45
#include <memory>
46
#include <QFont>
47
#include "
Mat4.h
"
48
49
namespace
ngl
50
{
51
52
//----------------------------------------------------------------------------------------------------------------------
57
//----------------------------------------------------------------------------------------------------------------------
58
struct
FontChar
59
{
60
int
width
;
61
GLuint
textureID
;
62
AbstractVAO
*
vao
;
63
};
64
65
class
NGL_DLLEXPORT
Text
66
{
67
public
:
68
//----------------------------------------------------------------------------------------------------------------------
73
//----------------------------------------------------------------------------------------------------------------------
74
Text
(
const
QFont &_f ) noexcept;
75
76
//----------------------------------------------------------------------------------------------------------------------
78
//----------------------------------------------------------------------------------------------------------------------
79
~
Text
();
80
81
//----------------------------------------------------------------------------------------------------------------------
90
//----------------------------------------------------------------------------------------------------------------------
91
void
renderText(
float
_x,
float
_y,
const
QString &_text )
const
noexcept;
92
//----------------------------------------------------------------------------------------------------------------------
99
//----------------------------------------------------------------------------------------------------------------------
100
void
setScreenSize(
int
_w,
int
_h ) noexcept;
101
//----------------------------------------------------------------------------------------------------------------------
104
//----------------------------------------------------------------------------------------------------------------------
105
void
setColour(
const
Colour
&_c ) noexcept;
106
//----------------------------------------------------------------------------------------------------------------------
111
//----------------------------------------------------------------------------------------------------------------------
112
void
setColour(
Real
_r,
Real
_g,
Real
_b ) noexcept;
113
114
void
setTransform(
float
_x,
float
_y) noexcept;
115
protected
:
116
//----------------------------------------------------------------------------------------------------------------------
120
//----------------------------------------------------------------------------------------------------------------------
121
QHash <char,FontChar>
m_characters
;
122
};
123
124
}
125
126
#endif
127
128
129
130
131
132
133
//----------------------------------------------------------------------------------------------------------------------
ngl::Text::m_characters
QHash< char, FontChar > m_characters
a hash to store our FontChar data looked up by the char we want to render according to the Qt Docs a ...
Definition:
Text.h:121
GLuint
unsigned int GLuint
Definition:
glew.h:280
ngl::FontChar::width
int width
Definition:
Text.h:60
ngl::Colour
simple class to hold colour information and set the basic opengl colour state. also has overloaded me...
Definition:
Colour.h:40
Colour.h
a simple colour class for RGBA colour
Types.h
main definition of types and namespace
ngl::FontChar::textureID
GLuint textureID
the width of the font
Definition:
Text.h:61
NGL_DLLEXPORT
#define NGL_DLLEXPORT
Definition:
Types.h:65
ngl::Text
Definition:
Text.h:65
ngl::FontChar
a structure to hold the font char texture id and the vao. The vao for each font will be a different s...
Definition:
Text.h:58
ngl
implementation files for RibExport class
Definition:
AABB.cpp:22
ngl::Real
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
Definition:
Types.h:127
Vec2.h
a simple 2 tuple container for compatibility with glsl
ngl::AbstractVAO
base class for all VAO from the VAOFactory this defines the base class type with simple draw / bind b...
Definition:
AbstractVAO.h:34
SimpleVAO.h
ngl::FontChar::vao
AbstractVAO * vao
the texture id of the font billboard
Definition:
Text.h:62
Mat4.h
VAOFactory.h
Users
jmacey
NGL
include
ngl
Text.h
Generated on Mon Nov 28 2016 19:40:29 for NGL by
1.8.11