CodeCodeCode

Allegro5 Display Init Test

Dec 4th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <allegro5\allegro.h>
  3.  
  4. int main () {
  5.     ALLEGRO_DISPLAY *display = NULL;
  6.  
  7.     //Initialize Allegro library
  8.     if (!al_init()) {
  9.         fprintf(stderr, "Failed to initialize Allegro.\n");
  10.         return(-1);
  11.     }
  12.  
  13.     //Create screen 640x480
  14.     display = al_create_display(640, 480);
  15.     if (!display) {
  16.         fprintf(stderr, "Failed to create display.\n");
  17.         return(-1);
  18.     }
  19.  
  20.     al_clear_to_color(al_map_rgb(0,0,0)); //Clear display to white
  21.     al_flip_display();                    //Use back image buffer
  22.     al_rest(10.0);                        //Wait 10sec
  23.     al_destroy_display(display);          //End display and free memory
  24.  
  25.     return(0);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment