Create a project using storyboards, Cocos2D and ARC

I am using Xcode 4.5.2 to create a universal iOS application.

I would like to use my storyboard for my application. I usually create a new project by choosing New> Project> Single view project> check Use the storyboard.

Sometimes in my application I need to use Cocos2D for complex animation (there is no need to interact with it, just for presentation).

My animation was created using CocosBuilder, which works with Cocos2D 2.0 and the CCBReader library.

I tried adding Cocos2D to my existing project:

  • Adding a Cocos2D folder (including support, platforms, kazmath folders).
  • Try something like edit -fno-obj-arc for these * .m files in the build phases / compilation sources.

But when I create the project, ARC errors still exist.

#Question:

  • How can I implement Cocos2D in an existing Xcode 4.3 / 4.5 project?
  • If I create a Cocos2D template project, can I activate ARC for the rest of my project, those classes that are not Cocos2D?

I successfully created a project with Cocos2D inside a UIView from a Cocos2D template as a Ray post , but now I want things (maybe) to be a little more complicated.

+4
source share
3 answers

With a lot of help from @Setrio, @ LearnCocos2D and a lot of Google, I finally fixed it.

My project is combined with Cocos2D, Storyboard, ARC and CocosBuilder.

First, create a project with a SingleView selection (of course, with ARC support).

Then download Cocos2D ARC here https://github.com/LearnCocos2D/cocos2d-iphone-arc-templates thanks Steffen!

Add your libraries to your project as indicated here http://www.learn-cocos2d.com/2012/04/enable-arc-cocos2d-project-video-tutorial/ (brilliant, works like a charm)

Create a storyboard with Cocos2D as this tutorial (sample included) http://www.tinytimgames.com/2012/02/07/cocos2d-and-storyboards/

Now everything works together. Nice. I love Cocos2D :)

+5
source
  • I do not know from my head.
  • Yes, I did this with my latest Cocos2D-iOS project. I converted my project to ARC using an automatic refactoring tool, and I just excluded all Cocos2D library files from it. for the most part, refactoring went smoothly and my project ran over and over again.
+1
source

I found this link / tutorial useful for a project like this.

http://www.tinytimgames.com/2012/02/07/cocos2d-and-storyboards/

Basically you add cocos2d support inside view controllers. You should use cocos2d as a library, and this solves most of the problems.

+1
source

Source: https://habr.com/ru/post/1444503/


All Articles