Merge branch 'v3_getAllTouches' of https://github.com/newnon/cocos2d-x into v3_check_newnon

This commit is contained in:
samuele3hu 2014-09-04 18:17:05 +08:00
commit 61d1b67116
2 changed files with 25 additions and 0 deletions

View File

@ -56,6 +56,21 @@ namespace {
return -1; return -1;
} }
static std::vector<Touch*> getAllTouchesVector()
{
std::vector<Touch*> 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) static void removeUsedIndexBit(int index)
{ {
if (index < 0 || index >= EventTouch::MAX_TOUCHES) if (index < 0 || index >= EventTouch::MAX_TOUCHES)
@ -423,6 +438,11 @@ const Rect& GLView::getViewPortRect() const
return _viewPortRect; return _viewPortRect;
} }
std::vector<Touch*> GLView::getAllTouches() const
{
return getAllTouchesVector();
}
float GLView::getScaleX() const float GLView::getScaleX() const
{ {
return _scaleX; return _scaleX;

View File

@ -220,6 +220,11 @@ public:
* Get the opengl view port rectangle. * Get the opengl view port rectangle.
*/ */
const Rect& getViewPortRect() const; const Rect& getViewPortRect() const;
/**
* Get list of all active touches
*/
std::vector<Touch*> getAllTouches() const;
/** /**
* Get scale factor of the horizontal direction. * Get scale factor of the horizontal direction.