Title says it all. I'm (trying to) load a font in Allegro 5. Running the code at the bottom of this post results in a blank white window opening (desired) but crashes with "TSAGAME.EXE has stopped working" (not desired). Command prompt returns with a random negative number
The "problem details" dialogue is here: http://pastebin.com/Vc89wfwy
I have tested the "font" variable (Between lines 24 and 25). It's not null.
Directory tree of my project folder:
C:\Users\Andrew\Desktop\TSAGAME>tree /F
C:.
│ allegro.log
│ main.cpp
│ Orbitron Black.ttf
│ pirulen.ttf
│ TSAGAME.cbp
│ TSAGAME.depend
│ TSAGAME.layout
│
├───bin
│ │ Orbitron Black.ttf
│ │
│ └───Debug
│ allegro-5.0.10-monolith-mt-debug.dll
│ Orbitron Black.ttf
│ TSAGAME.exe
│
└───obj
│ Orbitron Black.ttf
│
└───Debug
main.o
Orbitron Black.ttf
Code::Blocks - Build Options - Linker Settings>Link Libraries:
C:\Users\Andrew\Documents\GitHub\Game4TSA\allegro\allegro-5.0.10-mingw-4.5.0\lib\liballegro-5.0.10-monolith-mt-debug.a
Code::Blocks - Build Options - Search Directories>Compiler:
C:\Users\Andrew\Documents\GitHub\Game4TSA\allegro\allegro-5.0.10-mingw-4.5.0\include
main.cpp:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <windowsx.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_native_dialog.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_primitives.h>
#define ScreenWidth 800
#define ScreenHeight 600
int main()
{
al_init();
al_set_new_display_flags(ALLEGRO_WINDOWED);
ALLEGRO_DISPLAY *display = al_create_display(ScreenWidth, ScreenHeight);
al_set_window_position(display, 200, 100);
al_set_window_title(display, "Neat a demo");
al_init_font_addon();
al_init_ttf_addon();
ALLEGRO_FONT *font = al_load_font("C:/Users/Andrew/Desktop/TSAGAME/Orbitron Black.ttf", 10, 0);
al_draw_text(font, al_map_rgb(44, 117, 255), 0, 0, NULL, "www");
al_flip_display();
al_rest(10.0);
al_destroy_font(font);
al_destroy_display(display);
return 0;
}
Ideas? I've been digging for a while. To put it simply: xkcd, #979