Demos without DemoBaseXNA on iPhone

Topics: Developer Forum
Dec 3, 2009 at 11:48 PM

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 ).

Thanks.

Dec 4, 2009 at 3:22 PM

I've managed to cobble together a simple Farseer demo and here it is running on the iPhone simulator - http://twitpic.com/s3h5f/full  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.

Coordinator
Dec 4, 2009 at 5: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 10: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 - http://nerg4l.ne.funpic.de/doku.php/wiki:tutorials:nergal:quickstartsample ( 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?

 

Coordinator
Dec 4, 2009 at 11:14 PM

If you remove the following files from DemoBaseXNA:

/DrawingSystem/PolygonBrush.cs
/DemoShare/Table.cs

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 8: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.