allegro help - page flipping?
i'm having some trouble with "page flipping" using allegro.. maybe i don't really understand the concept. i took a look at the link from the allegro thread in the FAQ, but it didn't really help... i've got some code, but i'm sure a lot of it is off.. i did it mostly by copy/pasting and trial and error.. this finally compiled without errors, but won't run.. it crashes. if someone could point me to a tutorial, or an example program, or something, that would be great..
here's the code i have
Code:
#include <allegro.h>
BITMAP *Screen[3], *Buffer, *character[2];
int main()
{
// Initialize Allegro.
allegro_init();
set_color_depth(24);
set_gfx_mode(GFX_SAFE, 800, 600, 0, 0);
install_keyboard();
bool vid=1;
Screen[0]=create_video_bitmap(800,600);
Screen[1]=create_video_bitmap(800,600);
Screen[2]=create_video_bitmap(800,600);
Buffer=create_bitmap(800,600);
character[0] = load_bitmap("MyPicture.bmp", NULL);
character[1] = load_bitmap("MyPicture1.bmp", NULL);
while(!key[KEY_ESC])
{
clear_bitmap(Buffer);
draw_sprite(Buffer, character[vid], 400, 300);
blit(Buffer, Screen[vid+1], 0, 0, 0, 0, 800, 600);
show_video_bitmap(Screen[vid+1]);
vid = !vid;
}
destroy_bitmap(Buffer);
allegro_exit();
return 0;
}
END_OF_MAIN();
any help is appreciated.