Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How do for example make it possible to pass an argument to the .exe file and read it in my XNA Game?

Examples:

Enable Editor:

game.exe -devmode

Set Resolution:

game.exe -width 1280 -height 720

and in the game check the arguments before starting the game. I searched for this earlier and thought about it again but found nothing about it.

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

At the end of the day, XNA games are just regular .NET applications.

Read the docs on Main() and args.

You can also use System.Environment.GetCommandLineArgs (link).

share|improve this answer
    
Yes, I should've thought of that... Just been looking for XNA examples. :) –  Deukalion Jan 5 '13 at 22:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.