Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a hobbyist and I've just finished implementing the "game" part of a game I'm developing, and I feel as if it finally matured enough to be worth adding a menu to start a new game, exit, edit options, etc., and so I tried to find sources online with tips for creating menus in XNA (first time creating a game in XNA).

So far, I haven't really found any good solutions. I guess I'm looking for a solution that isn't ad hoc so that I could easily reuse it for future games I decide to make. Is there any such built in XNA functionality I'm unaware of? Any XNA libraries out there that would prove useful? Or do you guys have any tips in general for easy/robust/reusable implementation of menus in XNA?

Thanks in advance!

share|improve this question
up vote 9 down vote accepted

You can try Game State Management code sample. I was using it in my first XNA game :)

share|improve this answer
+1, that sample is great. – Jesse Emond May 3 '11 at 21:29
Thanks much for the sample! It seems like it will do the job. Just one more question for the moment. . .I've been studying the code, and I eventually came across the use of <code>PlayerIndex?</code>. What does that extra <code>?</code> do? – Jonathan Gleason May 3 '11 at 22:11
To write code blocks in comments use a backtick (`). The ? is the nullable operator, and allows a value type to be null. – Olhovsky May 3 '11 at 23:50
@GleasSpty PlayerIndex? playerIndex means that the value of playerIndex (that is of type PlayerIndex enumeration) can be null. – pek May 30 '11 at 20:07
The link in the answer is dead now, unfortunately. – Dmitry Yanushkevich May 8 at 15:04

Your Answer


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.