1) Use a sprite for your cursor instead of the regular cursor
2) use 3 images ( blank cell, black cell, white cell )
3) test for collision
#include "DarkGDK.h"
// prototype for control function
void playgame( void );
// hide mouse
dbHideMouse();
//Setup The window
dbSyncOn(); // Turn sync on
dbSyncRate( 60 ); // 60 frames per second
if ( dbCheckDisplayMode( 800, 600, 32) ) // display mode
dbSetDisplayMode ( 800, 600, 32);
//Load Image of new cursor
dbLoadImage("cursorname.bmp", 1);
//Load Images for cells
dbLoadImage("_bcell.bmp", 2 );
dbLoadImage("blcell.bmp", 3 );
dbLoadImage("wcell.bmp", 4 );
// who's turn is it?
int playerid = 1; // 1 is first player 2 is second player
void DarkGDK( void )
{
// put blank cells on the board
for ( int i = 1; i < 4; i++ )
{
for ( int j = 1; j < 4; j++ )
{
dbSprite( 3*(i-1)+j, i*150, j*150, 2 )
}
}
while (loopgdk)
{
// get x and y of mouse
int x = dbMousePositionX();
int y = dbMousePositionY();
// get Mouse click
mc = dbMouseClick();
// put sprite at the x and y coords
dbSprite( 1, x, y, 1 );
//Test for mouse click
if ( mc )
{
playgame();
}
}
}
void playgame( void )
{
for ( int i = 1; i < 10; i++ )
{
if ( dbSpriteCollision( 1, i )
{
dbSprite( i, dbSpritePositionX( i ), dbSpritePositionY( i ), playerid + 2 );
playerid = 3 - playerid;
}
}
}
This is psuedo code, you will have to make SEVERAL alterations I just wanted to outline a method for creating images on the screen that you can click and alter. If you have any questions just ask and i will explain more. I will not do your homework for you though
EYE R T3H +ick +ack +oe mester