12

I am quite familiar with cocos2D (been working with it for over 1 year) and I encountered a problem with my multitouch game - the multitouch.

What I have:
[glView setMultipleTouchEnabled:YES] in my delegate. A playscene that does NOT implement touches.
Many objects (of my own, inherits CCLayer) that are added to playscene.
These objects implement touches and are delegates of the targeted protocol.
[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];

The very same architecture is used in the touches test from cocos2D and it's working. The only difference is that they use CCSprite instead of CCLayer as the parent class for the objects.

Does anyone have any ideas?

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
George
  • 4,029
  • 1
  • 23
  • 31
  • Still looking for a solution for this? What happens when you touch the screen with your implementation. Do you get any kind of response in your touch callbacks (begin/moved/finished)? – Rob Segal Jul 29 '11 at 13:12
  • 2
    Well, you will never guess! Of course I knew XCode is not the best IDE in the world and that sometimes you should clean the project and rebuild...but I never thought to do a new project and import everything in there. That was the problem!!! How f**ked up...I thought I only had to code... After that , everything worked ok. – George Sep 06 '11 at 11:32
  • Yeh that can happen sometimes. Good to hear everything is working now. You should add that as answer to your question to close it off. – Rob Segal Sep 06 '11 at 14:19

2 Answers2

1

I do it this way:

in app delegate:

[glView setMultipleTouchEnabled:YES] 

then in you game you see the touches like this:

self.isTouchEnabled = YES;
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {}
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {}
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {}
- (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {}

With this I sold my problem I hope it helps

Eduardo Iglesias
  • 1,056
  • 18
  • 42
0

Well, you will never guess! Of course I knew XCode is not the best IDE in the world and that sometimes you should clean the project and rebuild...but I never thought to do a new project and import everything in there. That was the problem!!! How f**ked up...I thought I only had to code... After that , everything worked ok.

George
  • 4,029
  • 1
  • 23
  • 31