Font loading crash fixed

This commit is contained in:
viktorljung
2016-01-19 17:18:18 +01:00
parent dbe56280a6
commit f0763bc2a3
8 changed files with 192 additions and 51 deletions
+21
View File
@@ -20,13 +20,34 @@ struct TextJob : RenderJob
Color = (glm::vec4)textComponent["Color"];
Content = (std::string)textComponent["Content"];
Resource = font;
if ((int)textComponent["Alignment"] == textComponent["Alignment"].Enum("Left")) {
Alignment = AlignmentEnum::Left;
} else if ((int)textComponent["Alignment"] == textComponent["Alignment"].Enum("Right")) {
Alignment = AlignmentEnum::Right;
} else if ((int)textComponent["Alignment"] == textComponent["Alignment"].Enum("Center")) {
Alignment = AlignmentEnum::Center;
} else {
LOG_ERROR("Text alignment invalid");
Alignment = AlignmentEnum::Left;
}
};
enum class AlignmentEnum
{
Left,
Right,
Center
};
glm::mat4 Matrix;
glm::vec4 Color;
std::string Content;
Font* Resource;
AlignmentEnum Alignment;
void CalculateHash() override
{
+1 -1
View File
@@ -25,7 +25,7 @@ private:
GLuint VAO, VBO;
void RenderText(std::string text, Font* font, glm::vec4 color, glm::mat4 modelMatrix, glm::mat4 projectionMatrix, glm::mat4 viewMatrix);
void RenderText(std::string text, Font* font, TextJob::AlignmentEnum alignment, glm::vec4 color, glm::mat4 modelMatrix, glm::mat4 projectionMatrix, glm::mat4 viewMatrix);
ShaderProgram* m_TextProgram;