Allegro Game Library not Running Correctly

So I'm using the Allegro game engine because it's easier for beginners than SDL and I cannot get it to run this basic text to screen thingy. Here's my code, I get three warnings but not errors at compile and when I run it it stops working and Windows does the "program has stopped working" dialogue.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <allegro5\allegro.h> //Import header files w/Allegro functs
#include <allegro5\allegro_native_dialog.h>
#include <allegro5\allegro_font.h>
#include <allegro5\allegro_ttf.h> 

int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL; //Display variable declaration
 
  if(!al_init()) //Run and test initialization
  {
    al_show_native_message_box(NULL, NULL, NULL, 
                 "Failed to initialize allegro!", NULL, NULL);                   
    return -1;
  }
 
  display = al_create_display(640, 480); //Make display

  
  if(!display) //Test display
  {
    al_show_native_message_box(NULL, NULL, NULL, 
                "Failed to initialize display!", NULL, NULL);
    return -1;
  }
	al_init_font_addon(); //Initialize font
	al_init_ttf_addon();
	
	ALLEGRO_FONT *font24 = al_load_font("arial.tff", 24, 0);
 
 
	al_clear_to_color(al_map_rgb(0,0,0)); //Colour
	
	al_draw_text(font24, al_map_rgb(255, 0, 255), 50, 50, 0, "Derp herp I'm a derp."); //Print text
	
	al_flip_display();
	
	al_rest(5.0); //5 sec pause
	
	al_destroy_display(display); //Close program
	
return 0;
}
 


Last edited on
closed account (G309216C)
I do not know, Allegro but I do know thing or two about Windows API. Then code I see here has nothing to do with Windows Programming.

Moderator please move this thread, to General or Beginners.

Thanks
Ah, I didn't know. I just thought I was programming in windows so... xD I'm such a newbie.
Topic archived. No new replies allowed.