I am working on a checkers game using glut and c++. I have a problem with the drag and drop of pieces. I able to drag and drop a piece from lower center to the upper right but it also drag and drops from center to upper left, I want it to only drag and drop form center to upper right and not to the upper left. here is the code I am using I have solved half of my problem.
void black_piece()
{
if (board[5][1] == 1)
{
drawScene_move();
}
if (board[4][0] == 1)
{
drawScene_move_one();
move_piece = true;
}
if (move_piece == false && board[4][2] == 1)
{
drawScene_move_two();
}
}
void mouseMotion(int x, int y)
{
if (y <= 180)
{
y = 180;
}
if (x <= 240)
{
x = 240;
}
if (y >= 420)
{
y = 420;
}
if (x >= 560)
{
x = 560;
}
board[(y - 180) / 30][(x - 240) / 40] = 1;
cout << x << " " << y << endl;
black_piece();
glFlush();
}