Added Font to ResourceManager

This commit is contained in:
viktorljung
2015-12-11 16:53:51 +01:00
parent a8a38716bd
commit 9bd3da409d
7 changed files with 113 additions and 76 deletions
+28
View File
@@ -0,0 +1,28 @@
#ifndef Font_h__
#define Font_h__
#include <ft2build.h>
#include FT_FREETYPE_H
#include "../OpenGL.h"
#include "../GLM.h"
#include "../Core/ResourceManager.h"
class Font : public Resource
{
friend class ResourceManager;
private:
Font(std::string path);
public:
struct Character {
GLuint TextureID; // ID handle of the glyph texture
glm::ivec2 Size; // Size of glyph
glm::ivec2 Bearing; // Offset from baseline to left/top of glyph
GLuint Advance; // Offset to advance to next glyph
};
~Font();
std::map<GLchar, Character> m_Characters;
};
#endif
+5 -13
View File
@@ -4,9 +4,11 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#include "OpenGL.h"
#include "GLM.h"
#include "../OpenGL.h"
#include "../GLM.h"
#include "ShaderProgram.h"
#include "Font.h"
#include "../Core/ResourceManager.h"
class TextRenderer
{
@@ -17,17 +19,7 @@ public:
void Draw(glm::mat4 projection, glm::mat4 view);
private:
struct Character {
GLuint TextureID; // ID handle of the glyph texture
glm::ivec2 Size; // Size of glyph
glm::ivec2 Bearing; // Offset from baseline to left/top of glyph
GLuint Advance; // Offset to advance to next glyph
};
std::map<GLchar, Character> Characters;
Font* font;
GLuint VAO, VBO;
+1
View File
@@ -18,6 +18,7 @@ public:
void Bind(GLenum textureUnit = GL_TEXTURE0);
GLuint m_Texture = 0;
};
#endif