Original Post
Hello, I want to add a debug menu to my XNA game as to make tweaking and changing options a little easier on 360. I'm also running out of buttons on the pad to turn things on and off. I was thinking of a tree based sort of menu that looks something like this: Start would bring up the menu, Up/Down to traverse, Right/Left to expand or close nodes, Press A on a editable node to edit and press Up/Down to change the value. I usually code in C++ and am rather new to C# so I have some questions about the best way of coding this. I don't want to reinvent the wheel when there's a C# feature I could have used like I seem to keep doing [smile]. So on with the questions... How should I store the tree for the menu? Is there a C# type (Collection?) I can already use or should I roll my own? How to store the values? I can see me wanting int, float, string, bool and maybe Vector3. Is there anything like boost::any in C#? If not does a struct with one of each type and a flag of which type it is sound right? How could I connect the values to the classes that use them? Currently I'm thinking about having the main DebugMenu class static and having each class add their options in their constructor along with a reference to the variable it points to. Any other options I should think about? I'd also like to support calling methods as well as changing values, for example a "ResetLevel" node would call World.Reset(). I've been reading about Delegates and this seems like a good place to use them I think? Thanks for reading.
MenuRoot
-Rendering
-ShadowsEnabled false
-DoLightingPass true
-DoPostProcessPass true
-Physics
-SimSettings
-WorldGravity -9.8
-WorldBounciness 0.1
- Enabled true
+Scene <- *Node not expanded*
-Player
-CurrentAmmo 15
-GodMode false
+ .. other menus ...