In this mini-article I will show you how to use LaunchParameters.
LaunchParameters is a new addition in XNA 4.0 Beta.It helps you to store datas across the game project.Works just like Application and Session objects in ASP.NET.
As its a Dictionary object showing the structure is pointless.Lets make an example and see how to use it.
Add these codes on Initialize or Game1 constructor
LaunchParameters.Add("name",
"Ibrahim Ersoy");
LaunchParameters.Add("profession",
"XNA");
LaunchParameters.Add("salary",
"No Way :)");
LaunchParameters.Add("country",
"Turkey");
You can change the values as you like :)
Then to get them use something like that:
Window.Title = "Name: "
+ LaunchParameters["name"] +
" Profession: " + LaunchParameters["profession"] +
"
Salary: " + LaunchParameters["salary"]
+
" Country: " + LaunchParameters["country"];

MatthiasPosted May 25, 2012, 11:48 AM
You miss the important point about LaunchParameters. You can start your game with myGame foo:7 and LaunchParameters will contain a parameter foo with the value 7. So it's to get the launch parameters / command line parameters.