It's easy. Just add a form to your project, then create an instance in your game and call Form.Show().
Here's a glimpse of my project explorer, with the relevant folder outlined in red (Blocktools and GraphicsPicker are both extensions of the Editor class, for organization's sake):
And relevant code from my current project:
SpotlessBride.Editor.Editor EditorWindow;
protected override void Initialize()
{
IsMouseVisible = true;
EditorWindow = new Editor.Editor();
EditorWindow.Show();
base.Initialize();
}
It's just that easy.
I don't even using the Windows Forms libraries in my XNA project. Since my goal is to use Windows Forms to manage tools (like text input boxes) for my level and character editors, this method allows me to excise the form from the final game with neither muss nor fuss.
No comments:
Post a Comment