I'm sorry if this has been asked elsewhere, but is it possible to combine Objective C with Cocos? I started this game in Objective C (using xibs, view controllers, etc) and I'd like to incorporate elements of Cocos in it (transitions, special effects). Is this possible? Thank you.
Combining Objective C with Cocos?
(8 posts) (4 voices)-
Posted 1 year ago #
-
LOL You may want click the Documentation link at the top. Cocos2d-iphone is written in Objective C.
Posted 1 year ago # -
I know that, but do I just import the cocos libraries into Classes and make my cocos function calls?
For eg, can I do something like:
- (IBAction)continueButtonPressed:(id)sender { TestAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; [delegate loadGameScreen]; }Guess I'll have to try it and find out...
Posted 1 year ago # -
I think your question is, can you combine UIKit with Cocos2d? Is this correct?
Posted 1 year ago # -
Yes.
Posted 1 year ago # -
Yes you can.
Ensure you
#import <UIKit/UIKit.h>and after filling out said UIControl's variables
You can add it to the view with:
[CCDirector sharedDirector] openGLView] addSubview:<control_>];and be sure you remove it from the openGLView also when you no longer need the control via :
[<control_> removeFromSuperview];Posted 1 year ago # -
Thank you, @Vabu and @Codemattic. I'll take a look at the sample files in the tests folder.
Posted 1 year ago #
Reply
You must log in to post.