Joining a cocos2d game with a uikit-based app
I have two separated projects, one is a UiKit ba开发者_StackOverflowsed app with TabBarView (programmed without cocos2D) and the other is a game in cocos2d. I want to make a UIButton to push the game but I don't know the steps to follow to join them.
I've read many times about creating an EAGLView and adding it as a subview, but I have no idea how to do that if my main app doesn't have cocos2D.
I guess the first step will be adding the libraries to the main app, and then copying the classes of the game into the main project. What are the next steps? What should I add/change in order to do that?
I will appreciate as many details/code/examples as possible, because I never programmed using cocos2D.
I beg you pardon, I do not understand (my bad) what you mean with "I want ot make a UIButton to push the game". My first advice would be to have a look at the the RootViewController.m that is created in a standard Cocos2d template. There are tons of comments and you'll see that at the core it creates an EAGLView ([EAGLView viewWithFrame...) that is a simple View at the end, and then it tells to cocos to use it as the rendering view: [director setOpenGLView:glView].
Till now, when I needed UIKit integration I followed this path: create a cocos2d standard app, add the gaming part and after start adding the UIKit parts I need.
Hope it helps to get you started.
精彩评论