Skip to content

Commit

Permalink
Support for Cocos2d V2.0 and above
Browse files Browse the repository at this point in the history
In Cocos2D CCTouchDispatcher is no longer a singleton, yet a property
of CCDirector, so I have had to change these references.
  • Loading branch information
clops committed Feb 1, 2012
1 parent c884c8f commit 318939c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Classes/SneakyButton.m
Expand Up @@ -14,12 +14,12 @@ @implementation SneakyButton

- (void) onEnterTransitionDidFinish
{
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:1 swallowsTouches:YES];
[[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:1 swallowsTouches:YES];
}

- (void) onExit
{
[[CCTouchDispatcher sharedDispatcher] removeDelegate:self];
[[[CCDirector sharedDirector] touchDispatcher] removeDelegate:self];
}

-(id)initWithRect:(CGRect)rect{
Expand Down
4 changes: 2 additions & 2 deletions Classes/SneakyJoystick.m
Expand Up @@ -67,15 +67,15 @@ -(id)initWithRect:(CGRect)rect
- (void) onEnterTransitionDidFinish
{
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:1 swallowsTouches:YES];
[[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:1 swallowsTouches:YES];
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
#endif
}

- (void) onExit
{
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
[[CCTouchDispatcher sharedDispatcher] removeDelegate:self];
[[[CCDirector sharedDirector] touchDispatcher] removeDelegate:self];
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
#endif
}
Expand Down
2 changes: 2 additions & 0 deletions README
@@ -0,0 +1,2 @@
Basically I have adapted the SneakyInput library to work with Cocos2d V2.0 and above.
Achtung, in this branch the SneakyInput classes only have been changed.

0 comments on commit 318939c

Please sign in to comment.