private void CmdWindow_Click(object sender, System.EventArgs e) { using (WindowTest windowTest = new WindowTest()) { windowTest.Show(); // Initialize Direct3D and the device object if (!windowTest.InitD3D(windowTest.Handle)) { MessageBox.Show("Could not initialize Direct3D."); windowTest.Dispose(); return; } else { // Load the textures and create the square to show them if (!windowTest.CreateTextures()) { MessageBox.Show("Could not initialize vertices and textures."); return; } } // Uncomment the lines below to see a smooth walking man //int desiredFrameRate = 10; //int lastTick = 0; while (!windowTest.EndTest) { // Force a Frame rate of 10 frames to second on maximum //if(System.Environment.TickCount - lastTick >= 1000 / desiredFrameRate) { windowTest.Render(); // Frame rate calculation windowTest.Text = "Window Test. Frame rate: " + DirectXLists.CalcFrameRate().ToString(); //lastTick = System.Environment.TickCount; //} Application.DoEvents(); } } }
private void CmdWindow_Click(object sender, System.EventArgs e) { using (WindowTest windowTest = new WindowTest()) { windowTest.Show(); // Initialize Direct3D and the device object if(!windowTest.InitD3D(windowTest.Handle)) { MessageBox.Show("Could not initialize Direct3D."); windowTest.Dispose(); return; } else { // Load the textures and create the square to show them if(!windowTest.CreateTextures()) { MessageBox.Show("Could not initialize vertices and textures."); return; } } // Uncomment the lines below to see a smooth walking man //int desiredFrameRate = 10; //int lastTick = 0; while(!windowTest.EndTest) { // Force a Frame rate of 10 frames to second on maximum //if(System.Environment.TickCount - lastTick >= 1000 / desiredFrameRate) { windowTest.Render(); // Frame rate calculation windowTest.Text = "Window Test. Frame rate: " + DirectXLists.CalcFrameRate().ToString(); //lastTick = System.Environment.TickCount; //} Application.DoEvents(); } } }