summaryrefslogtreecommitdiff
path: root/src/citra_qt/bootmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-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() {
191} 191}
192 192
193void GRenderWindow::closeEvent(QCloseEvent* event) { 193void GRenderWindow::closeEvent(QCloseEvent* event) {
194 motion_emu = nullptr;
194 emit Closed(); 195 emit Closed();
195 QWidget::closeEvent(event); 196 QWidget::closeEvent(event);
196} 197}
@@ -204,11 +205,13 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event) {
204} 205}
205 206
206void GRenderWindow::mousePressEvent(QMouseEvent* event) { 207void GRenderWindow::mousePressEvent(QMouseEvent* event) {
208 auto pos = event->pos();
207 if (event->button() == Qt::LeftButton) { 209 if (event->button() == Qt::LeftButton) {
208 auto pos = event->pos();
209 qreal pixelRatio = windowPixelRatio(); 210 qreal pixelRatio = windowPixelRatio();
210 this->TouchPressed(static_cast<unsigned>(pos.x() * pixelRatio), 211 this->TouchPressed(static_cast<unsigned>(pos.x() * pixelRatio),
211 static_cast<unsigned>(pos.y() * pixelRatio)); 212 static_cast<unsigned>(pos.y() * pixelRatio));
213 } else if (event->button() == Qt::RightButton) {
214 motion_emu->BeginTilt(pos.x(), pos.y());
212 } 215 }
213} 216}
214 217
@@ -217,11 +220,14 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
217 qreal pixelRatio = windowPixelRatio(); 220 qreal pixelRatio = windowPixelRatio();
218 this->TouchMoved(std::max(static_cast<unsigned>(pos.x() * pixelRatio), 0u), 221 this->TouchMoved(std::max(static_cast<unsigned>(pos.x() * pixelRatio), 0u),
219 std::max(static_cast<unsigned>(pos.y() * pixelRatio), 0u)); 222 std::max(static_cast<unsigned>(pos.y() * pixelRatio), 0u));
223 motion_emu->Tilt(pos.x(), pos.y());
220} 224}
221 225
222void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { 226void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
223 if (event->button() == Qt::LeftButton) 227 if (event->button() == Qt::LeftButton)
224 this->TouchReleased(); 228 this->TouchReleased();
229 else if (event->button() == Qt::RightButton)
230 motion_emu->EndTilt();
225} 231}
226 232
227void GRenderWindow::ReloadSetKeymaps() { 233void GRenderWindow::ReloadSetKeymaps() {
@@ -279,11 +285,13 @@ void GRenderWindow::OnMinimalClientAreaChangeRequest(
279} 285}
280 286
281void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread) { 287void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread) {
288 motion_emu = std::make_unique<Motion::MotionEmu>(*this);
282 this->emu_thread = emu_thread; 289 this->emu_thread = emu_thread;
283 child->DisablePainting(); 290 child->DisablePainting();
284} 291}
285 292
286void GRenderWindow::OnEmulationStopping() { 293void GRenderWindow::OnEmulationStopping() {
294 motion_emu = nullptr;
287 emu_thread = nullptr; 295 emu_thread = nullptr;
288 child->EnablePainting(); 296 child->EnablePainting();
289} 297}