How can I incorporate XNA into a Form so that I can make a map builder rather then make the whole interface inside XNA , I would like to be able to use windows controls.

Thank you

Re: XNA Framework Use XNA to make a map maker?

Bill Reiss

Check out this link: PostID=974496&SiteID=1&mode=1

It looks like the sample is for Beta 2 but there really weren't any breaking changes between Beta 2 and release so it should still be valid.

Re: XNA Framework Use XNA to make a map maker?

Jeff Weber

A quick an easy way to use forms with XNA, is to simply new up a form prior to Game.Run.

Add a form, "MyForm" to your project

Then, within the program.cs file in the "Main()" method just before Game.Run(), do this:

MyForm myForm = new MyForm().




When you run the app, your form will show and from this form, you can write code that interacts with your game. You can also add as many other forms as you want...


Re: XNA Framework Use XNA to make a map maker?


Working on a physics editor Jeff ;)

Re: XNA Framework Use XNA to make a map maker?

Richard Kain

I imagine you would create a map maker using standard Winforms. You would really only need the XNA Framework to import graphics. You should be able to incorporate the XNA content pipeline for this. XNA's Graphics rendering and Update routines wouldn't be necessary. I really don't think constructing the interface in XNA is the way to go. XNA doesn't natively support GUI elements. But WinForms do. The focus of XNA's rendering is to make real-time time appliations. Unless you're talking about constructing full-3D maps, XNA rendering shouldn't be needed.

Now, if you are talking about constructing full 3D maps...then that changes things. I still think you would want to use WinForms. But it might be possible to embed an XNA window in your application. Generally speaking, XNA is for constantly updating games, while WinForms is for Windows applications, such as map makers/editors. Constantly updating applications eat up more system resources than WinForms, so you want to avoid using them where ever possible in a Windows application.

Re: XNA Framework Use XNA to make a map maker?

Jim Perry

Even if you're doing 2D maps, having the XNA rendering in your map editor means you don't have to rewrite your rendering code for the game. Anything to lessen the development and make it easier is a good thing IMO.

Re: XNA Framework Use XNA to make a map maker?


I'm in the midst of doing this currently. The decision I made was to add another XNA game project to my solution. this new project is the editor. Instead of the game class inheriting from Game, it inherits from the game I'm working on. So I have a project "MyGame" and a "MyGameEditor".

In the editor project it has all of the classes necessary to build the editor, but since it's a sub class of the game it has all of the rendering/scenegraph stuff available to it. Then the editor has a bunch of small forms around it (one holds the menu, one is an object inspector, etc).

I mainly did this so that the main game project would not have to reference the windows classes that aren't available on the Xbox and to partition off the two.