#include <allegro.h>
int main(int argc, char *argv[])
{
allegro_init();
install_keyboard();
set_color_depth(32);
set_gfx_mode(GFX_AUTODETECT, 1024,768,0,0);
BITMAP *pic = create_bitmap(50,50);
clear_to_color(pic, makecol(255, 255, 0));
BITMAP *buffer = create_bitmap(1024,768);
int x = 0;
int y = 0;
while(!key[KEY_ESC])
{
if(key[KEY_RIGHT]) x++;
if(key[KEY_LEFT]) x --;
if(key[KEY_UP]) y--;
if(key[KEY_DOWN]) y++;
draw_sprite(buffer, pic, x, y);
blit(buffer, screen, 0,0,0,0,1024,768);
clear_to_color(buffer, makecol(255, 255, 255));
}
}
END_OF_MAIN()
|