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;
}
| |