I've spent a chunk of time this morning reading the Allegro manual and a couple of forum posts, but I'm not finding anything wrong with my code. The textf block is on lines 45-50 I believe. Thank you!
Here is the short version of where I think the problem lies:
int screen_w = al_get_display_width(display); int screen_h = al_get_display_height(display); int restTime = 10; al_draw_textf(font36, al_map_rgb(255, 255, 255), screen_w/2, screen_h/2, ALLEGRO_ALIGN_CENTRE, "This screen will self destruct in %i seconds", restTime);
And here is the entire file:
//FILE : FontText.cpp
//PROG : Mickie Maxey
//PURP : Test Fonts and compiler settings in Allegro to gain experience
#include <allegro5\allegro.h>
#include <allegro5\allegro_font.h>
#include <allegro5\allegro_ttf.h>
#include <allegro5\allegro_native_dialog.h>
int main(void)
{
ALLEGRO_DISPLAY *display = NULL;
if(!al_init())
{
al_show_native_message_box(NULL, NULL, NULL, "Allego Init FAIL!!!", NULL, NULL);
return -1;
}
display = al_create_display(640, 480);
if(!display)
{
al_show_native_message_box(NULL, NULL, NULL, "Display FAIL!!!!!", NULL, NULL);
return -1;
}
al_init_font_addon();
al_init_ttf_addon();
ALLEGRO_FONT *font36 = al_load_font("orange juice.ttf", 36,0);
al_clear_to_color(al_map_rgb(0,0,0));
int screen_w = al_get_display_width(display);
int screen_h = al_get_display_height(display);
int restTime = 10;
al_draw_textf(font36, al_map_rgb(255, 255, 255), screen_w/2, screen_h/2, ALLEGRO_ALIGN_CENTRE,
"This screen will self destruct in %i seconds", restTime);
al_flip_display();
al_rest(10.0);
al_destroy_font(font36);
al_destroy_display(display);
return 0;
}//END MAIN

New Topic/Question
Reply




MultiQuote







|