#include <allegro.h>


void processa_teclado(int& x, int& y)
{
	if (key[KEY_UP]){
		y = y - 1;
	} else if (key[KEY_DOWN]){
		y = y + 1;
	} else if (key[KEY_RIGHT]){
		x = x + 1;
	} else if (key[KEY_LEFT]){
		x = x - 1;
	} 
}

int main(int argc, char* argv[])
{
	int x = 0;
	int y = 0;
	BITMAP* imagem;
	
	allegro_init();	
	install_keyboard();
	set_color_depth(16);
	set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0);
	imagem = load_bitmap("bola.bmp",NULL);
	while(!key[KEY_ESC]){
		processa_teclado(x,y);
		acquire_screen();
		draw_sprite(screen, imagem,x,y);
		release_screen();
		clear_bitmap(screen);
	}
	destroy_bitmap(imagem);
	return(0);
}
END_OF_MAIN();
