How to use the farseer debugview?

Topics: Developer Forum, User Forum
Oct 13, 2011 at 8:52 PM
Edited Oct 15, 2011 at 1:37 PM

Hey, I am completely new to farseer physics so bear with me!

I am trying to use the DebugViewXNA project that came with the samples and I have no idea where to start. I have tried googling but nothing has shown up any definitive guide on how to set up and use the debugger. There are tonnes of classes that aren't part of the DebugViewXNA project which it is dependant on it, ie there are files all over the place you need from the samples project which aren't included in the DebugView folder. Can anyone offer any help on how I can set myself up.


Oct 15, 2011 at 1:37 PM

edited OP

Oct 15, 2011 at 9:37 PM


I did this to get the debugview to show up in the helloworld example.  No-one has confirmed that this is the correct way to do it though.  I'm a newb at this too.

In my own solution I took the FarseerPhysics project and DebugViewXNA project and included them.  Then I put pretty much the same code as I did for getting helloworld to work and now I have a debug view inside my code.  My code is all over the place so I won't post it.  I think you should be able to get it working with the helloworld code I posted.

Good luck.  If you need any more help I'm happy to try and assist; but you'll have to live with my newb'ness.

Oct 15, 2011 at 11:20 PM

Unfortunately from what I can gather, that is from within the samples project. So all those loose file references from different projects within that project are all still available to you, so you wouldn't really run into the same problems as using the debugview class that comes on its own with the standard farseer physics. Thanks for the paste though, the code could be quite helpful.

Oct 16, 2011 at 8:13 AM

The trick is to copy the DebugViewXNA project from the samples into your own project; otherwise you have to implement a concrete version of the DebugView abstract class yourself.  As far as I can see everything you need is in the DebugViewXNA project.

In your game, or whatever, right click the solution and select Add from the popup menu.  Select existing project and browse to the DebugViewXNA project (contained within the samples).  This should copy the DebugViewXNA into your own project so you can use it.  To get it to auto-compile right click on your startup project and add a reference to DebugViewXNA.  This will force Visual Studio to compile it before compiling your code.  Alternatively you can compile it manually by right clicking on it and selecting build.

In your code, write similar stuff to what I put in be debugview example and you should see the debug info when you run your code.

Oct 16, 2011 at 10:11 AM

Unfortunately your wrong there. I used and adapted your code but when I go to compile it gives errors about the missing class that are contained outside of the DebugViewXNA. If you try yourself to use your class in a different project and import just the DebugViewXNA folder you will see what I mean. Thankfully there is only 1 this time, so hopefully I will only need to rip the guys of 1 class out of the project for it to work, I will keep you posted.

Thanks a lot for the code.

Oct 16, 2011 at 10:21 AM

Ok, that didn't take much headache at all. The other times I've fiddled with it I've had to rip tonnes of different classes across! Thanks for your help, your code works great.

Oct 17, 2011 at 5:50 AM

Oops, sorry.  I forgot about the font needing to be setup.  You don't have to copy it from the sample project.  You can create your own font resource; it just needs to be named "font" I think.  You can make it whatever font your prefer by modifying its attributes; just double click the font.spritefont and edit the XML