Esempio n. 1
0
        public void Update(ContinuousInputs inputs, GameTime gameTime)
        {
            var rotationDelta = gameTime.ElapsedGameTime.Milliseconds * MsToRadiansDeltaSpeed;

            if (inputs.TurnLeft)
            {
                _msToRadians -= rotationDelta;
            }
            else if (inputs.TurnRight)
            {
                _msToRadians += rotationDelta;
            }
            else if (inputs.Forward)
            {
                _msToRadians = 0;
            }

            if (inputs.ZoomIn)
            {
                var changeAmount = gameTime.ElapsedGameTime.Milliseconds * MsToGammaSpeed;
                ScreenBufferExtensions.GammaExponent += changeAmount;
                _message.ShowMessage($"Current gamma: {ScreenBufferExtensions.GammaExponent}");
            }
            else if (inputs.ZoomOut)
            {
                var changeAmount = gameTime.ElapsedGameTime.Milliseconds * MsToGammaSpeed;
                ScreenBufferExtensions.GammaExponent -= changeAmount;
                _message.ShowMessage($"Current gamma: {ScreenBufferExtensions.GammaExponent}");
            }

            var rotationRadians = gameTime.ElapsedGameTime.Milliseconds * _msToRadians;

            _angle += rotationRadians;
        }
Esempio n. 2
0
        public void Update(ContinuousInputs inputs, GameTime gameTime)
        {
            var drawSpeedChangeDelta = gameTime.ElapsedGameTime.Milliseconds * MsToDrawSpeedDelta;

            if (inputs.ResetZoom)
            {
                _linesToDraw   = 0;
                _msToDrawSpeed = DefaultMsToDrawSpeed;
                _screenMessage.ShowMessage($"Set speed to {_msToDrawSpeed}");
            }
            else if (inputs.ZoomIn)
            {
                _msToDrawSpeed += drawSpeedChangeDelta;
                _screenMessage.ShowMessage($"Set speed to {_msToDrawSpeed}");
            }
            else if (inputs.ZoomOut)
            {
                _msToDrawSpeed = Math.Max(0, _msToDrawSpeed - drawSpeedChangeDelta);
                _screenMessage.ShowMessage($"Set speed to {_msToDrawSpeed}");
            }

            _linesToDraw = Math.Min(_map.Lines.Length, _linesToDraw + _msToDrawSpeed * gameTime.ElapsedGameTime.Milliseconds);
        }