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

public IsNewKeyPress ( Keys key ) : bool
key Keys
Результат bool
Пример #1
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.A))
                _auto = !_auto;

            if (keyboardManager.IsNewKeyPress(Keys.G))
                Generate();

            base.Keyboard(keyboardManager);
        }
Пример #2
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.L))
                _joint.LimitEnabled = !_joint.LimitEnabled;

            if (keyboardManager.IsNewKeyPress(Keys.M))
                _joint.MotorEnabled = !_joint.MotorEnabled;

            if (keyboardManager.IsNewKeyPress(Keys.S))
                _joint.MotorSpeed = -_joint.MotorSpeed;

            base.Keyboard(keyboardManager);
        }
Пример #3
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);
        }
Пример #4
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            base.Keyboard(keyboardManager);

            if (keyboardManager.IsNewKeyPress(Keys.C))
                _ground.IgnoreCCD = !_ground.IgnoreCCD;
        }
Пример #5
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.A))
                _segments++;

            if (keyboardManager.IsNewKeyPress(Keys.S) && _segments > 0)
                _segments--;

            if (keyboardManager.IsNewKeyPress(Keys.D))
                Create(0);

            if (keyboardManager.IsNewKeyPress(Keys.F))
                Create(1);

            base.Keyboard(keyboardManager);
        }
Пример #6
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.OemComma))
            {
                if (_bullet != null)
                {
                    World.RemoveBody(_bullet);
                    _bullet = null;
                }

                {
                    CircleShape shape = new CircleShape(0.25f, 20);

                    _bullet = BodyFactory.CreateBody(World);
                    _bullet.BodyType = BodyType.Dynamic;
                    _bullet.IsBullet = true;
                    _bullet.Position = new Vector2(-31.0f, 5.0f);

                    Fixture fixture = _bullet.CreateFixture(shape);
                    fixture.Restitution = 0.05f;

                    _bullet.LinearVelocity = new Vector2(400.0f, 0.0f);
                }
            }

            base.Keyboard(keyboardManager);
        }
Пример #7
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.T))
                CreateBody(LoadNextDataFile());

            base.Keyboard(keyboardManager);
        }
Пример #8
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.A))
                _positionB.X -= 0.1f;
            if (keyboardManager.IsNewKeyPress(Keys.D))
                _positionB.X += 0.1f;
            if (keyboardManager.IsNewKeyPress(Keys.S))
                _positionB.Y -= 0.1f;
            if (keyboardManager.IsNewKeyPress(Keys.W))
                _positionB.Y += 0.1f;
            if (keyboardManager.IsNewKeyPress(Keys.Q))
                _angleB += 0.1f * Settings.Pi;
            if (keyboardManager.IsNewKeyPress(Keys.E))
                _angleB -= 0.1f * Settings.Pi;

            _transformB.Set(_positionB, _angleB);
        }
Пример #9
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.C) && _fixture2 == null)
            {
                CircleShape shape = new CircleShape(3.0f, 10);
                shape.Position = new Vector2(0.5f, -4.0f);
                _fixture2 = _body.CreateFixture(shape);
                _body.Awake = true;
            }

            if (keyboardManager.IsNewKeyPress(Keys.D) && _fixture2 != null)
            {
                _body.DestroyFixture(_fixture2);
                _fixture2 = null;
                _body.Awake = true;
            }

            base.Keyboard(keyboardManager);
        }
Пример #10
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);
        }
        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);
        }
Пример #12
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.B))
            {
                for (int i = 0; i < 4; ++i)
                {
                    if (_bodies[i] != null)
                    {
                        World.RemoveBody(_bodies[i]);
                        _bodies[i] = null;
                        break;
                    }
                }
            }

            if (keyboardManager.IsNewKeyPress(Keys.J))
            {
                for (int i = 0; i < 8; ++i)
                {
                    if (_joints[i] != null)
                    {
                        World.RemoveJoint(_joints[i]);
                        _joints[i] = null;
                        break;
                    }
                }
            }

            base.Keyboard(keyboardManager);
        }
Пример #13
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            // Add Circles
              if (keyboardManager.IsNewKeyPress(Keys.Q))
            AddCircle(3, 8);

              // Add Circles
              if (keyboardManager.IsNewKeyPress(Keys.W))
            AddCircle(4, 16);

              // Add Circles
              if (keyboardManager.IsNewKeyPress(Keys.E))
            AddCircle(5, 32);

              // Add Rectangle
              if (keyboardManager.IsNewKeyPress(Keys.A))
            AddRectangle(4, 8);

              // Add Rectangle
              if (keyboardManager.IsNewKeyPress(Keys.S))
            AddRectangle(5, 2);

              // Add Rectangle
              if (keyboardManager.IsNewKeyPress(Keys.D))
            AddRectangle(2, 5);

              // Perform a Union
              if (keyboardManager.IsNewKeyPress(Keys.Space))
              {
            if (_subject != null && _clip != null)
              DoBooleanOperation(YuPengClipper.Union(_subject, _clip, out _err));
              }

              // Perform a Subtraction
              if (keyboardManager.IsNewKeyPress(Keys.Back))
              {
            if (_subject != null && _clip != null)
              DoBooleanOperation(YuPengClipper.Difference(_subject, _clip, out _err));
              }

              // Perform a Intersection
              if (keyboardManager.IsNewKeyPress(Keys.LeftShift))
              {
            if (_subject != null && _clip != null)
              DoBooleanOperation(YuPengClipper.Intersect(_subject, _clip, out _err));
              }

              // Select Subject
              if (keyboardManager.IsNewKeyPress(Keys.D1))
              {
            if (_selected != null)
            {
              if (_clip == _selected)
            _clip = null;

              _subject = _selected;
            }
              }

              // Select Clip
              if (keyboardManager.IsNewKeyPress(Keys.D2))
              {
            if (_selected != null)
            {
              if (_subject == _selected)
            _subject = null;

              _clip = _selected;
            }
              }
        }
Пример #14
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.F))
            {
                _joint2.MotorEnabled = !_joint2.MotorEnabled;
                _joint2.BodyB.Awake = true;
            }
            if (keyboardManager.IsNewKeyPress(Keys.M))
            {
                _joint1.MotorEnabled = !_joint1.MotorEnabled;
                _joint1.BodyB.Awake = true;
            }

            base.Keyboard(keyboardManager);
        }
Пример #15
0
        public virtual void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.F11))
                WorldSerializer.Serialize(World, "out.xml");

            if (keyboardManager.IsNewKeyPress(Keys.F12))
            {
                World = WorldSerializer.Deserialize("out.xml");
                Initialize();
            }
        }
Пример #16
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.A))
                _motorJoint.MotorSpeed = -_motorSpeed;
            if (keyboardManager.IsNewKeyPress(Keys.S))
                _motorJoint.MotorSpeed = 0.0f;
            if (keyboardManager.IsNewKeyPress(Keys.D))
                _motorJoint.MotorSpeed = _motorSpeed;
            if (keyboardManager.IsNewKeyPress(Keys.M))
                _motorJoint.MotorEnabled = !_motorJoint.MotorEnabled;

            base.Keyboard(keyboardManager);
        }
Пример #17
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.A))
            {
                _spring1.MotorSpeed = _speed;
            }
            else if (keyboardManager.IsNewKeyPress(Keys.S))
            {
                _spring1.MotorSpeed = 0.0f;
            }
            else if (keyboardManager.IsNewKeyPress(Keys.D))
            {
                _spring1.MotorSpeed = -_speed;
            }
            else if (keyboardManager.IsNewKeyPress(Keys.Q))
            {
                _hz = Math.Max(0.0f, _hz - 1.0f);
                _spring1.Frequency = _hz;
                _spring2.Frequency = _hz;
            }
            else if (keyboardManager.IsNewKeyPress(Keys.E))
            {
                _hz += 1.0f;
                _spring1.Frequency = _hz;
                _spring2.Frequency = _hz;
            }

            base.Keyboard(keyboardManager);
        }
Пример #18
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.D1))
            {
                Create(0);
            }
            if (keyboardManager.IsNewKeyPress(Keys.D2))
            {
                Create(1);
            }
            if (keyboardManager.IsNewKeyPress(Keys.D3))
            {
                Create(2);
            }
            if (keyboardManager.IsNewKeyPress(Keys.D4))
            {
                Create(3);
            }
            if (keyboardManager.IsNewKeyPress(Keys.D5))
            {
                Create(4);
            }
            if (keyboardManager.IsNewKeyPress(Keys.A))
            {
                for (int i = 0; i < MaxBodies; i += 2)
                {
                    if (_bodies[i] != null)
                    {
                        bool enabled = _bodies[i].Enabled;
                        _bodies[i].Enabled = !enabled;
                    }
                }
            }
            if (keyboardManager.IsNewKeyPress(Keys.D))
            {
                DestroyBody();
            }

            base.Keyboard(keyboardManager);
        }
Пример #19
0
 public override void Keyboard(KeyboardManager keyboardManager)
 {
     if (keyboardManager.IsNewKeyPress(Keys.A))
     {
         _automated = !_automated;
     }
     if (keyboardManager.IsNewKeyPress(Keys.C))
     {
         CreateProxy();
     }
     if (keyboardManager.IsNewKeyPress(Keys.D))
     {
         DestroyProxy();
     }
     if (keyboardManager.IsNewKeyPress(Keys.M))
     {
         MoveProxy();
     }
 }
Пример #20
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.D1))
            {
                Create(0);
            }
            if (keyboardManager.IsNewKeyPress(Keys.D2))
            {
                Create(1);
            }
            if (keyboardManager.IsNewKeyPress(Keys.D3))
            {
                Create(2);
            }
            if (keyboardManager.IsNewKeyPress(Keys.D4))
            {
                Create(3);
            }
            if (keyboardManager.IsNewKeyPress(Keys.D5))
            {
                Create(4);
            }
            if (keyboardManager.IsNewKeyPress(Keys.D))
            {
                DestroyBody();
            }

            base.Keyboard(keyboardManager);
        }
Пример #21
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.J))
            {
                if (_useRopeJoint)
                {
                    _useRopeJoint = false;
                    World.RemoveJoint(_rj);
                }
                else
                {
                    _useRopeJoint = true;
                    World.AddJoint(_rj);
                }
            }

            base.Keyboard(keyboardManager);
        }
Пример #22
0
 public override void Keyboard(KeyboardManager keyboardManager)
 {
     if (keyboardManager.IsNewKeyPress(Keys.D1))
     {
         Create(0);
     }
     if (keyboardManager.IsNewKeyPress(Keys.D2))
     {
         Create(1);
     }
     if (keyboardManager.IsNewKeyPress(Keys.D3))
     {
         Create(2);
     }
     if (keyboardManager.IsNewKeyPress(Keys.D4))
     {
         Create(3);
     }
     if (keyboardManager.IsNewKeyPress(Keys.D5))
     {
         Create(4);
     }
     if (keyboardManager.IsNewKeyPress(Keys.D))
     {
         DestroyBody();
     }
     if (keyboardManager.IsNewKeyPress(Keys.M))
     {
         switch (_mode)
         {
             case RayCastMode.Closest:
                 _mode = RayCastMode.Any;
                 break;
             case RayCastMode.Any:
                 _mode = RayCastMode.Multiple;
                 break;
             case RayCastMode.Multiple:
                 _mode = RayCastMode.Closest;
                 break;
             default:
                 break;
         }
     }
 }