umm... i want to animate a bitmap according to what key the user is pressing. But when I use no clear screen functions the old bitmap is left behind. When I use a clear screen function then it is really sketchy. I used man different types of clear screen such as clear_to_color etc. I am not sure what I am doing wrong. Oh and I am using the allegro library with Dev C++ and windows 98 (if that matters)
Code:
#include <allegro.h>
int main()
{
allegro_init();
set_gfx_mode(GFX_SAFE, 640, 480, 0, 0);
set_color_depth(16); // Set the color depth
install_keyboard();
BITMAP *pic;
pic = load_bitmap("plane.bmp", NULL); // Load our picture
int x=0, y=0;
acquire_screen();
while(!key[KEY_ESC])
{if (key[KEY_UP])
{y++;}
if (key[KEY_DOWN])
{y--;}
clear_bitmap(screen);
for (int i=0 ; i < 1; i++) { clear_bitmap(screen);
vsync();
blit(pic, screen, x, y, 0, 0, 640, 480);
}
}
release_screen();
destroy_bitmap(pic);//Release the bitmap data
allegro_exit();
return 0;
}
END_OF_MAIN();