Game Development Reference
In-Depth Information
Fire up your Xcode 4 and create a copy of the ARC-enabled cocos2d template, or
simply follow the steps in Chapter 2 again. The important bit is that you need the
cocos2d-library target.
Then add a new target to the project via File New Target. Select the Single View
Application template, as shown in Figure 15-7 , and name the new target
ViewBasedAppWithCocos2D . Make sure to enable Automatic Reference Count-
ing for this new target, and for this example I decided not to use Storyboards. You'll
end up with a target that has a view controller class, the corresponding .xib files for
iPhone and iPad , and an app delegate class. If you run it right now, you'll see a blank
iPhone view with just the status bar on top.
Figure 15-7 . The starting point for embedding a cocos2d view is the Single View Application template
The next step is to link the cocos2d-library with the ViewBasedAppWithCocos2D
target. You can do this as described in Chapter 2 by selecting the target and switching
to the Build Phases tab. Under the Link Binary with Libraries section, click the + but-
ton to bring up the add dialog. In this case you'll want to add not only the
libcocos2d-library.a file but also the frameworks required by cocos2d. They
are:
 
 
Search Nedrilad ::




Custom Search