summaryrefslogtreecommitdiffstats
path: root/src/citra_qt/bootmanager.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-01-07 18:39:20 +0100
committerGitHub <noreply@github.com>2017-01-07 18:39:20 +0100
commit7cfe3ef0463ace034b1e5786c9581cfa5f2e810c (patch)
tree6b06cb03d276b29070ca29599fc4c5fcf77edb39 /src/citra_qt/bootmanager.cpp
parentMerge pull request #2410 from Subv/sleepthread (diff)
parentFrontend: make motion sensor interfaced thread-safe (diff)
downloadyuzu-7cfe3ef0463ace034b1e5786c9581cfa5f2e810c.tar
yuzu-7cfe3ef0463ace034b1e5786c9581cfa5f2e810c.tar.gz
yuzu-7cfe3ef0463ace034b1e5786c9581cfa5f2e810c.tar.bz2
yuzu-7cfe3ef0463ace034b1e5786c9581cfa5f2e810c.tar.lz
yuzu-7cfe3ef0463ace034b1e5786c9581cfa5f2e810c.tar.xz
yuzu-7cfe3ef0463ace034b1e5786c9581cfa5f2e810c.tar.zst
yuzu-7cfe3ef0463ace034b1e5786c9581cfa5f2e810c.zip
Diffstat (limited to 'src/citra_qt/bootmanager.cpp')
-rw-r--r--src/citra_qt/bootmanager.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 59cb1b1bc..948db384d 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -191,6 +191,7 @@ qreal GRenderWindow::windowPixelRatio() {
}
void GRenderWindow::closeEvent(QCloseEvent* event) {
+ motion_emu = nullptr;
emit Closed();
QWidget::closeEvent(event);
}
@@ -204,11 +205,13 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event) {
}
void GRenderWindow::mousePressEvent(QMouseEvent* event) {
+ auto pos = event->pos();
if (event->button() == Qt::LeftButton) {
- auto pos = event->pos();
qreal pixelRatio = windowPixelRatio();
this->TouchPressed(static_cast<unsigned>(pos.x() * pixelRatio),
static_cast<unsigned>(pos.y() * pixelRatio));
+ } else if (event->button() == Qt::RightButton) {
+ motion_emu->BeginTilt(pos.x(), pos.y());
}
}
@@ -217,11 +220,14 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
qreal pixelRatio = windowPixelRatio();
this->TouchMoved(std::max(static_cast<unsigned>(pos.x() * pixelRatio), 0u),
std::max(static_cast<unsigned>(pos.y() * pixelRatio), 0u));
+ motion_emu->Tilt(pos.x(), pos.y());
}
void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
if (event->button() == Qt::LeftButton)
this->TouchReleased();
+ else if (event->button() == Qt::RightButton)
+ motion_emu->EndTilt();
}
void GRenderWindow::ReloadSetKeymaps() {
@@ -279,11 +285,13 @@ void GRenderWindow::OnMinimalClientAreaChangeRequest(
}
void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread) {
+ motion_emu = std::make_unique<Motion::MotionEmu>(*this);
this->emu_thread = emu_thread;
child->DisablePainting();
}
void GRenderWindow::OnEmulationStopping() {
+ motion_emu = nullptr;
emu_thread = nullptr;
child->EnablePainting();
}