示例#1
0
    private void ProcessInput()
    {
        //Get input
        KeyboardState kbState = input.GetInputState();

        if (kbState == null)
        {
            return;
        }
        if (kbState[Key.Up])
        {
            camera.MoveRel(0, 0, elapsedTime * 10);
        }
        if (kbState[Key.Down])
        {
            camera.MoveRel(0, 0, -elapsedTime * 10);
        }
        if (kbState[Key.Right])
        {
            camera.RotateRel(0, elapsedTime, 0);
        }
        if (kbState[Key.Left])
        {
            camera.RotateRel(0, -elapsedTime, 0);
        }
    }
    /// <summary>
    /// Called once per frame, the call is the entry point for 3d rendering. This
    /// function sets up render states, clears the viewport, and renders the scene.
    /// </summary>
    protected override void Render()
    {
        input.GetInputState();

        //Clear the backbuffer to a Blue color
        device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Blue, 1.0f, 0);
        //Begin the scene
        device.BeginScene();
        drawingFont.DrawText(5, 5, Color.White, "X: " + destination.X + " Y: " + destination.Y);
        device.Transform.World = Matrix.Identity;
        spaceSphere.DrawSubset(0);
        device.EndScene();
    }
示例#3
0
    /// <summary>
    /// Called once per frame, the call is the entry point for 3d rendering. This
    /// function sets up render states, clears the viewport, and renders the scene.
    /// </summary>
    protected override void Render()
    {
        input.GetInputState();

        //Clear the backbuffer to a Blue color
        device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Blue, 1.0f, 0);
        //Begin the scene
        device.BeginScene();
        drawingFont.DrawText(5, 5, Color.White, "X: " + destination.X + " Y: " + destination.Y);

        //
        // TODO: Insert application rendering code here.
        //
        device.EndScene();
    }
示例#4
0
    /// <summary>
    /// Called once per frame, the call is the entry point for 3d rendering. This
    /// function sets up render states, clears the viewport, and renders the scene.
    /// </summary>
    protected override void Render()
    {
        input.GetInputState();

        //Clear the backbuffer to a Blue color
        device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Gray, 1.0f, 0);
        //Begin the scene
        device.BeginScene();

        device.Lights[0].Enabled = true;

        // Setup the world, view, and projection matrices
        Matrix m = new Matrix();

        if (destination.Y != 0)
        {
            y += DXUtil.Timer(DirectXTimer.GetElapsedTime) * (destination.Y * 25);
        }

        if (destination.X != 0)
        {
            x += DXUtil.Timer(DirectXTimer.GetElapsedTime) * (destination.X * 25);
        }

        m  = Matrix.Translation(0.0f, 0.75f, 0.0f);
        m *= Matrix.RotationY(y);
        m *= Matrix.RotationX(x);

        device.Transform.World = m;
        // Render the teapot.
        teapot.DrawSubset(0);

        m  = new Matrix();
        m  = Matrix.Translation(0.0f, -0.75f, 0.0f);
        m *= Matrix.RotationY(y);
        m *= Matrix.RotationX(x);

        device.Transform.World = m;
        //render the box
        box.DrawSubset(0);

        device.Transform.View       = Matrix.LookAtLH(new Vector3(0.0f, 3.0f, -5.0f), new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f));
        device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4, 1.0f, 1.0f, 100.0f);


        device.EndScene();
    }
示例#5
0
    /// <summary>
    /// Called once per frame, the call is the entry point for 3d rendering. This
    /// function sets up render states, clears the viewport, and renders the scene.
    /// </summary>
    protected override void Render()
    {
        input.GetInputState();

        //Clear the backbuffer to a Blue color
        device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Blue, 1.0f, 0);
        //Begin the scene
        device.BeginScene();
        drawingFont.DrawText(null, "X: " + destination.X + " Y: " + destination.Y,
                             new Rectangle(5, 5, this.Width, this.Height),
                             DrawTextFormat.NoClip | DrawTextFormat.ExpandTabs | DrawTextFormat.WordBreak, Color.White);

        //
        // TODO: Insert application rendering code here.
        //
        device.EndScene();
    }
示例#6
0
    private void ProcessInput()
    {
        //Get input
        KeyboardState kbState = input.GetInputState();

        if (kbState == null)
        {
            return;
        }
        if (kbState[Key.W] || kbState[Key.Up])
        {
            kbThrust = true;
        }
        else
        {
            kbThrust = false;
        }
        if (kbState[Key.C] && !cPressed)
        {
            cPressed = true;
            SelectNextCameraMode();
        }
        if (!kbState[Key.C])
        {
            cPressed = false;
        }

        if (kbState[Key.F5] && !f5Pressed)
        {
            f5Pressed          = true;
            playerShip.Sounds |= Sounds.Taunt;
        }
        if (!kbState[Key.F5])
        {
            f5Pressed = false;
        }
        if (kbState[Key.F6] && !f6Pressed)
        {
            f6Pressed          = true;
            playerShip.Sounds |= Sounds.Dude1;
        }
        if (!kbState[Key.F6])
        {
            f6Pressed = false;
        }
        if (kbState[Key.F7] && !f7Pressed)
        {
            f7Pressed          = true;
            playerShip.Sounds |= Sounds.Dude2;
        }
        if (!kbState[Key.F7])
        {
            f7Pressed = false;
        }
        if (kbState[Key.F8] && !f8Pressed)
        {
            f8Pressed          = true;
            playerShip.Sounds |= Sounds.Dude3;
        }
        if (!kbState[Key.F8])
        {
            f8Pressed = false;
        }
        if (kbState[Key.F9] && !f9Pressed)
        {
            f9Pressed          = true;
            playerShip.Sounds |= Sounds.Dude4;
        }
        if (!kbState[Key.F9])
        {
            f9Pressed = false;
        }
        if (kbState[Key.F10] && !f10Pressed)
        {
            f10Pressed         = true;
            playerShip.Sounds |= Sounds.Dude1;
        }
        if (!kbState[Key.F10])
        {
            f10Pressed = false;
        }
        if (kbState[Key.Space] && !spacePressed)
        {
            spacePressed = true;
            playerShip.EnterHyper();
        }
        if (!kbState[Key.Space])
        {
            spacePressed = false;
        }
    }