do touchscreen input more properly

This commit is contained in:
Arisotura
2024-10-31 22:10:25 +01:00
parent 1b8daa0465
commit f3bd58f75e
4 changed files with 34 additions and 14 deletions

View File

@ -258,8 +258,7 @@ void ScreenPanel::mousePressEvent(QMouseEvent* event)
if (layout.GetTouchCoords(x, y, false))
{
touching = true;
assert(emuInstance->getNDS() != nullptr);
emuInstance->getNDS()->TouchScreen(x, y);
emuInstance->touchScreen(x, y);
}
}
@ -272,8 +271,7 @@ void ScreenPanel::mouseReleaseEvent(QMouseEvent* event)
if (touching)
{
touching = false;
assert(emuInstance->getNDS() != nullptr);
emuInstance->getNDS()->ReleaseScreen();
emuInstance->releaseScreen();
}
}
@ -292,8 +290,7 @@ void ScreenPanel::mouseMoveEvent(QMouseEvent* event)
if (layout.GetTouchCoords(x, y, true))
{
assert(emuInstance->getNDS() != nullptr);
emuInstance->getNDS()->TouchScreen(x, y);
emuInstance->touchScreen(x, y);
}
}
@ -318,16 +315,14 @@ void ScreenPanel::tabletEvent(QTabletEvent* event)
if (layout.GetTouchCoords(x, y, event->type()==QEvent::TabletMove))
{
touching = true;
assert(emuInstance->getNDS() != nullptr);
emuInstance->getNDS()->TouchScreen(x, y);
emuInstance->touchScreen(x, y);
}
}
break;
case QEvent::TabletRelease:
if (touching)
{
assert(emuInstance->getNDS() != nullptr);
emuInstance->getNDS()->ReleaseScreen();
emuInstance->releaseScreen();
touching = false;
}
break;
@ -365,16 +360,14 @@ void ScreenPanel::touchEvent(QTouchEvent* event)
if (layout.GetTouchCoords(x, y, event->type()==QEvent::TouchUpdate))
{
touching = true;
assert(emuInstance->getNDS() != nullptr);
emuInstance->getNDS()->TouchScreen(x, y);
emuInstance->touchScreen(x, y);
}
}
break;
case QEvent::TouchEnd:
if (touching)
{
assert(emuInstance->getNDS() != nullptr);
emuInstance->getNDS()->ReleaseScreen();
emuInstance->releaseScreen();
touching = false;
}
break;