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
+9 -4
View File
@@ -154,12 +154,17 @@ void RenderSystem::fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World*
continue;
}
Font* font = ResourceManager::Load<Font>(textComponent["Resource"]);
if (font == nullptr) {
font = ResourceManager::Load<Font>("Fonts/DroidSans.ttf");
Font* font;
try {
font = ResourceManager::Load<Font>(resource);
} catch (const std::exception&) {
try {
font = ResourceManager::Load<Font>("Fonts/DroidSans.ttf,16");
} catch (const std::exception&) {
continue;
}
}
glm::mat4 modelMatrix = Transform::ModelMatrix(textComponent.EntityID, world);
std::shared_ptr<TextJob> modelJob = std::shared_ptr<TextJob>(new TextJob(modelMatrix, font, textComponent));
jobs.push_back(modelJob);