Sliding Block Puzzle
This app is a simple game for Windows Phone 7.1 (Mango). It uses a variety of features and techniques of the Windows Phone platform.
I've decided to go with the Publish-Early Publish-Often approach. The single player game is playable, the custom game code isn't finished yet. This documentation will be improved over time. If you see any problems with either the docs or the code,
then please start off a discussion and I'll respond as soon as I can.
The application is written in a mixture of
Model-View-ViewModel (MVVM) pattern and straight code-behind logic in pages.
Once you have the
source code downloaded, build the code. On Windows 8, you may get the following error:
The target "GetCopyToOutputDirectoryContentProjectItems" does not exist in the project Locima.SlidingBlock
If you get this, simply download the
XNA Game Studio 4.0 Refresh. This happens because XNA Game Studio doesn't install correctly when you install the Windows Phone 7.1 SDK.
If you want to see all the NLog trace that the program emits, then enable the
Emulator Console by setting the following registry key:
Press F5 and you're good to go!
The application is structured with all the pages in the root of the application, then
ViewModel and Model namespaces for View Models and Model, respectively, where applicable.
Apart from these namespaces there's the following:
||Some useful commonly used classes
||Created and used by
||Windows Phone controls used within the pages
||Lots of data converters (implementations of IValueConverter]
||Contains the set up for the single player game (level definitions)
||The application bar icon files
||Classes and interfaces that abstract all persisted data
||Implementation of all interfaces in the IO namespace using Isolated Storage
||Along with ViewModelBase.cs, this provides the necessary code for messaging from the View Model to the View
||Classes which can be persisted using the facilities within IO
||Resource files (yes, this application is localised
||Sample data XAML files so the designer view in VS2010 looks pretty.
||Contains a single class to mix up the tiles in a puzzle
||I'm not quite sure why this isn't in GameTemplates, it will be shortly!
||Ignore this, I never really got around to writing unit tests
||Created by the Silverlight Toolkit, I don't think I use this!
MVVM and Code-Behind
The pages of the application either use MVVM or are straight ASP.NET-style code-behind, the following table shows which one is which:
||Adds or edits a player's name
||Work in Progress – Allows the user to create their own set of levels
||MVVM (will be eventually)
||Shown when the player finishes all the levels
||The main page shown that has the sliding puzzle
||Shows the high score table
||Work in Progress – allows the user to select an area of an image to use as a puzzle
||Work in Progress - allows the user to choose an image to play with from either a URL or local photos
||Shows the menu structure (data driven menus so only 1 page required
||Allows the user to select a player profile to use
||Allows the user to select a previously saved game to continue
Windows Phone Mango Jump Start - Rob Miles & Andy Wigley
These (funny) guys hosted the Windows Phone Mango Jump Start videos, which provided me with a great start to understanding development on WP7.
Windows Phone Geek
Windows Phone Geek provides countless useful articles on Windows Phone development. DelegateCommand came from here.
NLog for Windows Phone 7 - Jarek Kowalski
NLog is an invaluable tool, it's used in this project for creating a debug trace.
Little Watson - Andy Pennell
Little Watson allows bug reports to be sent back to me.
Your Last About Dialog - Peter Kuhn (Mister_Goodcat)
Your Last About Dialog was used for the acknowledgements.
Windows Phone Silverlight Toolkit - Microsoft
Lots of great utility classes that eased the development of this app.
WriteableBitmapEx - Various
A very handy set of extension methods for the WriteableBitmap class.
MetroGridHelper - Jeff Wilcox
Helped me to work out how to lay out my controls (although I've probably done it badly!)
Sandcastle - Eric Woodruff
Sandcastle builds the HTML API documentation.
I was inspired to write this having read Scott's post on
Shipping my first Windows App. He's a truly motivational speaker and writer!