Dibujos en allegro dependiendo de la posicion del mouse
void dibujo(int x,int y){
circle (screen, x+100,y+100,100,makecol(128,0,0));
circlefill (screen,x+50,y+50,20,makecol(0,255,0));
circlefill (screen,x+150,y+50,20,makecol(0,255,0));
rect (screen,x+80,y+100,x+120,y+150,makecol(0,0,128));
line (screen,x+50,y+180,x+150,y+180,makecol(128,128,0));
}
void init();
void deinit();
int main() {
init();
show_mouse(screen);
while (!key[KEY_ESC]) {
clear_to_color(screen,0);
dibujo(mouse_x,mouse_y);
}
deinit();
return 0;
}
END_OF_MAIN();
void init() {
int depth, res;
allegro_init();
depth = desktop_color_depth();
if (depth == 0) depth = 32;
set_color_depth(depth);
res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
if (res != 0) {
allegro_message(allegro_error);
exit(-1);
}
install_timer();
install_keyboard();
install_mouse();
/* add other initializations here */
}
void deinit() {
clear_keybuf();
/* add other deinitializations here */
}