File: mouse.cpp

package info (click to toggle)
libretro-bsnes-mercury 094%2Bgit20160126-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 9,636 kB
  • sloc: cpp: 109,056; ansic: 3,097; makefile: 638; xml: 11; sh: 1
file content (18 lines) | stat: -rw-r--r-- 460 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
namespace phoenix {

Position pMouse::position() {
  POINT point = {0};
  GetCursorPos(&point);
  return {point.x, point.y};
}

bool pMouse::pressed(Mouse::Button button) {
  switch(button) {
  case Mouse::Button::Left: return GetAsyncKeyState(VK_LBUTTON) & 0x8000;
  case Mouse::Button::Middle: return GetAsyncKeyState(VK_MBUTTON) & 0x8000;
  case Mouse::Button::Right: return GetAsyncKeyState(VK_RBUTTON) & 0x8000;
  }
  return false;
}

}