Example #1
0
        private void CmdFullScreen_Click(object sender, System.EventArgs e)
        {
            using (FullScreenTest fullScreenTest = new FullScreenTest()) {
                fullScreenTest.Show();

                // Initialize Direct3D and the device object
                if (!fullScreenTest.InitD3D(fullScreenTest.Handle))
                {
                    MessageBox.Show("Could not initialize Direct3D.");
                    fullScreenTest.Dispose();
                    return;
                }
                else
                {
                    // Load the textures and create the square to show them
                    if (!fullScreenTest.CreateTextures())
                    {
                        MessageBox.Show("Could not initialize vertices and textures.");
                        fullScreenTest.DisposeD3D();
                        fullScreenTest.Dispose();
                        return;
                    }
                }

                // If we have no errors, then enter the rendering loop
                while (!fullScreenTest.EndTest)
                {
                    try {
                        fullScreenTest.Render();
                        Application.DoEvents();
                    }
                    catch {
                        // Ignore any errors that may arise when the window close
                    }
                }
            }
        }
        private void CmdFullScreen_Click(object sender, System.EventArgs e)
        {
            using (FullScreenTest fullScreenTest = new FullScreenTest()) {
                fullScreenTest.Show();

                // Initialize Direct3D and the device object
                if(!fullScreenTest.InitD3D(fullScreenTest.Handle)) {
                    MessageBox.Show("Could not initialize Direct3D.");
                    fullScreenTest.Dispose();
                    return;
                }
                else {
                    // Load the textures and create the square to show them
                    if(!fullScreenTest.CreateTextures()) {
                        MessageBox.Show("Could not initialize vertices and textures.");
                        fullScreenTest.DisposeD3D();
                        fullScreenTest.Dispose();
                        return;
                    }
                }

                // If we have no errors, then enter the rendering loop
                while(!fullScreenTest.EndTest) {
                    try {
                        fullScreenTest.Render();
                        Application.DoEvents();
                    }
                    catch {
                        // Ignore any errors that may arise when the window close
                    }
                }
            }
        }