If you compare integration between WPF with XNA vs Winforms with XNA, what is the most suitable framework to integrate XNA framework with.
|
|
Both approaches are valid, but require a bit of thinkering. Using Winforms or WPF in XNA can work great and is great for level editors, but it's usually not that polished that you can ship it to customers, so only use it for your internal tools. XNA in Winforms: http://create.msdn.com/en-US/education/catalog/sample/winforms_series_1 (official method, preferred) XNA in Winforms: http://roy-t.nl/index.php/2008/10/09/xna-30-and-winforms-the-easy-way/ (quick but hacky method read the notes at the end!) Another method, that you can ship to customers is to use one of the many GUI libraries for XNA. I've looked around a bit and this seems the most complete: http://msmvps.com/blogs/valentin/pages/xnaml-component.aspx but there is also this one which I've seen used in actual games: http://neoforce.codeplex.com/ |
|||
|
|
|
This is a "which is better" question, and it depends entirely on your needs. That being said I have done this previously using WinForms, I decided to use WinForms because the approach seemed to be simpler and require less setup. WinForms Graphics Sample is a link to an App Hub posting which includes the relevant source code to get started. Be warned though, mixing XNA calls and GDI calls causes severe flickering and is impractical. To overcome this limitation I drew basic shapes with another App Hub code sample: Primitive Batch. |
|||
|
|
|
Most people seem to prefer WinForms due to reduced hassle it takes to make XNA and WPF work together, which for the most part is fine. However, more and more people are doing their best to make WPF a good choice with the help of components and libraries that enable the ability to Render XNA inside an area or control portion of the screen. I helped develop the one I'm posting here and I think it's a fairly lightweight, simple solution for having XNA in WPF. However, just building a good UI system in XNA itself will make your product more shippable. In either case, I'll leave this here: https://xnaml.codeplex.com/ |
|||
|
|