Staying Current – cocos2d v1.1 RC0 with GBox2D

As we progress with the development of our first game we are trying to stay up-to-date with the frameworks we are using to allow us to support the latest iOS and iPhone releases.

On Oct 21st cocos2d v1.1 RC0 was released.  Since this release included fixes for iOS 6  and support for the newer phones, I wanted to update our code to use this newer version.

The update process was was actually easier then I was expecting.  Here are the specific steps I followed to update our app:

  1. Download the latest release of cocos2d and extracte the source.
  2. Follow the instructions in the README file to install the templates into Xcode.
    $ cd cocos2d-iphone-1.1-RC0
    $ ./install-templates.sh -u -f
  3. Launch Xcode and start a new cocos2d project.  In my case, I used the cocos2d_box2d template.
  4. Build and run the new project to confirm everything is working as expected.
  5. In your app’s lib folder delete the files/folders related to cocos2d, replacing them with the lib folders content from the new project.  Since, the only files I had in the lib folder were from cocos2d I was able to simply replace the entire lib folder.
  6. Replace the GLES-Render.h and GLES-Render.mm files in your project with the files generated in the new project.
  7. Finally build and run your app to check for errors

As might be expected, I ran into a couple of errors that had to be fixed before my game would run.  These changes were isolated to the GBox2D cocos2d wrapper library developed by Andreas Loew’s the author of TexturePacker and PhysicsEditor. The specific issues I found all appeared to be related to changes in the API of the new version of Box2D included in the cocos2d update.

  • In GB2DebugDrawLayer.mm replace the “b2DebugDraw” with “b2Draw”
  • In GB2Engine.mm the sleep parameter is no longer supported when creating a new world object.
  • In GB2Node.mm there is a new way to specify an Edge Shape.

That was it. Everything ran as expected after these updates.  I will try to add comments to this post if I run into any additional issues.  I am hoping the final release of cocos2d v1.1 will be out before too long.  At that point we may consider locking down changes to the framework before the initial release of the game.

Posted in Coding and tagged , , , , .

One Comment

Comments are closed.