phoenix/windows/mouse.cpp
raw| 1 | namespace phoenix { |
| 2 | |
| 3 | Position pMouse::position() { |
| 4 | POINT point = {0}; |
| 5 | GetCursorPos(&point); |
| 6 | return {point.x, point.y}; |
| 7 | } |
| 8 | |
| 9 | bool pMouse::pressed(Mouse::Button button) { |
| 10 | switch(button) { |
| 11 | case Mouse::Button::Left: return GetAsyncKeyState(VK_LBUTTON) & 0x8000; |
| 12 | case Mouse::Button::Middle: return GetAsyncKeyState(VK_MBUTTON) & 0x8000; |
| 13 | case Mouse::Button::Right: return GetAsyncKeyState(VK_RBUTTON) & 0x8000; |
| 14 | } |
| 15 | return false; |
| 16 | } |
| 17 | |
| 18 | } |