Archive of iOS

Wrapping Box2D Debug into a Cocos2D Layer

Posted by John Wordsworth on September 09, 2011 in iOS Development tagged with , , ,

When I first started integrating Box2D into my Cocos2D project, I found the whole process a little jarring. While I'd used C++ before, this was the first time I'd seen it mixed with Objective-C. This code snippet simply wraps the standard Box2D Debug calls from GLES-Render.h (included with Cocos2D) in it's own CCLayer, so that you can implement it quickly and easily. It also allows you to turn the layer on an off easily as you would any other CCLayer.

Continue ReadingView Comments (3)

iOS – performSelectorOnMainThread with Multiple Objects

Posted by John Wordsworth on August 08, 2011 in iOS Development tagged with , , ,

I recently ran into the situation where I wanted to call NSObject's performSelectorOnMainThread with multiple arguments. While it wasn't massively difficult, it was a bit more fiddly than I first expected - you have to get your hands dirty with NSInvocation. I've built a category that adds an additional method to NSObject which will allow you to call a performSelectorOnMainThread method with any number of objects as parameters. Feel free to use it in your own projects!

Continue ReadingView Comments (4)