Thursday, 4 October 2012

Simple Active Tiles using XNA on WP7

So another quick post I want to do is on using active tiles in XNA, or rather how you instantiate them in you WP7 application using XNA, like in the last post we have to have the assets in the project rather than the content project.
So, simply enough I created a method called SetTile, this will create the active tile for you, so when your game is pinned it will display the tile and the information you want on it. I used the same sample I did last time to implement this so it’s all rolled in with the ringtone source.
        public void SetTile(string title, string data, string tileAsset)
            ShellTile tile = ShellTile.ActiveTiles.First();

            if (tile != null)
                StandardTileData tileUpdate = new StandardTileData
                    BackTitle = title,
                    BackContent = data,
                    BackBackgroundImage = new Uri(tileAsset, UriKind.Relative)

So you could call the method like this:
            SetTile("Ringtones", "Play them or save them", "Tile.jpg");
So, now when you pin your application you can get something like this when the tile flips:

Naturally you would have much better icons and messages on your tiles, but you could use this to show the players last high score, or there current progress in a currently saved game etc..
Source can be found here [Not Yet Uploaded]

No comments:

Post a Comment