I am currently developing a 3d game using C#/SlimDX (The target is Direct3D 9). I've been looking for a suitable Game UI toolkit for a while, but I was unable to make up my mind.
The Game UI will be for a roleplaying game, so it'll be fairly complex and will involve quite a few controls (text boxes, inventory grids, list boxes, select boxes, scrollable areas, etc.).
I previously (When i was still using C++/OpenGL) looked at GameSWF and very much liked the idea, but for my current game it's out of the question.
Does anyone know a good GUI toolkit for use with SlimDX?
I would be especially interested in using WPF/Silverlight for this, since there are good IDEs available for both. But a quick google search didn't reveal any information on embedding these.
You can use WPF (but not Silverlight) for this.
The way to go about this is to use SlimDX in conjunction with D3DImage. You then let WPF handle all of your final composition, including overlaying the WPF UI over the top of your SlimDX scene.
SlimDX basically just renders to a brush in this situation, which can be used on any WPF element. (This doesn't work for Silverlight, as Sliverlight doesn't support D3DImage.)
Related
Recently I have been working on a small WPF project involving the visualization and manipulation of 3d objects. For 2d ojects, this can be easily achieved with a Canvas warpped in a ViewBox or some nice 3rd party controls. But I can't find any free, ready-to-use solution for 3d objects. There is a likely one in WpfToolKit from XceedSoftware(https://github.com/xceedsoftware/wpftoolkit), but no information is given.
I know WPF has some 3D support, like ViewPort3D and other classes in Media3D namespace, and I did find a book, '3D Programming for Windows'(http://www.charlespetzold.com/3D/index.html), by Charles Petzold introducing the concept and basic knowledge. However, many tricky tasks like adjusting camera according to mouse and keyboard input is not presented. So before I start building my own control, I want to at least confirm that I'm not wasting my time doing something already perfectly done. And how to properly config the mouse and keyboard events to make the control behaves as if using some professional CAD softwares?
In short:
1.Any free 3d control for WPF
2.How to build my own ones
Can anyone help me?
I wrote an WPF app using all the 3D stuff of WPF which contains several Views displaying 3D data. IMHO WPF is not the platform for further development of the app so I am searching for some ways to port it to a Universal App/Windows Store App/UWP.
The way, Microsoft is promoting, is to use Unity meaning a complete redevelopment and complicated workflows because it should be a 2D-App with some 3D views.
The other way I was looking at way using Helix-Toolkit, because it does not just offer the WPF-way of displaying 3D but also the DirectX way using SharpDX. Unfortunately the progress concerning UWP is pretty low and not currently usable in the extend I need (like displaying custom geometries etc.).
Is anybody out there who got the same problem and found a workaround?
TY!
You may also like to consider Monogame. Like Helix-Toolkit it's based on SharpDX (when it's on Windows anyway). It's not quite as "componentised" as Helix-Toolkit but it's possible to make your app UWP-first and Monogame-second.
what would be my options if i would like to create a 2D action game in WPF(for the ease of building UI Layout) without having noticeable performance loss? The game should'nt have heavy physics calculations.
I did create XNA game in the past, and i know about the MonoGame project, but i am still unsure how to use WPF as a host for MonoGame and i didnt find a downloadable example of MonoGame in WPF.
Beside MonoGame, what will be the other options, if any?
Thanks in advance!
Have a look at SlimDX, both 3D and 2D are supported.
The tutorials have examples on integrating with WPF.
You could take a look at Nick Gravelyn's article which renders XNA inside of a WPF application. I believe MonoGame's API is very similar, if not identical, to XNA, so it shouldn't be a huge problem fixing any porting issues.
http://blogs.msdn.com/b/nicgrave/archive/2010/07/25/rendering-with-xna-framework-4-0-inside-of-a-wpf-application.aspx
or
http://www.jfmajor.com/post/38447851593/monogame-in-wpf
I do remember reading somewhere that a team attempting to render WPF controls over XNA/MonoGame (I forget which) did encounter some perf issues.
I think the approach taken by many (from what I've seen) is not to use WPF for rendering a UI and instead build the UI as part of the game/engine. WPF/WinForms can be used to build an editor, but again I believe the rendering of the game/world is embedded within a WPF/WinForms application using a UserControl similar to the articles mentioned above.
So... I want to make a game, and I want to write it in C#. In the past, I've made a mario clone using C++ and OpenGL. I quite like OpenGL, but I don't know how well it's supported inside C#/WPF. Also, it might be beneficial to use an actual game library? I guess XNA is the game library for C#, so maybe I'll invest a bit of time learning that.
However, I want to use WPF form controls for my level editor... is there any way that I can embed an XNA (DirectX?) window inside a WPF app?
Specifically, I don't need any buttons or things inside the XNA/DirectX widget, just around it, so no mixing required...just need to get a graphics widget in my WPF form.
Nick Gravelyn explains how to do it on his blog.
Although, if it's just for an editor, you may find using WinForms is easier and better supported.
First of all, you should ask this on gamedev.stackexchange.com. But I've seen a tutorial embedding XNA.
You should check this question and this page. They are on Windows Forms, but they'll help.
Also check this and this articles.
Keep in mind one thing. XNA is meant to be used for the whole game, integration would be useful on making level editors like you say, but not for a full game.
WPF uses DirectX, and you can do direct "interop" here is a codeProject article on the subject. Here is an article i dug up where the author is using win-forms and WPF controls in an XNA project. Might be worth a look for you.
I've been making heavy use of the interactive 3D controls, made by some guys on the WPF team, found here http://channel9.msdn.com/posts/Charles/Daniel-Lehenbauer-and-Kurt-Berglund-Interactive-2D-controls-on-WPF-3D-Surfaces/
I've noticed there hasn't been any updates to this lately, and with WPF and .Net 4.0 just around the corner, I was just wondering if there is a better way to do 2D controls on 3D objects, or is this still the best way to do it?
Perhaps you're looking for Viewport2DVisual3D.
Viewport2DVisual3D enables you to
place interactive 2-D content on a 3-D
object. Its counterpart is the
Viewport3DVisual class, which is a 2-D
visual with 3-D children.
[EDIT] You can see an example in Matthew MacDonald's book Pro WPF in C# 2008 here on page 851. You may or may not be able to view it (not sure) but I won't reproduce here as it's not my work.