My PhotoBruno Brás Silva

09, April 1986

info@brunosilva.net

Sintra Lisbon Portugal

XNA - Getting GamerCard Info in Xbox 360

Posted on 5:30pm 6/12/2008 by Bruno Silva in .NET, Programming, XBox 360, XNA

Xbox 360 - GamerCard

One nice XNA feature is the ability to manage Xbox 360 users gamer data. This way you can access your gamercard information which include your name, avatar, achievements, played games and list of friend among other things. How can you do that?

In the Initialize method of your game you must add a specific component into the game, in order to prepare the game to access the data.

XNA Gamercard Manipulation

Since while the Initialize and LoadContent methods are executed, the gamer data is not available yet, you must access it in the Update method. There you can check if a variable is set, and if it is not, you load the gamercard information. Be careful, you must not load the gamer data in every iterations of the game loop. Your Xbox will hang if you do that… It is an expensive operation. Try to load this data only one time or so during the game lifetime.

XNA Gamercard Manipulation

This example show your gamer picture in the screen, followed by some of your informations such as your gamer tag.

XNA Gamercard Manipulation

You can download the full source code and deploy it into your Xbox 360 console and give it a try. (I’ve written before about how to get a free XNA Creators Club Membership in order to allow XNA deploying).

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Bruno Silva | Powered by Wordpress