DirectX with MDI
-
i'm trying to get a directx form to display as a child form in an mdi. i can't get it to run however. my reasoning behind this is so that i can have a configuration form and a directx windows up at the same time. then when i adjust the vales in the config window it updates the cooresponding values for the directx scene. i just can't get the directx form to keep rendering itself. here's some snippets, i hope you can help me. when the MDI form loads...
RJSS.frmMain frm1 = new RJSS.frmMain(); frm1.MdiParent = this; frm1.Show(); RJSS.frmDD frm2 = new RJSS.frmDD(); frm2.MdiParent = this; frm2.Show();
declarations in the directx form...private DD.Device ddDevice; private O2.SpriteManager sm; private Open.HighResolutionTimer hrt;
when the directx form loads...DD.PresentParameters pres = new DD.PresentParameters(); pres.Windowed = true; pres.SwapEffect = DD.SwapEffect.Discard; this.ddDevice = new DD.Device(0, DD.DeviceType.Hardware, this, DD.CreateFlags.SoftwareVertexProcessing, pres); this.hrt = new Open.HighResolutionTimer(); this.sm = new O2.SpriteManager();
this is what won't process. if i try to call this function the program just crashes out stating An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dllprotected void Render() { this.sm.Update(this.hrt.ElapsedTime); this.ddDevice.Clear(DD.ClearFlags.Target, Color.Black, 1.0f, 0); this.ddDevice.BeginScene(); this.sm.Draw(this.ddDevice); this.ddDevice.EndScene(); this.ddDevice.Present(); }
any help is greatly appreciated. thanks, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.