diff --git a/cocos/platform/CCGLView.cpp b/cocos/platform/CCGLView.cpp index e2d5ebb0f7..83709f06b8 100644 --- a/cocos/platform/CCGLView.cpp +++ b/cocos/platform/CCGLView.cpp @@ -56,6 +56,21 @@ namespace { return -1; } + static std::vector getAllTouchesVector() + { + std::vector ret; + int i; + int temp = g_indexBitsUsed; + + for (i = 0; i < EventTouch::MAX_TOUCHES; i++) { + if ( temp & 0x00000001) { + ret.push_back(g_touches[i]); + } + temp >>= 1; + } + return ret; + } + static void removeUsedIndexBit(int index) { if (index < 0 || index >= EventTouch::MAX_TOUCHES) @@ -423,6 +438,11 @@ const Rect& GLView::getViewPortRect() const return _viewPortRect; } +std::vector GLView::getAllTouches() const +{ + return getAllTouchesVector(); +} + float GLView::getScaleX() const { return _scaleX; diff --git a/cocos/platform/CCGLView.h b/cocos/platform/CCGLView.h index f8243770ed..030def1ee8 100644 --- a/cocos/platform/CCGLView.h +++ b/cocos/platform/CCGLView.h @@ -220,6 +220,11 @@ public: * Get the opengl view port rectangle. */ const Rect& getViewPortRect() const; + + /** + * Get list of all active touches + */ + std::vector getAllTouches() const; /** * Get scale factor of the horizontal direction.