Blending iOS UIKit and Cocos2d

Is it possible to develop an application that mixes UIViewController and iOS specific API elements with Cocos2D views?

The Cocos2D application runs on UIView , and therefore, I think you can switch between one view (Cocos2D) and another (iOS), is that right? Are there any good examples of apps that do this?

The main idea is to develop some graphic animations using Cocos2D and others using UIKit.

+6
source share
2 answers

In fact, you can add any UIView as a subtitle to CCDirector.sharedDirector().view at any time in a running Cocos2D application.

I bet the only reason you really have to mix Cocos2D and UIKit is to create menus and other user interfaces in UIKit and launch the game using Cocos2D. To do this, you can simply find the place where Cocos2D is initialized and replace it with your own UIKit stuff, and then anywhere you can run the Cocos2D scene using the code you replaced. If you want to make this method that you are looking for,

 - (void) setupCocos2dWithOptions:(NSDictionary*)config 
0
source

Consider using SpriteKit, as it will not increase the size of your application and is already in a very comfortable state. It uses the same concepts as cocos2d, which makes it very easy for you if you already know cocos2d. It is also better suited for the UIKit environment.

0
source

All Articles