To moze ja wklepie caly kod i sami sie przekonacie co jest grane..
#include <allegro.h>
int main()
{
int plansza[ 3 ][ 3 ] = { { 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 } };
allegro_init();
install_mouse();
install_keyboard();
set_color_depth( 16 );
set_gfx_mode( GFX_AUTODETECT_WINDOWED, 452, 450, 0, 0 );
BITMAP * lal = NULL;
BITMAP * gal = NULL;
BITMAP * bufor = NULL;
bufor = create_bitmap( 450, 450 );
show_mouse( screen );
set_window_title( "KOLKO I KRZYZYK !!" );
lal = load_bmp( "cross.bmp", default_palette );
gal = load_bmp( "circle.bmp", default_palette );
while( !key[ KEY_ESC ] )
{
line( bufor, 0, 150, 450, 150, makecol( 255, 0, 0 ) );
line( bufor, 0, 300, 450, 300, makecol( 255, 0, 0 ) );
line( bufor, 150, 0, 150, 450, makecol( 255, 0, 0 ) );
line( bufor, 300, 0, 300, 450, makecol( 255, 0, 0 ) );
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
do
{
if( mouse_b & 1 && mouse_x < 150 && mouse_y < 150 )
{
blit( lal, bufor, 0, 30, 0, 35, 150, 180 ); plansza[ 0 ][ 0 ] = 1;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 1 && mouse_x > 150 && mouse_x < 300 && mouse_y < 150 )
{
blit( lal, bufor, - 60, 30, 100, 35, 180, 180 ); plansza[ 0 ][ 1 ] = 1;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 1 && mouse_x > 300 && mouse_y < 150 )
{
blit( lal, bufor, - 60, 30, 250, 35, 180, 180 ); plansza[ 0 ][ 2 ] = 1;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 1 && mouse_x < 150 && mouse_y < 300 && mouse_y > 150 )
{
blit( lal, bufor, 0, 30, 0, 190, 150, 180 ); plansza[ 1 ][ 0 ] = 1;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 1 && mouse_x > 150 && mouse_x < 300 && mouse_y < 300 && mouse_y > 150 )
{
blit( lal, bufor, - 60, 30, 100, 190, 180, 180 ); plansza[ 1 ][ 1 ] = 1;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 1 && mouse_x > 300 && mouse_y < 300 && mouse_y > 150 )
{
blit( lal, bufor, - 60, 30, 250, 190, 180, 180 ); plansza[ 1 ][ 2 ] = 1;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 1 && mouse_x < 150 && mouse_y > 300 )
{
blit( lal, bufor, 0, 30, 0, 340, 150, 180 ); plansza[ 2 ][ 0 ] = 1;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 1 && mouse_x > 150 && mouse_x < 300 && mouse_y > 300 )
{
blit( lal, bufor, - 60, 30, 100, 340, 180, 180 ); plansza[ 2 ][ 1 ] = 1;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 1 && mouse_x > 300 && mouse_y > 300 )
{
blit( lal, bufor, - 60, 30, 250, 340, 180, 180 ); plansza[ 2 ][ 2 ] = 1;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
} while( !( mouse_b & 1 ) );
do
{
if( mouse_b & 2 && mouse_x < 150 && mouse_y < 150 )
{
blit( gal, bufor, 0, 30, 0, 35, 150, 180 ); plansza[ 0 ][ 0 ] = 2;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 2 && mouse_x > 150 && mouse_x < 300 && mouse_y < 150 )
{
blit( gal, bufor, - 60, 30, 100, 35, 180, 180 ); plansza[ 0 ][ 1 ] = 2;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 2 && mouse_x > 300 && mouse_y < 150 )
{
blit( gal, bufor, - 60, 30, 250, 35, 180, 180 ); plansza[ 0 ][ 2 ] = 2;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 2 && mouse_x < 150 && mouse_y < 300 && mouse_y > 150 )
{
blit( gal, bufor, 0, 30, 0, 190, 150, 180 ); plansza[ 1 ][ 0 ] = 2;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 2 && mouse_x > 150 && mouse_x < 300 && mouse_y < 300 && mouse_y > 150 )
{
blit( gal, bufor, - 60, 30, 100, 190, 180, 180 ); plansza[ 1 ][ 1 ] = 2;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 2 && mouse_x > 300 && mouse_y < 300 && mouse_y > 150 )
{
blit( gal, bufor, - 60, 30, 250, 190, 180, 180 ); plansza[ 1 ][ 2 ] = 2;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 2 && mouse_x < 150 && mouse_y > 300 )
{
blit( gal, bufor, 0, 30, 0, 340, 150, 180 ); plansza[ 2 ][ 0 ] = 2;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 2 && mouse_x > 150 && mouse_x < 300 && mouse_y > 300 )
{
blit( gal, bufor, - 60, 30, 100, 340, 180, 180 ); plansza[ 2 ][ 1 ] = 2;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
if( mouse_b & 2 && mouse_x > 300 && mouse_y > 300 )
{
blit( gal, bufor, - 60, 30, 250, 340, 180, 180 ); plansza[ 2 ][ 3 ] = 2;
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
} while( !( mouse_b & 2 ) );
blit( bufor, screen, 0, 0, 0, 0, 450, 450 );
}
destroy_bitmap( lal );
destroy_bitmap( gal );
destroy_bitmap( bufor );
allegro_exit();
return 0;
}
END_OF_MAIN();
+ oczywiscie jakies 2 rysunki przedstawiajace kolko i krzyzyk ale to juz mysle zaden problem.