IsKeyDown() публичный Метод

public IsKeyDown ( Keys key ) : bool
key Keys
Результат bool
Пример #1
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsKeyDown(Keys.A))
            {
                _positionB.X -= 0.1f;
            }
            if (keyboardManager.IsKeyDown(Keys.D))
            {
                _positionB.X += 0.1f;
            }
            if (keyboardManager.IsKeyDown(Keys.S))
            {
                _positionB.Y -= 0.1f;
            }
            if (keyboardManager.IsKeyDown(Keys.W))
            {
                _positionB.Y += 0.1f;
            }
            if (keyboardManager.IsKeyDown(Keys.Q))
            {
                _angleB += 0.1f * Settings.Pi;
            }
            if (keyboardManager.IsKeyDown(Keys.E))
            {
                _angleB -= 0.1f * Settings.Pi;
            }

            _transformB.Set(_positionB, _angleB);
        }
Пример #2
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.OemComma))
            {
                _realExplosion.Activate(_mousePos, _radius, _force);
            }
            if (keyboardManager.IsKeyDown(Keys.A))
            {
                _radius = MathHelper.Clamp(_radius - 0.1f, 0, 20);
            }
            if (keyboardManager.IsKeyDown(Keys.S))
            {
                _radius = MathHelper.Clamp(_radius + 0.1f, 0, 20);
            }
            if (keyboardManager.IsKeyDown(Keys.D))
            {
                _force = MathHelper.Clamp(_force - 0.1f, 0, 20);
            }
            if (keyboardManager.IsKeyDown(Keys.F))
            {
                _force = MathHelper.Clamp(_force + 0.1f, 0, 20);
            }

            base.Keyboard(keyboardManager);
        }
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsKeyDown(Keys.G))
                _circleRadius += 0.05f;
            else if (keyboardManager.IsKeyDown(Keys.H))
                _circleRadius -= 0.05f;

            if (keyboardManager.IsNewKeyPress(Keys.T))
            {
                _terrain.Decomposer++;

                if (_terrain.Decomposer > TriangulationAlgorithm.Seidel)
                    _terrain.Decomposer--;
            }
            else if (keyboardManager.IsNewKeyPress(Keys.Y))
            {
                _terrain.Decomposer--;

                if (_terrain.Decomposer < TriangulationAlgorithm.Bayazit)
                    _terrain.Decomposer++;
            }

            base.Keyboard(keyboardManager);
        }
Пример #4
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsKeyDown(Keys.D))
                _platform.BodyType = BodyType.Dynamic;
            if (keyboardManager.IsKeyDown(Keys.S))
                _platform.BodyType = BodyType.Static;
            if (keyboardManager.IsKeyDown(Keys.K))
            {
                _platform.BodyType = BodyType.Kinematic;
                _platform.LinearVelocity = new Vector2(-_speed, 0.0f);
                _platform.AngularVelocity = 0.0f;
            }

            base.Keyboard(keyboardManager);
        }
Пример #5
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsKeyDown(Keys.Q))
                _strength += 1f;

            if (keyboardManager.IsKeyDown(Keys.A))
                _strength -= 1f;

            if (keyboardManager.IsKeyDown(Keys.W))
                _simpleWind.Variation += 0.1f;

            if (keyboardManager.IsKeyDown(Keys.S))
                _simpleWind.Variation -= 0.1f;

            base.Keyboard(keyboardManager);
        }
Пример #6
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsKeyDown(Keys.C))
            {
                CreateCircle();
            }

            base.Keyboard(keyboardManager);
        }
Пример #7
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsKeyDown(Keys.A))
            {
                _leftJoint.MotorSpeed = 20.0f;
                _rightJoint.MotorSpeed = -20.0f;
            }
            if (keyboardManager.IsKeyUp(Keys.A))
            {
                _leftJoint.MotorSpeed = -10.0f;
                _rightJoint.MotorSpeed = 10.0f;
            }

            base.Keyboard(keyboardManager);
        }
Пример #8
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsKeyDown(Keys.W))
                _body.ApplyForce(_body.GetWorldVector(new Vector2(0.0f, -200.0f)));

            if (keyboardManager.IsKeyDown(Keys.A))
                _body.ApplyTorque(50.0f);

            if (keyboardManager.IsKeyDown(Keys.D))
                _body.ApplyTorque(-50.0f);

            base.Keyboard(keyboardManager);
        }
Пример #9
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.Tab))
                _switched = !_switched;

            if (keyboardManager.IsNewKeyPress(Keys.Enter))
                CuttingTools.Cut(World, _start, _end);

            if (_switched)
            {
                if (keyboardManager.IsKeyDown(Keys.A))
                    _start.X -= MoveAmount;

                if (keyboardManager.IsKeyDown(Keys.S))
                    _start.Y -= MoveAmount;

                if (keyboardManager.IsKeyDown(Keys.W))
                    _start.Y += MoveAmount;

                if (keyboardManager.IsKeyDown(Keys.D))
                    _start.X += MoveAmount;
            }
            else
            {
                if (keyboardManager.IsKeyDown(Keys.A))
                    _end.X -= MoveAmount;

                if (keyboardManager.IsKeyDown(Keys.S))
                    _end.Y -= MoveAmount;

                if (keyboardManager.IsKeyDown(Keys.W))
                    _end.Y += MoveAmount;

                if (keyboardManager.IsKeyDown(Keys.D))
                    _end.X += MoveAmount;
            }

            base.Keyboard(keyboardManager);
        }