This project is read-only.

Box2d with coco xna issue

Topics: iOS, Physics
Feb 11, 2014 at 7:55 PM
I'm not sure if this is the right place to post this or not but I can't really find any other place to go. I'm using Coco2d Xna with Box2d in Xamarin. When I try to draw debug data from my physics world I get the following exception:

"BeginCustomDraw must be called before drawing anything.".

Here is some sample code I got from the AngryNinjas project that's located on the xamarin tutorial site for building ios games with cocos2d Xna:
void EnableDebugMode()
    CCBox2dDraw debugDraw = new CCBox2dDraw("fonts/arial-12");


public override void Draw()
    // This is only for debug purposes
    // It is recommend to disable it


Feb 11, 2014 at 9:03 PM
You should be using the repository at Cocos2DXNA and not the mono repository. Make sure this is true for your project, or make sure that you are using the packages from the NuGet repository at

Next, the Angry Ninjas example is very outdated. You should look at the box2d samples we have in the framework. There are samples for doing just about every thing you could want to do with box2d.

The samples of which I mention are located at this url:
Feb 11, 2014 at 9:10 PM
Are the packages from NuGet compatible with Mac OSX using Xamarin?
Feb 11, 2014 at 9:19 PM
Edited Feb 13, 2014 at 3:04 AM
No, there is no nuget package management for Xamarin. You have to build from source there.