I’m working on an OO windows chess game w/ VS 2005 using DirectX 9.0. I have everything finished (excluding AI and En Passant). Right now I’m trying to tackle Direct Input. I’m using the right mouse button to “take back” moves. The problem is when you right click, 4 or 5 moves are taken back, for each iteration on the game loop. Is there a test expression I can use for checking when the right mouse button is released instead of being pressed?
Code:
#define BUTTON_DOWN(obj, button) (obj.rgbButtons[button] & 0x80)
DIMOUSESTATE mouse_state;
int Mouse_Button(int button)
{
return BUTTON_DOWN(mouse_state, button);
}
if (Mouse_Button(1)){Code for take back move}
EDIT:
I made a quick fix.
Code:
static bool release = false;
if (Mouse_Button(1))
{
release = true;
}
else if (release)
{
chessboard.unmakeMove();
release = false;
}