Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // gcc -Wall 2.c -o 2 $(pkg-config --libs allegro-5.0 allegro_image-5.0 allegro_font-5.0 allegro_ttf-5.0 allegro_dialog-5.0)
- #include <allegro5/allegro.h>
- #include <allegro5/allegro_font.h>
- #include <allegro5/allegro_ttf.h>
- #include <allegro5/allegro_native_dialog.h>
- int main() {
- ALLEGRO_DISPLAY *display = NULL;
- if(!al_init()) {
- al_show_native_message_box(display, NULL, NULL, "failed to initialize allegro!", NULL, ALLEGRO_MESSAGEBOX_YES_NO);
- return -1;
- }
- display = al_create_display(640, 480);
- if(!display) {
- al_show_native_message_box(NULL, NULL, NULL, "failed to initialize display!", NULL, ALLEGRO_MESSAGEBOX_YES_NO);
- return -1;
- }
- al_init_font_addon();
- al_init_ttf_addon();
- ALLEGRO_FONT *font18 = al_load_font("arial.ttf", 18, 0);
- al_clear_to_color(al_map_rgb(46, 80, 255));
- al_draw_textf(font18, al_map_rgb(255, 255, 255), 50, 50, 0, "Hello, world, this is 18 point!");
- int screen_w = al_get_display_width(display);
- int screen_h = al_get_display_height(display);
- al_draw_textf(font18, al_map_rgb(255, 255, 255), screen_w/2, 400, ALLEGRO_ALIGN_CENTRE, "TEXT with variable output (textf): Screen width and height = %i / %i", screen_w, screen_h);
- al_flip_display();
- al_rest(60.0);
- al_destroy_font(font18);
- al_destroy_display(display);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement