Merge pull request #1196 from dumganhar/gles20

fixed #1432: MutiTouchTest crashes on IOS if putting more than 5 fingers on the screen.
This commit is contained in:
James Chen 2012-08-19 19:40:30 -07:00
commit b3cbb646c8
2 changed files with 16 additions and 15 deletions

View File

@ -188,7 +188,7 @@ void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float
// The touches is more than MAX_TOUCHES ?
if (nUnusedIndex == -1) {
CCLOG("The touches is more than MAX_TOUCHES, nUnusedIndex = %d", nUnusedIndex);
return;
continue;
}
CCTouch* pTouch = s_pTouches[nUnusedIndex] = new CCTouch();
@ -235,7 +235,7 @@ void CCEGLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float
CCInteger* pIndex = (CCInteger*)s_TouchesIntergerDict.objectForKey(id);
if (pIndex == NULL) {
CCLOG("if the index doesn't exist, it is an error");
return;
continue;
}
CCLOGINFO("Moving touches with id: %d, x=%f, y=%f", id, x, y);
@ -284,7 +284,7 @@ void CCEGLViewProtocol::getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[
if (pIndex == NULL)
{
CCLOG("if the index doesn't exist, it is an error");
return;
continue;
}
/* Add to the set to send to the director */
CCTouch* pTouch = s_pTouches[pIndex->getValue()];

View File

@ -73,6 +73,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
#import "CCEGLView.h"
//CLASS IMPLEMENTATIONS:
#define IOS_MAX_TOUCHES_COUNT 10
static EAGLView *view = 0;
@ -393,9 +394,9 @@ static EAGLView *view = 0;
return;
}
int ids[CC_MAX_TOUCHES] = {0};
float xs[CC_MAX_TOUCHES] = {0.0f};
float ys[CC_MAX_TOUCHES] = {0.0f};
int ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};
int i = 0;
for (UITouch *touch in touches) {
@ -413,9 +414,9 @@ static EAGLView *view = 0;
{
return;
}
int ids[CC_MAX_TOUCHES] = {0};
float xs[CC_MAX_TOUCHES] = {0.0f};
float ys[CC_MAX_TOUCHES] = {0.0f};
int ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};
int i = 0;
for (UITouch *touch in touches) {
@ -434,9 +435,9 @@ static EAGLView *view = 0;
return;
}
int ids[CC_MAX_TOUCHES] = {0};
float xs[CC_MAX_TOUCHES] = {0.0f};
float ys[CC_MAX_TOUCHES] = {0.0f};
int ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};
int i = 0;
for (UITouch *touch in touches) {
@ -455,9 +456,9 @@ static EAGLView *view = 0;
return;
}
int ids[CC_MAX_TOUCHES] = {0};
float xs[CC_MAX_TOUCHES] = {0.0f};
float ys[CC_MAX_TOUCHES] = {0.0f};
int ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};
int i = 0;
for (UITouch *touch in touches) {