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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| #include<iostream>
#include <allegro5/allegro.h>
#include <allegro5\allegro_image.h>
using namespace std;
const float FPS = 60;
const int SCREEN_W = 640;
const int SCREEN_H = 480;
const int BOUNCER_SIZE = 32;
int main(int argc, char **argv){
ALLEGRO_DISPLAY *display = NULL;
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
ALLEGRO_TIMER *timer = NULL;
ALLEGRO_BITMAP *bmp = NULL;
bool redraw = true;
// Init Allegro
if(!al_init()) {
cout << "failed to initialize allegro!" << endl;
return -1;
}
// Init Timer
timer = al_create_timer(1.0 / FPS);
if(!timer) {
cout << "failed to create timer!" << endl;
return -1;
}
// Init Display
display = al_create_display(SCREEN_W, SCREEN_H);
if(!display) {
cout << "failed to create display!" << endl;
al_destroy_timer(timer);
return -1;
}
// Init Bitmap
al_init_image_addon();
/*
if(!init_image){
cout << "Pas d'adddon image!" << endl;
al_destroy_bitmap(bmp);
return -1;
}
/*
bmp = al_load_bitmap("bloc.bmp");
if(!bmp){
cout << "Pas d'image!" << endl;
al_destroy_bitmap(bmp);
return -1;
}
*/
al_rest(2.0);
al_clear_to_color(al_map_rgb(255,255,255));
al_flip_display();
al_rest(2.0);
return 0;
} |