4
\$\begingroup\$

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!

\$\endgroup\$

1 Answer 1

9
\$\begingroup\$

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

\$\endgroup\$
4
  • \$\begingroup\$ 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? \$\endgroup\$ May 3, 2011 at 22:11
  • 2
    \$\begingroup\$ To write code blocks in comments use a backtick (`). The ? is the nullable operator, and allows a value type to be null. msdn.microsoft.com/en-us/library/1t3y8s4s(v=vs.80).aspx \$\endgroup\$
    – Olhovsky
    May 3, 2011 at 23:50
  • 1
    \$\begingroup\$ @GleasSpty PlayerIndex? playerIndex means that the value of playerIndex (that is of type PlayerIndex enumeration) can be null. \$\endgroup\$
    – pek
    May 30, 2011 at 20:07
  • \$\begingroup\$ The link in the answer is dead now, unfortunately. \$\endgroup\$ May 8, 2016 at 15:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .