-
How can I use UI elements such as buttons, checkboxes etc in Managed DirectX정리필요2 2008. 7. 10. 21:01
DX환경에서 GUI를 구성하는 2가지 방법에 대해 말하고 있다...
출처 : http://www.thezbuffer.com/
How can I use UI elements such as buttons, checkboxes etc in Managed DirectXAdded link to UI book (thanks Phil) & note about the SetDialogBoxesEnabled flag (thanks Matthieu)
You have 2 basic choices:
-
Use regular windows controls
Its possible to overlay windows controls over a form or other control that uses Managed DirectX, however depending on your rendering method and the control flags set you may see flickering. In addition when you switch to a full screen device windows forms controls will not render unless you have set the SetDialogBoxesEnabled (native doc has more details). Alternatively you can fake full screen by drawing a full screen window with all of the borders removed.
Generally this method is best used for level editors etc, where the rendering output is in a panel and the forms controls surround it.
-
Render your own controls on the DirectX device
This is not a trivial exercise and there are no form designers available as there are with Windows Forms. There are several already written code bases that you can use, extend or just study:
- Managed DirectX SDK sample framework: This code comes with the DirectX SDK and is written in C# (Unofficial VB.Net conversion). The source code is provided with little to no restrictions on use. Windows Forms programmers will find it subtly different but fairly easy to use. Documentation is non existent (C++ docs!) and support is through the MSDN forums. The UI us used by all of the SDK samples and the best example of usage is the CustomUI sample. Vorn has written a quickstart guide which may help some.
- CEGUI is the managed port of Crazy Eddie's GUI system and is released under the GNU or LGPL licenses. The source is available from the Realmforge/Axiom source locations. The source is in C# and support is available in the Realmforge forums. I was unable to find any documentation of the managed port however there is native documentation.
- C-Unit tutorials: Chad has a set of tutorials about building your own UI widgets using managed DirectX. Parts 1, 2, 3, 4. The code is in C#, and I see no license information in the source or on the site. Documentation is in the code and tutorials and support is through email to Chad.
- The Brume Engine has its own UI engine which can be seen in this screen shot. As I mentioned the source has to be extracted from CVS if you want to look and is released under the LGPL license. There is no documentation or sample code for the UI elements and support is through the sourceforge forums.
- There is a book about using DirectX to create UIs available. I've not read it myself but it might be worth checking out. No managed code unfortunately. DirectX9 User Interfaces
-