Reputation: 21157
How can I install cocos2D-iPhone manually? I want to include the cocos2D framework into an existing project. Thus, I will not be able to use a cocos2D project template.
Tutorials or web sites would be appreciated (couldn't find any)
Upvotes: 1
Views: 977
Reputation: 11038
I would create a new project using the template, and compare it to your own project. For a list of files to compare, and a rough procedure:
Modify main.m
in your target to specify your AppDelegate
class. For a project called Untitled, you'd use
int retVal = UIApplicationMain(argc, argv, nil, @"UntitledAppDelegate");
Add a target that builds the cocos2d files. This will be a "Static Library" target. use "Get Info" on the template version to figure out exactly what's going on inside.
Window.xib
file to boot up the project, and will have to manually instantiate the cocos2d stuff. The best way to see the proper startup procedure is to take a look at the template code.That said, I actually DO use a UINavigationController
and a UIViewController
with a nib file for my initial view. To do this, instantiate the navController
like usual, and use this sort of code to attach it to cocos2d:
[[[[CCDirector sharedDirector] openGLView] window] addSubview:navController.view];
That should be everything you need to do for a basic conversion.
If you want access to the project internals, you might use the method of shared libraries, which will allow you to build a new cocos2d library every time you build your app. The link has a great tutorial on this.
Upvotes: 4