diff --git a/src/Magnum/Platform/AndroidApplication.cpp b/src/Magnum/Platform/AndroidApplication.cpp index a8f685ad1..9b76a8c5b 100644 --- a/src/Magnum/Platform/AndroidApplication.cpp +++ b/src/Magnum/Platform/AndroidApplication.cpp @@ -264,12 +264,11 @@ std::int32_t AndroidApplication::inputEvent(android_app* state, AInputEvent* eve // (for what if we have a pointerIndex? // They are a bit different. // Pointer id saves the order of touch events, - // so if you would _release_ fingers in various orders, + // so if you would release fingers in various orders, // the 'pointerId' will have the value of initial 'pointerIndex', which might be useful. // Btw, somehow 'pointerId' does not tell you the last released touch initial index --- // --- no, 'pointerId' actually tells it, but in AMOTION_EVENT_ACTION_UP|DOWN case) std::int32_t pointerId = AMotionEvent_getPointerId(event, pointerIndex); - // I almost sure pointerId less or eq to pointerIndex max val switch(action) { @@ -291,13 +290,16 @@ std::int32_t AndroidApplication::inputEvent(android_app* state, AInputEvent* eve } return e.isAccepted() ? 1 : 0; } - + + // does not depend on 'pointerIndex' (at least on my device its always 0 here) case AMOTION_EVENT_ACTION_MOVE: { - for(size_t k=0;k= arraySize(app._previousMouseMovePosition)) + if(pointerIndex >= arraySize(app._previousMouseMovePosition)) Containers::arrayAppend(app._previousMouseMovePosition, {Int(AMotionEvent_getX(event, pointerIndex)), Int(AMotionEvent_getY(event, pointerIndex))}); diff --git a/src/Magnum/Platform/AndroidApplication.h b/src/Magnum/Platform/AndroidApplication.h index 236f66e46..ff7242aec 100644 --- a/src/Magnum/Platform/AndroidApplication.h +++ b/src/Magnum/Platform/AndroidApplication.h @@ -442,7 +442,7 @@ class AndroidApplication { https://doc.magnum.graphics/corrade/classCorrade_1_1Containers_1_1Array.html The exact number of pointers is unknown, isn't it? */ - Containers::Array _previousMouseMovePosition{Containers::InPlaceInit, {{-1,-1}}}; + Containers::Array _previousMouseMovePosition{Corrade::InPlaceInit, {{-1,-1}}}; /* Has to be in an Optional because it gets explicitly destroyed before the GL context */