浏览代码

Fixed bug where Forms did not receive touch event on Android.

Darryl Gough 13 年之前
父节点
当前提交
6720274dc9
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      gameplay/src/PlatformAndroid.cpp

+ 10 - 1
gameplay/src/PlatformAndroid.cpp

@@ -4,6 +4,7 @@
 #include "Platform.h"
 #include "FileSystem.h"
 #include "Game.h"
+#include "Form.h"
 #include <unistd.h>
 
 #include <android/sensor.h>
@@ -549,7 +550,7 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
                     break;
             }
             size_t pointerId = AMotionEvent_getPointerId(event, i);
-            Game::getInstance()->touchEvent(touchEvent, AMotionEvent_getX(event, i), AMotionEvent_getY(event, i), pointerId);
+            gameplay::Platform::touchEventInternal(touchEvent, AMotionEvent_getX(event, i), AMotionEvent_getY(event, i), pointerId);
         }
         return 1;
     } 
@@ -853,6 +854,14 @@ void Platform::displayKeyboard(bool display)
         __displayKeyboard = false;
 }
 
+void Platform::touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
+{
+    if (!Form::touchEventInternal(evt, x, y, contactIndex))
+    {
+        Game::getInstance()->touchEvent(evt, x, y, contactIndex);
+    }
+}
+
 void Platform::sleep(long ms)
 {
     usleep(ms * 1000);