Portable Class Libraries


Tuesday I attempted to gave a talk at Code Mastery MN about Portable Class Libraries in Windows 8. Turns out PCL development is harder than I had thought it would be.

I thought I would convert the Platformer XNA game over into PCL. I choose the default Portable Class Libraries for Windows Phone Store:

And I started importing code, the Vector2 references were easily converted to Windows.Foundation Point. Converting the Texture2D references to Windows.UI.XAML.Controls Image.Sources took a little more effort. I set up the Level files as Items (the data Item from the PCL Template), no need to get too creative here, yet. I renamed the Platformer.Tile to Platformer.PCL.Block as to avoid and confusion between them and the Windows 8 Modern Tiles.

This was going fine(ish) as I converted all the static images in the game to Image Controls. I replaced the Default grid with a Canvas. Since I don’t have a multi-touch capable monitor and I worked on a Windows 8 VM I decided to opt for a NES style game pad on the HUD of the game (along the bottom). I made the X pad and A/B buttons in Blend (which comes with VS2012). And this is basically what I had:

I did run into some issues with trying to get the spritemap to work for the hero..

XAML Spritemap animations, so the problem is that XAML and animations is typically interpreted as using an animation transform, however for character animation this will simply not work, we need to do a frame animation, not a key frame animation. So to do this we leverage a ViewBox and flip thru images… so now we need to talk about frame rate… this is where I ran into the largest hurtle. I couldn’t get the timer to work!!!

Visual Studio Toolbox:Portable Class Libraries

Advertisements

About Larry Louisiana

I'm a Microsoft Partner Consultant.
This entry was posted in Computers and Internet, Game Development, Programming, Windows 8 and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s