Demos without DemoBaseXNA on iPhone

Topics: Developer Forum
Dec 4, 2009 at 12:48 AM

Hi all,

Farseer compiles under XnaTouch ( for iPhone, also a codeplex project ), but I can't test it because all the Farseer XNA demos use DemoBaseXNA which uses BasicEffect and Vertex* structure/classes. None of which are available on ZuneHD.

Does anyone have a simple Farseer demo that would compile and run on ZuneHD? If it works under ZuneHD it should work on the iPhone using XnaTouch ( fingers crossed ).


Dec 4, 2009 at 4:22 PM

I've managed to cobble together a simple Farseer demo and here it is running on the iPhone simulator -  built with MonoTouch and XnaTouch .

It has a joint and collision active, it stutters at the beginning and then settles into a rhythmic swing. I'm think the stuttering is due to the fact that I have very little idea of what exactly I'm doing with Farseer.

I'm happy to supply a patch for FarseerPhysics, if any of the developers are interested in such a thing.

Dec 4, 2009 at 6:45 PM

The stuff not supported on ZuneHD are probably the polygon drawing code. If you use simple shapes (rectangles, circles) you can get away with just removing the polygon drawing code.

As for the stuttering, I can't give a precise answer because I have no idea about how the IPhone or ZuneHD platforms work.

Dec 4, 2009 at 11:34 PM

Thanks for responding genbox. The problem I'm facing is that I'd like to run the SimpleSamplesXNA demo, but they all make use of DemoBaseXNA, which itself uses BasicEffect and VertexPositionColor and VertexDeclaration classes, all of which are not supported on ZuneHD. So if I remove these calls from DemoBaseXNA, the whole XNA demo does not work.

The demo I finally managed to get working, even though it stutters on start up is one based on one found in your tutorials page - ( which incidentally is out of date and needs a couple more using clauses for it to work ).

So my question is, are there any other Simple demos like the link above that don't use the DemoBaseXNA. As I know so little about Farseer are there any internet step by step tutorials  as well?


Dec 5, 2009 at 12:14 AM

If you remove the following files from DemoBaseXNA:


You should be completely free of the BasicEffect, VertexPositionColor and VertexDeclaration classes. Then you have to edit the SimpleSamplesXNA project:

1. Remove /Demo10/ folder
2. Edit FarseerPhysicsGame.cs and remove line 5 and line 75 (the only two lines referring to Demo10 class)

Now you should be able to directly transfer the SimpleSamplesXNA project to the IPhone.

As for the tutorials. I only know about the ones in the tutorial section (I know there are more out there). The tutorials come and go. Hopefully I can get some good tutorials up on a wiki page when Farseer Physics Engine 3.0 is released.

Dec 5, 2009 at 9:57 AM

Yes those changes certainly allow me to compile everything now.

This has now highlighted an execution order bug within XnaTouch, as the SpriteFonts object is never been instantiated.

Well at least its progress.