Hi,
I am using Allegro 5 with MSVC 2010 express, and I used the installation instructions from:
http://wiki.allegro.cc/index.php?title=Install_Visual_Studio_2010_and_Allegro_5
When I am using al_load_ttf_font. The font loads NULL (although the function al_get_font_line_height(font), seems to return the correct height), and then I get the error:
Assertion failed: f, file allegro-5.0.x\addons\font\text.c, line 278
The top of my file has the includes:
#include <allegro5\allegro.h>
#include <allegro5\allegro_font.h>
#include <allegro5\allegro_ttf.h>
I initialize in this order:
al_init();
al_init_primitives_addon(); //For circles & lines
al_init_font_addon(); //must be called to run the next line
al_init_ttf_addon(); //To load true type fonts
then I call
ALLEGRO_FONT *font = al_load_ttf_font(path, txt_height, 0);
which returns NULL, then gives me the error:
Assertion failed: f, file allegro-5.0.x\addons\font\text.c, line 278
Any ideas would be appreciated.
The font is null... It hasn't been loaded. See al_get_standard_path for how to change into your resources directory prior to loading the font.
Thanks,
looks like I needed
ALLEGRO_PATH *p = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
string c = al_path_cstr(p, ALLEGRO_NATIVE_PATH_SEP );
for some reason
string thepath = _getcwd(NULL, 0);
does not give me the correct current working directory.
You can use al_change_directory() with that cstr. Then the future loads will work like you expect.