mouse.cpp 500 B

1234567891011121314151617181920212223
  1. #if defined(Hiro_Mouse)
  2. namespace hiro {
  3. auto pMouse::position() -> Position {
  4. QPoint point = QCursor::pos();
  5. return {point.x(), point.y()};
  6. }
  7. auto pMouse::pressed(Mouse::Button button) -> bool {
  8. Qt::MouseButtons buttons = QApplication::mouseButtons();
  9. switch(button) {
  10. case Mouse::Button::Left: return buttons & Qt::LeftButton;
  11. case Mouse::Button::Middle: return buttons & Qt::MidButton;
  12. case Mouse::Button::Right: return buttons & Qt::RightButton;
  13. }
  14. return false;
  15. }
  16. }
  17. #endif