• Register
Post tutorial RSS XNA Tutorial - Showing a Message Box (Using the Guide Class)

This is a tutorial for showing a Message Box, in XNA, using the Guide class.

Posted by on - Intermediate Other

This tutorial for XNA is showing a Xbox/Windows Default Message Box.

Anyways, to start this off you need XNA. Then create a XNA game project, and then put the following in the game constructor:

public Game1()
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            Components.Add(new GamerServicesComponent(this));

The "Components.Add(new GamerServicesComponent(this));" allows you to access the Guide class which allows you to see if the game is in trial mode or show the message dialog that we're showing.

Now add this where you want to show you're message box:

//This below is required paste it somewhere.
protected static void GetMBResult(IAsyncResult r)
   int? b = Guide.EndShowMessageBox(r);

//Add everything below when you want to show the message box
List<string> MBOPTIONS = new List<string>();
Guide.BeginShowMessageBox("Temp", "Stuff", MBOPTIONS, 0, MessageBoxIcon.None, GetMBResult, null);

It should show the message box when the condition happens.
Thanks for reading!

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.