public MyAirplane(Device d3d, System.Drawing.Font font, Microsoft.DirectX.DirectSound.Device dsound, Landscape l) { measure.Start(); d3dxfont = new Microsoft.DirectX.Direct3D.Font(d3d, font); myAirplane = new airplane(d3d); landscape = l; idevice = new InputDevice(); d3dDevice = d3d; gunshots = new ShootingClass(d3d, dsound); // didev=di; rotation = new Quaternion(); rotation = Quaternion.Identity; rotation.RotateYawPitchRoll((float)Math.PI, 0f, 0f); // the airplane starts with 20ยบ angle (landed) // rotation.RotateYawPitchRoll(0, -0.34906585f, 0); m_matOrientation = new Matrix(); m_matOrientation.Translate(0, 0, 0); m_vPosition = new Vector3(1, 1, -10); prepos = m_vPosition; m_vVelocity = new Vector3(0, 0, 0); gravityVector = new Vector3(0, 0, 0); liftVector = new Vector3(0, 0, 0); trustVector = new Vector3(0, 0, 0); dragVector = new Vector3(0, 0, 0); speedVector = new Vector3(0, 0, 0); mass = weight / gravity; m_matView = new Matrix(); oldView = new Matrix(); }
static void Main() { Form1 app = new Form1(); app.InitializeGraphics(); app.Show(); timer measure = new timer(); measure.Start(); while (app.Created) { measure.Stop(); /* If you can generate more than 50 frames per second (1/50 = 0.02) * your hardware is pretty cool but we don't really need to * consume so much cpu so let it wait a little */ while (measure.Time() < 0.02d) { Application.DoEvents(); measure.Stop(); } measure.Start(); app.Render(); Application.DoEvents(); // Thread.Sleep(40); } // should clean up 3d and exit }