nyfan68 0 Newbie Poster

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.

#include "DarkGDK.h"

void Draw();
void Input();
void CheckforWin();
bool mouseFullClick(int &, int &);
void DarkGDK ( void )
    //Mouse points
    int x = dbMouseX()/dbScreenWidth()/3;
    int y = dbMouseY()/dbScreenHeight()/3;

    //Player turn
    int turn =1;

    //Board Array
    const int row = 2;
    const int column =2;
    int board[row][column];

    //Draws the board

    //Disable the auto refresh and set the
    //Refresh rate.

   // Game loop
    while ( LoopGDK() )
   // {
      //Framework for turn order

         //Refresh the screen.

   //Waits for user to press a key
void Draw()

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.
    return buttonClick;

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.