Check if font loaded
This commit is contained in:
parent
6acfff3e8f
commit
eec97302bb
@ -102,6 +102,10 @@ public:
|
|||||||
Font() = delete;
|
Font() = delete;
|
||||||
Font(const std::string &font, int size) {
|
Font(const std::string &font, int size) {
|
||||||
font_ptr = TTF_OpenFont(font.c_str(), size);
|
font_ptr = TTF_OpenFont(font.c_str(), size);
|
||||||
|
if(font_ptr == NULL) {
|
||||||
|
std::cerr << "Unable to load font '" << font << "': TTF Error: " << TTF_GetError() << std::endl;
|
||||||
|
throw "TTF_OpenFont error";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
~Font() {
|
~Font() {
|
||||||
TTF_CloseFont( font_ptr );
|
TTF_CloseFont( font_ptr );
|
||||||
|
Loading…
Reference in New Issue
Block a user