#include <allegro.h> void init(); void deinit(); int main() { init(); int x,y; show_mouse(screen); while (!key[KEY_ESC]) { /* put your code here */ for (x=10;x<600;x+=50){ for (y=10;y<420;y+=60){ if (mouse_x > x && mouse_x < x+40 && mouse_y >y && mouse_y < y+50){ circlefill(screen, x+20,y+25,20,makecol(128,y%255,0)); } else { rectfill(screen, x,y,x+40,y+50,makecol(0,255,0)); } } } } 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 */ }
You need to create an account or log in to post comments to this site.