do it like this instead
Code:
#include <allegro.h>
void setup();
void load();
BITMAP *bmp;
BITMAP *buffer;
int main()
{
setup();
load();
blit(main, buffer, 0,0,0,0,SCREEN_W,SCREEN_H);
blit(buffer, screen, 0,0,0,0,SCREEN_W,SCREEN_H);
while(!key[KEY_ESC])
{
if (key[KEY_1]||key[KEY_1_PAD])
{clear_to_color(buffer, 0);
clear_keybuf();
}
if (key[KEY_2]||key[KEY_2_PAD])
{clear_to_color(buffer, 1);
clear_keybuf();
}
if (key[KEY_3]||key[KEY_3_PAD])
{clear_to_color(buffer, 2);
clear_keybuf();
}
acquire_screen();
blit(buffer, screen, 0,0,0,0,SCREEN_W,SCREEN_H);
release_screen();
}
allegro_exit();
return 0;
}
END_OF_MAIN();
void setup()
{
allegro_init();
install_keyboard();
set_color_depth(32);
set_gfx_mode(GFX_AUTODETECT, 640,480,0,0);
}
void load()
{
bmp = load_bitmap("main.bmp", NULL);
buffer = create_bitmap(SCREEN_W, SCREEN_H);
}
/* I did not compile this code so there might be a few parse errors or something like that, but I don't think there are any. All in all, though, the basic concept of the code works for sure.
If you have any further questions, then just ask them. However, I probably won't be able to answer them until later. Btw, allegro.cc is a very good site for allegro users.