Created
January 3, 2020 20:30
-
-
Save ermiry/f166db28d4b2e4d0d899de0de68a9a8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "cengine/renderer.h" | |
#include "cengine/ui/font.h" | |
int load_font (Renderer *renderer) { | |
int retval = 1; | |
if (renderer) { | |
// first create the font structure | |
Font *main_font = ui_font_create ("roboto", "./assets/fonts/Roboto-Regular.ttf"); | |
if (main_font) { | |
// you need to specify up front the sizes for your font | |
ui_font_set_sizes (main_font, 6, 16, 20, 24, 32, 64, 200); | |
// then you can load the font and all the sizes witll be loaded as well | |
if (!ui_font_load (main_font, renderer, TTF_STYLE_NORMAL)) { | |
retval = 0; | |
} | |
} | |
} | |
return retval; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment