diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d806a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/src/QtScrcpy.pro.user +/output/debug/*.pdb +/output/debug/*.ilk +/output/debug/QtScrcpy.exe +/output/release/QtScrcpy.exe diff --git a/src/inputcontrol/inputconvertgame.cpp b/src/inputcontrol/inputconvertgame.cpp index c0f5777..c4cde8d 100644 --- a/src/inputcontrol/inputconvertgame.cpp +++ b/src/inputcontrol/inputconvertgame.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "inputconvertgame.h" @@ -46,7 +47,7 @@ void InputConvertGame::keyEvent(const QKeyEvent *from, const QSize& frameSize, c switch (from->key()) { case Qt::Key_QuoteLeft: if (QEvent::KeyPress == from->type()) { - m_gameMap = !m_gameMap; + switchGameMap(); } return; } @@ -266,10 +267,12 @@ bool InputConvertGame::processKeyClick(const QKeyEvent *from) clickPos = QPointF(0.96f, 0.7f); break; case Qt::Key_M: // 地图 + switchGameMap(); clickPos = QPointF(0.98f, 0.03f); break; case Qt::Key_Tab: // 背包 clickPos = QPointF(0.06f, 0.9f); + switchGameMap(); break; case Qt::Key_Z: // 趴 clickPos = QPointF(0.95f, 0.9f); @@ -432,6 +435,22 @@ void InputConvertGame::mouseMoveStopTouch() } } +void InputConvertGame::switchGameMap() +{ + m_gameMap = !m_gameMap; + grabCursor(m_gameMap); +} + +void InputConvertGame::grabCursor(bool grab) +{ + if(grab) { + QGuiApplication::setOverrideCursor(QCursor(Qt::BlankCursor)); + } else { + mouseMoveStopTouch(); + QGuiApplication::restoreOverrideCursor(); + } +} + void InputConvertGame::timerEvent(QTimerEvent *event) { if (m_mouseMoveTimer == event->timerId()) { diff --git a/src/inputcontrol/inputconvertgame.h b/src/inputcontrol/inputconvertgame.h index e15dace..dab9ec2 100644 --- a/src/inputcontrol/inputconvertgame.h +++ b/src/inputcontrol/inputconvertgame.h @@ -47,6 +47,9 @@ protected: void mouseMoveStartTouch(const QMouseEvent* from); void mouseMoveStopTouch(); + void switchGameMap(); + void grabCursor(bool grab); + protected: void timerEvent(QTimerEvent *event);