정리필요2

How can I use UI elements such as buttons, checkboxes etc in Managed DirectX

ShineWithMe 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 DirectX

Added link to UI book (thanks Phil) & note about the SetDialogBoxesEnabled flag (thanks Matthieu)

You have 2 basic choices:

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

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

             



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


    • 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