Beispiel #1
0
        /// <inheritdoc />
        public void HandleKeyReleased(object sender, KeyEventArgs eventArgs)
        {
            string msg = "";

            switch (eventArgs.Code)
            {
            default:
                break;
            }

            if (!msg.Equals(""))
            {
                HandledScreen.Log(msg);
            }
        }
Beispiel #2
0
        /// <inheritdoc />
        public void HandleKeyPressed(object sender, KeyEventArgs eventArgs)
        {
            string msg = "";

            switch (eventArgs.Code)
            {
            case Keyboard.Key.Space:
                // toggle the paused state
                IsSimulationPaused = !IsSimulationPaused;
                break;

            case Keyboard.Key.T:
                // toggle orbit tracer recording
                RecordOrbitTracers = !RecordOrbitTracers;

                // every simulated body must be individually set to record tracers
                foreach (Body body in managedBodies)
                {
                    // we want to clear the screen of any orbit tracers that still exist when we turn orbit tracing
                    // off, so we must clear the previous position queues of every managed object. this has the
                    // effect of clearing the vertex arrays holding the orbit tracer vertices during the next draw step
                    body.RecordPreviousPositions = RecordOrbitTracers;
                    body.OrbitTracer.Clear();
                }

                break;

            case Keyboard.Key.W:
                // rotate the view north
                simulationDrawer.Rotate(RotationDirection.North, Constants.EulerRotationStep);
                msg = $"Rotated by {Constants.EulerRotationStep} degrees anticlockwise in the x axis. " +
                      $"View Rotation: ({simulationDrawer.XAngle},{simulationDrawer.YAngle},{simulationDrawer.ZAngle})";
                break;

            case Keyboard.Key.A:
                // rotate the view west
                simulationDrawer.Rotate(RotationDirection.West, Constants.EulerRotationStep);
                msg = $"Rotated by {Constants.EulerRotationStep} degrees clockwise in the y axis. " +
                      $"View Rotation: ({simulationDrawer.XAngle},{simulationDrawer.YAngle},{simulationDrawer.ZAngle})";
                break;

            case Keyboard.Key.S:
                // rotate the view south
                simulationDrawer.Rotate(RotationDirection.South, Constants.EulerRotationStep);
                msg = $"Rotated by {Constants.EulerRotationStep} degrees clockwise in the x axis. " +
                      $"View Rotation: ({simulationDrawer.XAngle},{simulationDrawer.YAngle},{simulationDrawer.ZAngle})";
                break;

            case Keyboard.Key.D:
                // rotate the view east
                simulationDrawer.Rotate(RotationDirection.East, Constants.EulerRotationStep);
                msg = $"Rotated by {Constants.EulerRotationStep} degrees anticlockwise in the y axis. " +
                      $"View Rotation: ({simulationDrawer.XAngle},{simulationDrawer.YAngle},{simulationDrawer.ZAngle})";
                break;

            case Keyboard.Key.Q:
                // rotate the view anti-clockwise
                simulationDrawer.Rotate(RotationDirection.Anticlockwise, Constants.EulerRotationStep);
                msg = $"Rotated by {Constants.EulerRotationStep} degrees anticlockwise in the z axis. " +
                      $"View Rotation: ({simulationDrawer.XAngle},{simulationDrawer.YAngle},{simulationDrawer.ZAngle})";
                break;

            case Keyboard.Key.E:
                // rotate the view clockwise
                simulationDrawer.Rotate(RotationDirection.Clockwise, Constants.EulerRotationStep);
                msg = $"Rotated by {Constants.EulerRotationStep} degrees anticlockwise in the z axis. " +
                      $"View Rotation: ({simulationDrawer.XAngle},{simulationDrawer.YAngle},{simulationDrawer.ZAngle})";
                break;

            case Keyboard.Key.Comma:
                // decrease the simulation speed
                break;

            case Keyboard.Key.Period:
                // increase the simulation speed
                break;

            default:
                break;
            }

            if (!msg.Equals(""))
            {
                HandledScreen.Log(msg);
            }
        }
Beispiel #3
0
 /// <inheritdoc />
 public void HandleMouseReleased(object sender, MouseButtonEventArgs eventArgs)
 {
     HandledScreen.Log($"Mouse released: {eventArgs.X} {eventArgs.Y}, {eventArgs.Button}");
 }
Beispiel #4
0
 /// <inheritdoc />
 public void HandleMouseMoved(object sender, MouseMoveEventArgs eventArgs)
 {
     HandledScreen.Log($"Mouse moved: {eventArgs.X} {eventArgs.Y}");
 }