#include <allegro.h>
BITMAP * button1 = NULL,
* button2 = NULL,
* bufor = NULL;
int menu()
{
if( key[ KEY_T ] )
{
clear_to_color( bufor, makecol( 150, 150, 150 ) );
blit( button2, screen, 0, 0, 50, 300, button2->w, button2->h );
blit( screen, bufor, 0, 0, 0, 0, 800, 600 );
}
else
{
clear_to_color( bufor, makecol( 150, 150, 150 ) );
masked_blit( button1, screen, 0, 0, 50, 300, button1->w, button1->h );
blit( screen, bufor, 0, 0, 0, 0, 800, 600 );
}
if( key[ KEY_G ] )
{
clear_to_color( bufor, makecol( 150, 150, 150 ) );
masked_blit( button2, screen, 0, 0, 50, 360, button2->w, button2->h );
blit( screen, bufor, 0, 0, 0, 0, 800, 600 );
}
else
{
clear_to_color( bufor, makecol( 150, 150, 150 ) );
masked_blit( button1, screen, 0, 0, 50, 360, button1->w, button1->h );
blit( screen, bufor, 0, 0, 0, 0, 800, 600 );
}
if( key[ KEY_Y ] )
{
clear_to_color( bufor, makecol( 150, 150, 150 ) );
masked_blit( button2, screen, 0, 0, 50, 420, button2->w, button2->h );
blit( screen, bufor, 0, 0, 0, 0, 800, 600 );
}
else
{
clear_to_color( bufor, makecol( 150, 150, 150 ) );
masked_blit( button1, screen, 0, 0, 50, 420, button1->w, button1->h );
blit( screen, bufor, 0, 0, 0, 0, 800, 600 );
}
if( key[ KEY_H ] )
{
clear_to_color( bufor, makecol( 150, 150, 150 ) );
masked_blit( button2, screen, 0, 0, 50, 480, button2->w, button2->h );
blit( screen, bufor, 0, 0, 0, 0, 800, 600 );
}
else
{
clear_to_color( bufor, makecol( 150, 150, 150 ) );
masked_blit( button1, screen, 0, 0, 50, 480, button1->w, button1->h );
blit( screen, bufor, 0, 0, 0, 0, 800, 600 );;
}
}
int przebieg()
{
while( !key[ KEY_ESC ] )
{
menu();
}
}
int main()
{
allegro_init();
install_keyboard();
install_mouse();
set_color_depth( 16 );
set_gfx_mode( GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0 );
enable_hardware_cursor();
select_mouse_cursor( MOUSE_CURSOR_ALLEGRO );
show_mouse( screen );
unscare_mouse();
clear_to_color( screen, makecol( 150, 150, 150 ) );
bufor = create_bitmap( 800, 600 );
button1 = load_bmp( "button1.bmp", default_palette );
button2 = load_bmp( "button2.bmp", default_palette );
przebieg();
destroy_bitmap( button1 );
destroy_bitmap( button2 );
destroy_bitmap( bufor );
allegro_exit();
return 0;
}
END_OF_MAIN();