Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 3 down vote accepted

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)

share|improve this answer
    
Hey, thanks for the XPF link--that's really cool! I've been hoping someone would do something like this. –  Mike Strobel Jul 16 '10 at 16:03
    
Will look forward to this project. Thanks for the tip! –  alFador Jul 16 '10 at 21:02
    
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! –  dwynne Aug 21 '10 at 10:28

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...)

share|improve this answer

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.

share|improve this answer
    
I think this is all going nowhere for the moment. Thanks in advance for the tip on the codeplex project. –  alFador Jul 16 '10 at 21:03

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.