mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Return exit error code on main when freetype (or its setup) fails.
This commit is contained in:
@@ -85,17 +85,24 @@ int main()
|
|||||||
FT_Library ft;
|
FT_Library ft;
|
||||||
// All functions return a value different than 0 whenever an error occurred
|
// All functions return a value different than 0 whenever an error occurred
|
||||||
if (FT_Init_FreeType(&ft))
|
if (FT_Init_FreeType(&ft))
|
||||||
|
{
|
||||||
std::cout << "ERROR::FREETYPE: Could not init FreeType Library" << std::endl;
|
std::cout << "ERROR::FREETYPE: Could not init FreeType Library" << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// find path to font
|
// find path to font
|
||||||
const char *font_name = FileSystem::getPath("resources/fonts/Antonio-Bold.ttf").c_str();
|
const char *font_name = FileSystem::getPath("resources/fonts/Antonio-Bold.ttf").c_str();
|
||||||
if(!font_name)
|
if(!font_name)
|
||||||
|
{
|
||||||
std::cout << "ERROR::FREETYPE: Failed to load font_name: " << font_name << std::endl;
|
std::cout << "ERROR::FREETYPE: Failed to load font_name: " << font_name << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// load font as face
|
// load font as face
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
if (FT_New_Face(ft, font_name, 0, &face)) {
|
if (FT_New_Face(ft, font_name, 0, &face)) {
|
||||||
std::cout << "ERROR::FREETYPE: Failed to load font" << std::endl;
|
std::cout << "ERROR::FREETYPE: Failed to load font" << std::endl;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// set size to load glyphs as
|
// set size to load glyphs as
|
||||||
|
|||||||
Reference in New Issue
Block a user