Serious bug in mouse button detection
Hello, first of all I really thank you for writing this book. When I was doing the camera part I noticed the weird behaviour of mouse detection in the InputSystem, turns out it's wrong to test equality for mouse button because valid result should be non-negative but doesn't guarantee 1.
bool MouseState::GetButtonValue(int button) const
{
return (SDL_BUTTON(button) & mCurrButtons) == 1; // Will not work!!!
}
The correct code should be
bool MouseState::GetButtonValue(int button) const
{
return (SDL_BUTTON(button) & mCurrButtons);
}