Need some help with creating a simple Tic Tac Toe game in Dark GDK
I have an assignment from the array and tile mapping chapter in my lesson which calls for me to creat a game that allows two players to play a game of Tic Tac Toe. The program should allow the players to use the mouse to click a location on the Tic Tac Toe board to place the X and O. The program will determine who has won or whether or not a tie has occurred. I have already written the code to display the board along with some void functions.
bool mouseFullClick(int &, int &);
void DarkGDK ( void )
int x = dbMouseX()/dbScreenWidth()/3;
int y = dbMouseY()/dbScreenHeight()/3;
int turn =1;
const int row = 2;
const int column =2;
//Draws the board
//Disable the auto refresh and set the
// Game loop
while ( LoopGDK() )
//Framework for turn order
//Refresh the screen.
//Waits for user to press a key
bool mouseFullClick(int &, int &)
// Variable to hold the return value.
bool buttonClick = false;
// If the mouse button is pressed, process
// a full clicking action.
if ( dbMouseClick() == 1 )
// Get the mouse pointer coordinates.
int x = dbMouseX();
int y = dbMouseY();
// Wait for the user to release the
// mouse button.
while ( dbMouseClick() == 1)
// Do nothing in this loop.
// Set buttonClick to true.
buttonClick = true;
// Return true or false to indicate whether the
// mouse was clicked.
What I need assistance with is the actual placing of board locations in an array. Also trying to figure out whether I need two Draw functions for the placement of the X and O, or just one function. If I could get some help with pointing me in the right direction that would be highly appreciated.
Related Article:any c++ games you know?
is a Game Development discussion thread by king03 that has 1 reply, was last updated 1 year ago and has been tagged with the keywords: c++.