Allegro 5 Font Question

I am learning how to use Allegro 5 with Visual C++ 2010 Express. I followed a tutorial online and figured out how to write font to a window. My question is, rather than moving the .ttf file into my projects folder, is there a way to directly access the font that is already stored in system files?

Here is the code below that pulls the font from my projects file (it works):

1
2
3
4
5
6
7
8
//FONT
al_init_font_addon();
al_init_ttf_addon();

ALLEGRO_FONT *font = al_load_font("arial.ttf", 36, NULL);
al_draw_text(font, al_map_rgb(44,117,255), 400,300, ALLEGRO_ALIGN_CENTRE, "Hello World!");
	
al_flip_display();
Never used allegro, but it should be something like this:
ALLEGRO_FONT *font = al_load_font("C:\\path\\to\\file\\arial.ttf", 36, NULL);

If that doesn't work, try single slashes. But that's how I'd write C++ that needs a file in another directory
closed account (18hRX9L8)
Also, you could put it in a project and then go to
project options
,
parameters
, then include the directory path. Only if you don't want to add code.

Volatile Pulse
is also correct.
Last edited on
Topic archived. No new replies allowed.