Exemple #1
0
        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
        }
Exemple #2
0
        public void Render()
        {
            measure.Stop();
            time = (float)measure.Time();
            // time=(float)(((int)(measure.Time()*10000))/10000f);
            measure.Start();
            // time=0.05f;
            doPhysics();
            supertime += time;

            // Setup the world, view, and projection matrices
            SetupMatrices();

            gunshots.Render();
            //	myAirplane.Render(m_matOrientation);

            Rectangle rect = new Rectangle(10, 20, 0, 0);

            d3dxfont.DrawText("Tiempo: " + supertime + " Time: " + time, rect, DrawTextFormat.None, Color.AntiqueWhite);
            rect.Y = 30;
            d3dxfont.DrawText("Speed: " + (speed * 60 * 60) / 1000, rect, DrawTextFormat.None, Color.AntiqueWhite);
            rect.Y = 40;
            d3dxfont.DrawText("Height: " + height + " Y: " + m_vPosition.Y + " X: " + m_vPosition.X + " Z: " + m_vPosition.Z, rect, DrawTextFormat.None, Color.AntiqueWhite);
            rect.Y = 50;
            d3dxfont.DrawText("Wing: " + wingangleattack * (180 / Math.PI) + "  Tail: " + tailangle, rect, DrawTextFormat.None, Color.AntiqueWhite);

            //		d3dx8.DrawText(d3dxfont, unchecked((int)0xFF00FFFF), "GraSpeed: "+gravitySpeed, ref rect, 0);
            rect.Y = 60;
            d3dxfont.DrawText("LiftSpeed: " + liftSpeed, rect, DrawTextFormat.None, Color.AntiqueWhite);
            rect.Y = 70;
            d3dxfont.DrawText("Brake: " + gearbrake, rect, DrawTextFormat.None, Color.AntiqueWhite);
            //		d3dx8.DrawText(d3dxfont, unchecked((int)0xFF00FFFF), "Distancia: "+m_vVelocity.z/0.03, ref rect, 0);
            rect.Y = 80;
            d3dxfont.DrawText("Rotor: " + rotor, rect, DrawTextFormat.None, Color.AntiqueWhite);
        }