Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
Font.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
Sprite.hpp
"
4
8
struct
Glyph
9
{
10
vec2
texCoord1
;
11
vec2
texCoord2
;
12
vec2
size
;
13
vec2
advance
;
14
vec2
location
;
15
};
16
20
class
Font
21
{
22
typedef
map<char, Glyph>
glyph_map
;
23
24
TextRenderer
*
m_textRenderer
;
25
string
m_name
;
26
uint
m_size
;
27
uvec2
m_atlasSize
;
28
vector<char>
m_atlasData
;
29
uint
m_atlas
;
30
glyph_map
m_glyphs
;
31
float
m_lineHeight
;
33
friend
class
TextRenderer
;
34
35
public
:
40
float
lineHeight
()
const
{
return
m_lineHeight
; }
41
42
private
:
47
void
prepare
(
string
const
& text);
48
49
public
:
58
Font
(
TextRenderer
* textRenderer,
string
const
& fontName,
const
uint fontSize);
62
virtual
~Font
();
63
73
void
draw
(
string
const
& text, vec4
const
& color, vec2 position,
HAlign
hAlign =
HAlign::Left
,
VAlign
vAlign =
VAlign::Bottom
, vec2
const
& scale = vec2(1,1));
79
vec2
measure
(
string
const
& text);
80
};
81
82
83
84
88
class
TextRenderer
89
{
90
typedef
map<string,unique_ptr<Font>>
font_map
;
91
92
Application
*
m_app
;
93
FT_Library
m_ftLib
;
94
font_map
m_fonts
;
95
Shader
*
m_shader
;
97
vector<vec4>
m_vertices
;
99
GLuint
m_verticesBuffer
;
100
GLuint
m_vao
;
102
friend
class
Font
;
103
104
private
:
108
void
drawBuffer
();
109
110
public
:
115
TextRenderer
(
Application
* app);
119
virtual
~TextRenderer
();
120
128
Font
*
getFont
(
string
const
& name, uint
const
size);
129
134
void
begin
();
139
void
end
();
140
};
Font::prepare
void prepare(string const &text)
Definition:
Font.cpp:148
HAlign::Left
VAlign
VAlign
Definition:
Sprite.hpp:20
Font
Definition:
Font.hpp:20
TextRenderer::m_fonts
font_map m_fonts
Definition:
Font.hpp:94
TextRenderer::~TextRenderer
virtual ~TextRenderer()
Definition:
Font.cpp:249
TextRenderer::begin
void begin()
Definition:
Font.cpp:269
Font::m_textRenderer
TextRenderer * m_textRenderer
Definition:
Font.hpp:24
Font::draw
void draw(string const &text, vec4 const &color, vec2 position, HAlign hAlign=HAlign::Left, VAlign vAlign=VAlign::Bottom, vec2 const &scale=vec2(1, 1))
Definition:
Font.cpp:185
Font::m_glyphs
glyph_map m_glyphs
Definition:
Font.hpp:30
Shader
Definition:
Shader.hpp:8
Font::m_atlas
uint m_atlas
Definition:
Font.hpp:29
TextRenderer::m_vao
GLuint m_vao
Definition:
Font.hpp:100
TextRenderer::font_map
map< string, unique_ptr< Font > > font_map
Definition:
Font.hpp:90
Font::~Font
virtual ~Font()
Definition:
Font.cpp:122
Font::Font
Font(TextRenderer *textRenderer, string const &fontName, const uint fontSize)
Definition:
Font.cpp:4
Sprite.hpp
Glyph::location
vec2 location
Definition:
Font.hpp:14
TextRenderer::getFont
Font * getFont(string const &name, uint const size)
Definition:
Font.cpp:256
VAlign::Bottom
Font::glyph_map
map< char, Glyph > glyph_map
Definition:
Font.hpp:22
TextRenderer::TextRenderer
TextRenderer(Application *app)
Definition:
Font.cpp:218
TextRenderer::m_app
Application * m_app
Definition:
Font.hpp:92
TextRenderer::end
void end()
Definition:
Font.cpp:277
HAlign
HAlign
Definition:
Sprite.hpp:11
TextRenderer
Definition:
Font.hpp:88
Font::lineHeight
float lineHeight() const
Definition:
Font.hpp:40
TextRenderer::m_verticesBuffer
GLuint m_verticesBuffer
Definition:
Font.hpp:99
Glyph::texCoord1
vec2 texCoord1
Definition:
Font.hpp:10
Application
Definition:
Application.hpp:10
Font::m_size
uint m_size
Definition:
Font.hpp:26
Glyph::size
vec2 size
Definition:
Font.hpp:12
TextRenderer::m_shader
Shader * m_shader
Definition:
Font.hpp:95
Font::m_name
string m_name
Definition:
Font.hpp:25
Glyph::texCoord2
vec2 texCoord2
Definition:
Font.hpp:11
Font::m_atlasData
vector< char > m_atlasData
Definition:
Font.hpp:28
Glyph::advance
vec2 advance
Definition:
Font.hpp:13
Font::measure
vec2 measure(string const &text)
Definition:
Font.cpp:126
TextRenderer::m_vertices
vector< vec4 > m_vertices
Definition:
Font.hpp:97
Font::m_atlasSize
uvec2 m_atlasSize
Definition:
Font.hpp:27
TextRenderer::m_ftLib
FT_Library m_ftLib
Definition:
Font.hpp:93
Glyph
Definition:
Font.hpp:8
Font::m_lineHeight
float m_lineHeight
Definition:
Font.hpp:31
TextRenderer::drawBuffer
void drawBuffer()
Definition:
Font.cpp:283
Generated on Fri Jun 6 2014 13:57:28 for Number5 by
1.8.7