Access Keys:
Skip to content (Access Key - 0)

Kobold2D™ Documentation

The All-In-One, Ready-To-Go development solution for cocos2d-iphone developers. Open source, ARC enabled, for iOS & Mac OS.

Switch to: Japanese Documentation

Level Up!

The Learn Cocos2D Book

Line-Drawing Game Starterkit

Excellent template code for creating your own Line-Drawing game, similar to popular titles such as Flight Control, Harbor Master, and Pirate Bay.

The iPhone RPG Engine

Rapidly create your own RPG or action-adventure game with this complete starter kit. Includes an ebook, game source code and a royalty-free art package.

If your project is based on Kobold2D Preview 5 or earlier, you will have to perform the following steps to enable ARC in your project.

Update Build Settings

Open your project's workspace in Xcode. Browse to the BuildSettings group in the Project Navigator and locate the files BuildSettings-iOS.xcconfig and BuildSettings-Mac.xcconfig. To both files (if existing) add the following line at the end of the file:

Import kkARCSupport.h in Prefix header file

Browse to the group ProjectFiles/Supporting Files and locate the files Prefix-iOS.pch and Prefix-Mac.pch. To both files add the kkARCSupport.h header file below the kobold2d.h header file:

This ensures that libraries such as cocos2d compile error-free with ARC enabled.

The KK_ARC_ENABLED macro

The kkARCSupport.h header file also makes the KK_ARC_ENABLED macro available, with which you can conditionally compile code if ARC is either enabled or disabled/unavailable.

You will probably not need to use this macro, but you'll find it used in many of the Kobold2D template projects. It is used to keep the Kobold2D template projects compatible with non-ARC compilers (Xcode 4.1 or earlier) respectively for users who want or need to disable ARC. For example:
The ARC Conversion Tool provided by Xcode

In Xcode you can convert any Objective-C project to ARC with the built-in ARC conversion tool. With your project open you should select Edit -> Refactor -> Convert to Objective-C ARC... from the menu to start the conversion process.

Most of the time the conversion tool gets things right, but not always. If it fails for some reason please leave a message in the Kobold2D forum and include the code sample where Xcode reports a compile error.

Usually the issues are simple to fix, here are some guidelines:

  • remove all calls to: release, autorelease, retain
  • remove [super dealloc] and any other calls to dealloc
  • in C structs prefix all id variables with __unsafe_unretained
  • when casting id or other Objective-C class instance pointers from or to void*, cast the pointer with the __bridge keyword like so: id object = (__bridge id)somePointer respectively void* pointer = (__bridge void*)someObject
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Adaptavist Theme Builder Powered by Atlassian Confluence