#include <allegro.h>
int main()
{
allegro_init(); install_keyboard(); install_mouse(); set_color_depth( 32 );
set_gfx_mode( GFX_AUTODETECT, 800, 600, 0, 0 );
clear_to_color( screen, makecol( 128, 128, 128 ) );
BITMAP * bufor = NULL; bufor = create_bitmap( 800, 600 );
BITMAP * trawa = NULL; trawa = load_bmp( "trawa.bmp", default_palette );
BITMAP * pasek = NULL; pasek = load_bmp( "pasek.bmp", default_palette );
BITMAP * domek = NULL; domek = load_bmp( "domek.bmp", default_palette );
BITMAP * kursor = NULL; kursor = load_bmp( "kursor.bmp", default_palette );
BITMAP * kolanko = NULL; kolanko = load_bmp( "kolanko.bmp", default_palette );
int domek_x = 200, domek_y = 200; int kat = 0; int pas = 0; bool liczba = false; bool dom = 0;
while( !key[ KEY_ESC ] )
{
if( mouse_x >= 200 && mouse_x <= 249 && mouse_y >= 0 && mouse_y <= 49 && mouse_b == 1 && liczba == false ) liczba = true, kat = kat + 64;
if( mouse_x >= 0 && mouse_x <= 99 && mouse_y >= 0 && mouse_y <= 49 && mouse_b == 1 && liczba == false ) liczba = true, pas = pas + 100;
if( mouse_x >= domek_x && mouse_x <= domek_x + 100 && mouse_y >= domek_y && mouse_y <= domek_y + 100 && mouse_b == 1 ) dom = true;
if( mouse_b == 0 ) liczba = false, dom = false;
if( kat > 255 ) kat = 0;
if( pas > 100 ) pas = 0;
if( dom == true ) domek_x = mouse_x - 50, domek_y = mouse_y - 50;
blit( trawa, bufor, 0, 0, 0, 0, trawa->w, trawa->h );
rotate_sprite( bufor, kolanko, 200, 0, itofix( kat ) );
masked_blit( pasek, bufor, 0 + pas, 0, 0, 0, pasek->w - 100, pasek->h );
masked_blit( domek, bufor, 0, 0, domek_x, domek_y, domek->w, domek->h );
masked_blit( kursor, bufor, 0, 0, mouse_x, mouse_y, kursor->w, kursor->h );
textprintf_ex( bufor, font, 50, 120, makecol( 255, 255, 255 ), - 1, "mouse_x=%3d,mouse_y=%3d", mouse_x, mouse_y );
textprintf_ex( bufor, font, 50, 140, makecol( 255, 255, 255 ), - 1, "pasek=%3d,clik=%d,kat=%3d", pas, mouse_b, kat );
blit( bufor, screen, 0, 0, 0, 0, 800, 600 );
}
destroy_bitmap( trawa );
destroy_bitmap( pasek );
destroy_bitmap( domek );
destroy_bitmap( bufor );
destroy_bitmap( kursor );
destroy_bitmap( kolanko );
allegro_exit();
return 0;
}
END_OF_MAIN();