Framework approach to building a C# -MDX Level Editor-type app?

Greetings!

There have been a few posts/replies that touch on this subject, but I wanted to provide a thread that captured as much of this knowledge and ideas as possible.

I want to build a multi-window winForms app with lots of controls (menus, treeviews, splitters, tabs, etc...) and be able to render 3D to different sections of the screen (tabbed windows, etc..).  Possibly have a model viewer in one window and a scene view in a different window.  I would like to be able to click on the model and spin it around.. or go to the scene window and fly a camera through it.

When I review the samples of 3D model viewers, etc..  they all use DirectInput for basic mouse events.  This approach doesn't seem to support the standard controls for WinForms and event handling.

What type of approach is there to build this type of app

Can I mix DirectInput and WinForms event handling (should I )

Should I make all custom controls like the SDK sample

Any advice would be greatly appreciated!

Thanks!
David Blue



Answer this question

Framework approach to building a C# -MDX Level Editor-type app?

  • ali_khankan

    Look in the custom UI sample. In the msgproc callback it calls the msgproc of the HUD which is a big switch statement that checks mouse events etc.

  • Tarung

    Hey ZMan, I love your site, i check every day!

    1.  Which SDK sample shows it using window events   I don't recall it...

    Thanks!


  • riddler_69

    Just as a note, most developers tend to render to a panel. It's also sometimes worth the while to explicitly specifiy the Handle to the panel when creating the device as I have seen some "oddities" when not.

    i.e. device = new Device(0, DeviceType.Hardware, control.Handle, CreateFlags.HardwareVertexProcessing, presentParams);

    Hope this helps.
    Take care and keep up the coding, and enjoy.


  • RickSolie

    Hey, this looks great, I'll check it out! 
    Thanks!

  • NickP

    > I want to build a multi-window winForms app with lots of
    > controls (menus, treeviews, splitters, tabs, etc...) and be
    > able to render 3D to different sections of the screen (tabbed windows, etc..). 

    If you want to write it in C#, try this:

    http://gosub.com/OpenSource/DirectXControl/DirectXControl.htm

    For what you're doing, it sounds like you should stay away from DirectInput, and stick with regular windows events.

    -Jeremy


  • C.P.Hardcastle

    Ahhh,  didn't know that,  I'll give it a whirl,

    THANKS!!

  • mnemonic

    Will do, thanks!!

    I'm making better progress... i've decided to simplify my main form. 

    I was rendering to a pictureBox on a tab page, and had a problem keeping the models drawn on it when I would switch back and forth between pages.  I had a devil of the time figuring out which events were being fired... it was like the last event was clearing my picture... i could actually see the model drawn for a half-second, then it was gone.

    I found a great article on MSDN about a piece of code that you can use to track each event being fired ...http://msdn.microsoft.com/msdnmag/issues/04/05/CQA/default.aspx

    Excellent for debugging!


  • Rigeto

    I think its all possible.

    Yes you can do multiple forms and windows, I've not seen any good sample code to do it and I've not got round to writing any myself yet. Be the first :-)

    You don't need to use DirectInput - the sample SDK doesn't for example. It uses regular windows events. (OK they are low level windows events rather than .Net events but same difference in this case)

    >Can I mix DirectInput and WinForms event handling (should I )
    I don't know this one....

    >Should I make all custom controls like the SDK sample
    Probably not if you want the app to feel 'windows' like. Put your rendering in a picturebox and your other controls around it. Thats how most of the level editor things I've seen seem to work. However it is fine to do it either way.



  • Framework approach to building a C# -MDX Level Editor-type app?