getAllTouches() in GLView

This commit is contained in:
Sergey 2014-06-26 14:40:33 +04:00 committed by Sergey Perepelitsa
parent 047025696c
commit 89ed897f47
2 changed files with 25 additions and 0 deletions

View File

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

View File

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