2 Finger Touch Not Working [Solved]

2 Finger Touch Not Working [Solved]
0.0 0


Any body know how i just get 2 fingers touching the screen at the same time so i can drag a simple sprite around
I have made the jump to cocos2dx from cocos2d. I have been looking around all day trying to figure it out
Before I just used this code in cocos2d

 -(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
            NSSet* allTouches = [touches setByAddingObjectsFromSet:[event touchesForView:[touch view]]];
            NSArray* allTheTouches = [allTouches allObjects];
           if ( [allTheTouches count] == 2 ) {
               //Now Drag Something
               //Around here.

In new project i have added 
  CCDirector::sharedDirector()->getTouchDispatcher()->addStandardDelegate(this, 0);
and found "touches->count();" but its always returns 0

void HelloWorld::ccTouchesMoved(CCSet* touches, CCEvent* event)
    CCSetIterator it = touches->begin();
    CCTouch* touch;
    CCPoint pt;
    for( int iTouchCount = 0; iTouchCount < touches->count(); iTouchCount++ )
        touch = (CCTouch*)(*it);
        pt = touch->getLocationInView();
        printf( "ccTouchesBegan id:%i %i,%i\n", touch->getID(), (int)pt.x, (int)pt.y );
       if( touches->count() > 1 ) {
            printf( "2 fingers  id:%i %i,%i\n", touch->getID(), (int)pt.x, (int)pt.y );

Is there a bug in cocos2dx or dose anyone know how it is done or can translate the [allTheTouches count]
Im using cocos2d-x Ver 2.2.3, Mavericks 10.9.2 & Xcode
Thanks in advance.


Can you check in your AppController that you have setMultipleTouchEnabled:YES on your View (I assume you are on iOS) ?

If it doesn’t work, could you reformat your post so that the code is in the same box ?

P.S. : I doubt there is a bug in cocos2dx, I am using multiple touches for a year without problem.


You are right many thanks did not realise there was AppController in iOS dir. simple added this line to AppController.mm
[__glView setMultipleTouchEnabled:YES];

Many thanks fradow been banging my head all day.