Platform/Win32/Win32Mouse: implement isButtonDown() using GetAsyncKeyState() and remove m_state and m_tracked.
This commit is contained in:
parent
c7c1ff68fd
commit
290c6643f5
2 changed files with 12 additions and 7 deletions
|
|
@ -26,8 +26,6 @@ static RECT GetClientArea(HWND hwnd) {
|
|||
|
||||
void Win32Mouse::init()
|
||||
{
|
||||
memset(m_state, 0, Mouse::Button::NUM_MBUTTONS);
|
||||
m_tracked = false;
|
||||
}
|
||||
|
||||
Vector2f Win32Mouse::getPosition() const
|
||||
|
|
@ -37,7 +35,18 @@ Vector2f Win32Mouse::getPosition() const
|
|||
|
||||
bool Win32Mouse::isButtonDown(Mouse::Button button) const
|
||||
{
|
||||
return m_state[button];
|
||||
int btn;
|
||||
|
||||
switch(button) {
|
||||
case Mouse::Left : btn = VK_LBUTTON; break;
|
||||
case Mouse::Right : btn = VK_RBUTTON; break;
|
||||
case Mouse::Middle : btn = VK_MBUTTON; break;
|
||||
case Mouse::Button1 : btn = VK_XBUTTON1; break;
|
||||
case Mouse::Button2 : btn = VK_XBUTTON2; break;
|
||||
default: btn = 0;
|
||||
}
|
||||
|
||||
return ::GetAsyncKeyState(btn) & 0x8000;
|
||||
}
|
||||
|
||||
void Win32Mouse::update(InputModule *input)
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@ protected :
|
|||
|
||||
protected :
|
||||
Vector2f m_position;
|
||||
|
||||
bool m_state[Mouse::Button::NUM_MBUTTONS];
|
||||
|
||||
bool m_tracked;
|
||||
};
|
||||
|
||||
} // namespace sp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue