Mar 19, 2010 at 3:20 PM
Edited Mar 20, 2010 at 12:15 PM
Well I got it to compile and run but nothing appears on the emulator screen.
Here is what I had to do:
First you can't add Farseer as a .dll because Farseer references an old and crusty version of mscorlib. :) XNA 4.0 wants a newer version and it tells you so.
Second, Windows Phone works differently with game entrypoints. My mistake was creating a new XNA 4.0 project in Windows Phone and copying all of the Farseer classes into that project. What you have to do is create an XNA 4.0 Game Library and
there is a template for that in VS 2010 right below the project option and then copy all of the Farseer classes into that Library.
Third, reference the Farseer library in your game project.
Fourth, Stopwatch is not included by default so you have to add a reference to the Farseer project library in order to access StopWatch. reference Microsoft.Devices (There are two, choose the top one in the (ProgramFiles)\Reference Assemblies path
per Nick Gravelyn's suggestion.
Fifth, Add a compiler directive to the Farseer properties. Just double click properties in the Farseer project, click the Build tab in the properties window, and in the Conditional compilation symbols add ;XNA. (It should look like this.....Windows_Phone;XNA
Sixth, it compiles and runs with my current project. I commented out all of the RemoveAll statements in the two classes that use those statements. ( SelectiveSweepCollider.cs and SweepAndPruneCollider.cs). But I am encouraged that it
compiled and ran successfully.
Seventh, After numerous attempts at trying to figure out how to implement the RemoveAll extension method, I finally decided on a simpler solution. I commented out the #if (!SilverLight) section thus exposing the #else section in both SelectiveSweepCollider.cs
and SweepAndPruneCollider.cs. This exposed the remove code reserved for SilverLight developers. It ran and I hope that means it's all working fine. If I had to guess, I would say this means SilverLight also does not contain the RemoveAll
and thus a different method was employed to remove stuff.
Video of Farseer XNA on Windows Phone 7:
After I made Nick's change with the Microsoft.Devices reference the game ran. It's pretty sweet to see the GameStateManagement menu system show up on the phone emulator and to see my early farseer project running on a Windows Phone Emulator. The
RemoveAll statements are in the two classes that use those statements. ( SelectiveSweepCollider.cs and SweepAndPruneCollider.cs).