You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!!!
}
This is a great find. Funny I missed that, but I probably didn't notice it since I always used GetButtonState instead of the GetButtonValue function, which would work correctly because of the tests against 0 instead of 1.
Activity
chalonverse commentedon Apr 9, 2022
This is a great find. Funny I missed that, but I probably didn't notice it since I always used GetButtonState instead of the GetButtonValue function, which would work correctly because of the tests against 0 instead of 1.
Chapter 1 mac
Fixed bug in GetButtonValue