fix pissfucking touchscreen (again)
This commit is contained in:
parent
2df6b4fdc3
commit
bba14b2bb0
|
@ -156,7 +156,7 @@ int GetScreenTransforms(float* out, int* kind);
|
||||||
|
|
||||||
// de-transform the provided host display coordinates to get coordinates
|
// de-transform the provided host display coordinates to get coordinates
|
||||||
// on the bottom screen
|
// on the bottom screen
|
||||||
bool GetTouchCoords(int& x, int& y);
|
bool GetTouchCoords(int& x, int& y, bool clamp);
|
||||||
|
|
||||||
|
|
||||||
// initialize the audio utility
|
// initialize the audio utility
|
||||||
|
|
|
@ -467,31 +467,31 @@ int GetScreenTransforms(float* out, int* kind)
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetTouchCoords(int& x, int& y)
|
bool GetTouchCoords(int& x, int& y, bool clamp)
|
||||||
{
|
{
|
||||||
if (BotEnable)
|
|
||||||
{
|
|
||||||
float vx = x;
|
float vx = x;
|
||||||
float vy = y;
|
float vy = y;
|
||||||
|
|
||||||
|
if (BotEnable)
|
||||||
|
{
|
||||||
M23_Transform(TouchMtx, vx, vy);
|
M23_Transform(TouchMtx, vx, vy);
|
||||||
|
|
||||||
x = (int)vx;
|
|
||||||
y = (int)vy;
|
|
||||||
|
|
||||||
if (vx >= 0 && vx < 256 && vy >= 0 && vy < 192)
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else if (HybEnable && HybScreen == 1)
|
else if (HybEnable && HybScreen == 1)
|
||||||
{
|
{
|
||||||
float vx = x;
|
|
||||||
float vy = y;
|
|
||||||
|
|
||||||
M23_Transform(HybTouchMtx, vx, vy);
|
M23_Transform(HybTouchMtx, vx, vy);
|
||||||
|
}
|
||||||
|
|
||||||
x = (int)vx;
|
x = (int)vx;
|
||||||
y = (int)vy;
|
y = (int)vy;
|
||||||
|
|
||||||
|
if (clamp)
|
||||||
|
{
|
||||||
|
x = std::clamp(x, 0, 255);
|
||||||
|
y = std::clamp(y, 0, 191);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (x >= 0 && x < 256 && y >= 0 && y < 192)
|
if (x >= 0 && x < 256 && y >= 0 && y < 192)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -783,7 +783,7 @@ void ScreenHandler::screenOnMousePress(QMouseEvent* event)
|
||||||
int x = event->pos().x();
|
int x = event->pos().x();
|
||||||
int y = event->pos().y();
|
int y = event->pos().y();
|
||||||
|
|
||||||
if (Frontend::GetTouchCoords(x, y))
|
if (Frontend::GetTouchCoords(x, y, false))
|
||||||
{
|
{
|
||||||
touching = true;
|
touching = true;
|
||||||
NDS::TouchScreen(x, y);
|
NDS::TouchScreen(x, y);
|
||||||
|
@ -814,7 +814,7 @@ void ScreenHandler::screenOnMouseMove(QMouseEvent* event)
|
||||||
int x = event->pos().x();
|
int x = event->pos().x();
|
||||||
int y = event->pos().y();
|
int y = event->pos().y();
|
||||||
|
|
||||||
if (Frontend::GetTouchCoords(x, y))
|
if (Frontend::GetTouchCoords(x, y, true))
|
||||||
NDS::TouchScreen(x, y);
|
NDS::TouchScreen(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,7 +830,7 @@ void ScreenHandler::screenHandleTablet(QTabletEvent* event)
|
||||||
int x = event->x();
|
int x = event->x();
|
||||||
int y = event->y();
|
int y = event->y();
|
||||||
|
|
||||||
if (Frontend::GetTouchCoords(x, y))
|
if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TabletMove))
|
||||||
{
|
{
|
||||||
touching = true;
|
touching = true;
|
||||||
NDS::TouchScreen(x, y);
|
NDS::TouchScreen(x, y);
|
||||||
|
@ -861,7 +861,7 @@ void ScreenHandler::screenHandleTouch(QTouchEvent* event)
|
||||||
int x = (int)lastPosition.x();
|
int x = (int)lastPosition.x();
|
||||||
int y = (int)lastPosition.y();
|
int y = (int)lastPosition.y();
|
||||||
|
|
||||||
if (Frontend::GetTouchCoords(x, y))
|
if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TouchUpdate))
|
||||||
{
|
{
|
||||||
touching = true;
|
touching = true;
|
||||||
NDS::TouchScreen(x, y);
|
NDS::TouchScreen(x, y);
|
||||||
|
|
Loading…
Reference in New Issue