mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:21:16 +02:00
Android - Make it possible to look around and move with touchscreen controls. Zoom-in not in 'My View' mode.
This commit is contained in:
parent
3f762c7900
commit
321896142c
2 changed files with 17 additions and 10 deletions
|
@ -20,9 +20,10 @@
|
||||||
InputPluginList getInputPlugins() {
|
InputPluginList getInputPlugins() {
|
||||||
InputPlugin* PLUGIN_POOL[] = {
|
InputPlugin* PLUGIN_POOL[] = {
|
||||||
new KeyboardMouseDevice(),
|
new KeyboardMouseDevice(),
|
||||||
new TouchscreenDevice(),
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
new TouchscreenVirtualPadDevice(),
|
new TouchscreenVirtualPadDevice(),
|
||||||
|
#else
|
||||||
|
new TouchscreenDevice(), // Touchscreen and Controller Scripts take care on Android
|
||||||
#endif
|
#endif
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
|
@ -262,22 +262,28 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) {
|
||||||
const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
|
const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
|
||||||
bool leftTouchFound = false;
|
bool leftTouchFound = false;
|
||||||
bool rightTouchFound = false;
|
bool rightTouchFound = false;
|
||||||
|
glm::vec2 thisPoint;
|
||||||
for (int i = 0; i < _touchPointCount; ++i) {
|
for (int i = 0; i < _touchPointCount; ++i) {
|
||||||
glm::vec2 thisPoint(tPoints[i].pos().x(), tPoints[i].pos().y());
|
thisPoint.x = tPoints[i].pos().x();
|
||||||
if (_validTouchLeft) {
|
thisPoint.y = tPoints[i].pos().y();
|
||||||
leftTouchFound = true;
|
// left side and the first one detected counts
|
||||||
touchLeftUpdate(thisPoint);
|
if (thisPoint.x < _screenWidthCenter && !leftTouchFound) {
|
||||||
} else if (touchLeftBeginPointIsValid(thisPoint)) {
|
if (_validTouchLeft) {
|
||||||
if (!leftTouchFound) {
|
// valid if it's an ongoing touch
|
||||||
leftTouchFound = true;
|
leftTouchFound = true;
|
||||||
touchLeftBegin(thisPoint);
|
touchLeftUpdate(thisPoint);
|
||||||
}
|
} else if (touchLeftBeginPointIsValid(thisPoint)) {
|
||||||
} else {
|
// valid if it's start point is valid
|
||||||
|
leftTouchFound = true;
|
||||||
|
touchLeftBegin(thisPoint);
|
||||||
|
} // if it wasn't even a valid starting point, it won't count as left touch valid
|
||||||
|
} else if (thisPoint.x >= _screenWidthCenter) { // right side
|
||||||
if (!rightTouchFound) {
|
if (!rightTouchFound) {
|
||||||
rightTouchFound = true;
|
rightTouchFound = true;
|
||||||
if (!_validTouchRight) {
|
if (!_validTouchRight) {
|
||||||
touchRightBegin(thisPoint);
|
touchRightBegin(thisPoint);
|
||||||
} else {
|
} else {
|
||||||
|
// as we don't have a stick on the right side, there is no condition to process right touch
|
||||||
touchRightUpdate(thisPoint);
|
touchRightUpdate(thisPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue