2
\$\begingroup\$

There are some programs that allow you to design some menus/hud/interfaces in flash and then insert them into your game. But is there something similar for making all of this stuff in Silverlight and then mount that content in your XNA game?

\$\endgroup\$

4 Answers 4

3
\$\begingroup\$

Not really, there is no elegent way to make silverlight/wpf and xna live side by side like that. At work we reimplemented some of WPFs basic controls to do in game 2D layout, but thats over most peoples needs. You better off rolling your own game specific UI code.

Might be an idea to keep you eyes on RedBadgers XPF project, but its going to be a long wait :P (the company was founded by the guy who did our wpf/xna implementation at work)

\$\endgroup\$
3
  • \$\begingroup\$ Hey, thanks for the XPF link--that's really cool! I've been hoping someone would do something like this. \$\endgroup\$ Commented Jul 16, 2010 at 16:03
  • \$\begingroup\$ Will look forward to this project. Thanks for the tip! \$\endgroup\$
    – alFador
    Commented Jul 16, 2010 at 21:02
  • \$\begingroup\$ Hey - so I'm one of the Founders of Red Badger. XPF is coming along very nicely, we're hoping to get a public beta out very soon. We'll be making announcements on our blog red-badger.com/Blog @Cubed2D thanks for the mention! \$\endgroup\$
    – dwynne
    Commented Aug 21, 2010 at 10:28
2
\$\begingroup\$

There are some open source UI toolkits for XNA, but none that would give you the richness of Silverlight (or WPF for that matter). WPF is capable of hosting Direct3D content, and I've seen it hacked to support XNA, but the performance isn't great. The screen updates are effectively limited by the frame rate of WPF, as the hosted 3D scene is composited into the WPF scene. The same would go for Silverlight, if it were to support this kind of integration. What you would really want is to be able to host the Silverlight content within XNA, and not the other way around. Unfortunately, this capability does not appear to be on the road map.

If you really want to leverage the layout and templating capabilities of Silverlight, you might consider implementing them yourself, as Cubed2D's team did for their project. That may be overkill, though. But if you do decide to go that route, you might want to check out this WPF implementation for C++/Win32. You won't be able to use any of the code, as it's all C++/Direct3D, but it could give you some hints for how the tessellation, rendering, and compositing are done.

\$\endgroup\$
1
  • \$\begingroup\$ I think this is all going nowhere for the moment. Thanks in advance for the tip on the codeplex project. \$\endgroup\$
    – alFador
    Commented Jul 16, 2010 at 21:03
1
\$\begingroup\$

Yeah doesn't sound like that would be possible as they're both going to fight over control of directX I think. At least XNA has a decent 2D API for you to work with. You could make some simple components like a numerical display, bar display etc and possibly a little an application to visually drag them around and arrange them, then spit out an XML file with the configuration.

\$\endgroup\$
0
\$\begingroup\$

Short answer: it's not doable.

I actually looked into this myself a little while ago, searching for a .NET-friendly equivalent to Scaleform (the toolkit that I think you're thinking of, embedding a Flash display as your UI--Unreal uses it). The Silverlight stuff won't work, but if you're willing to do some work to achieve your goal, the Mono Project's implementation, Moonlight, might be the way to go. Moonlight uses Cairo for rendering and there are both OpenGL and DirectX backends for Cairo to emit to, and it seems like wiring up UI events should not be too difficult. The main issue is that Moonlight does not compile on Win32. I looked into it and it was more trouble than I wanted to deal with, but it didn't seem that hard.

(Why Moonlight depends on GLib, I'll never know...)

\$\endgroup\$

You must log in to answer this question.

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