Box2DX in Windows Runtime Component

I’ve been working on my sample game app for Windows 8 for some time now, prototyping and learning app development. My user interface is a Windows 8 XAML project and I picked the Windows Runtime Component as my business logic because, among others, I am also considering to swap the UI with HTML 5 and JavaScript later on to experiment.

I’ve been meaning to use Box2DX for the physics and collision engine but came across the problem that my business logic (Windows Runtime Component) is somewhat limited and I couldn’t simply reference the Box2DX directly because I get a compiler error.

So I had one option to add a new portable class library project to my solution and reference Box2DX in this PCL project, then add a reference to the PCL in the Windows Runtime Component project. Of course, this requires additional implementation in the PCL to make the Windows Runtime Component code use the Box2DX in the PCL (this PCL being more like an intermediate codebase between the business logic and Box2DX) so I went for the second and better solution: I downloaded the Box2DX source code, compiled it into a Portable Class Library and added the reference to this PCL assembly in my Windows Runtime Component. It worked like a charm! ๐Ÿ˜‰