UIView vs CCLayer and Making gestures work in Cocos2d
Posted
by
Lewis
on Game Development
See other posts from Game Development
or by Lewis
Published on 2012-06-26T19:53:13Z
Indexed on
2012/06/26
21:26 UTC
Read the original article
Hit count: 388
now I've been been searching for an answer to this question for at least 3 days now. I've tried on many cocos2d forums, including the official one and have heard nothing back.
I've found a project which uses custom gestures:
https://github.com/melle/OneFingerRotationGestureDemo
Explanation here:
http://blog.mellenthin.de/archives/2012/02/13/an-one-finger-rotation-gesture-recognizer/
Now I want to implement that behaviour onto a sprite in a cocos2d application. I've tried to do this but it fails to work. It uses a view controller which inherits like this:
@interface OneFingerRotationGestureViewController : UIViewController <OneFingerRotationGestureRecognizerDelegate>
Now my question is how would I implement the OneFingerRotationGesture behaviour onto a CCSprite in cocos2d 2.0?
As interfaces in cocos2d look like this:
@interface HelloWorldLayer : CCLayer
Now I have asked a similar question to this on stack overflow and a user directed me to this link:
https://github.com/krzysztofzablocki/CCNode-SFGestureRecognizers
Which I believe makes use of gestures (like the first github linked project) but not custom gestures. I lack the obj-c skills to work out and implement the functionality into my game, so I would appreciate it if someone could explain the differences between CCLayer and UIViewController, and help me implement the OneFingerRotation gesture into a cocos2d 2.0 project.
Regards,
Lewis.
© Game Development or respective owner