Reputation: 12444
I have pretty much made my app to about 90% using UIKit code since it is my first app and wanted to keep it simple. Now I learned that I needed to use Cocos 2D in one of my views, my play view. So I have coded half of the functionality in the view using UIKit. Is there any way to use Cocos 2D in that view for the actual game part? Are there any easy tutorials or links someone can point me to, to do this?
Thanks!
Upvotes: 3
Views: 400
Reputation: 7625
I think the link Brad noted is a great reference. More immediately something like....
EAGLView *glview = [EAGLView viewWithFrame:CGRectMake(0, 0, 250,350)];
[yourView addSubview:glview];
CCDirector *director = [CCDirector sharedDirector];
[director setOpenGLView:glview];
Should work for you. Create the OpenGL view for the CCDirector to use. Attach that view as a subview of the view where you want it placed. Attach the CCDirector to your OpenGL view.
Additionally the Cocos2D website and wiki have some great resources that may help...
Upvotes: 4