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.S))
                _go = !_go;

            base.Keyboard(keyboardManager);
        }
示例#3
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);
        }
示例#4
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.OemComma))
            {
                _explosion.Activate(_mousePos, _radius, _power);
            }
            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))
            {
                _power = MathHelper.Clamp(_power - 0.1f, 0, 20);
            }
            if (keyboardManager.IsKeyDown(Keys.F))
            {
                _power = MathHelper.Clamp(_power + 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 > Decomposer.Seidel)
                    _terrain.Decomposer--;
            }
            else if (keyboardManager.IsNewKeyPress(Keys.Y))
            {
                _terrain.Decomposer--;

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

            base.Keyboard(keyboardManager);
        }
示例#6
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.A))
                _auto = !_auto;

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

            base.Keyboard(keyboardManager);
        }
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            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);
            }

            base.Keyboard(keyboardManager);
        }
示例#8
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.P))
                _joint.MotorSpeed = -_joint.MotorSpeed;

            base.Keyboard(keyboardManager);
        }
        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);
        }
示例#10
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.L))
            {
                _joint.LimitEnabled = !_joint.LimitEnabled;
                _fixedJoint.LimitEnabled = !_fixedJoint.LimitEnabled;
            }

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

            base.Keyboard(keyboardManager);
        }
        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;
            }
        }
示例#12
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);
        }
示例#13
0
 public virtual void Keyboard(KeyboardManager keyboardManager)
 {
 }
        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);
        }
示例#15
0
        public virtual void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.F11))
            {
                WorldSerializer.Serialize(World, "out.xml");
            }

            if (keyboardManager.IsNewKeyPress(Keys.F12))
            {
                WorldSerializer.Deserialize(World, "out.xml");
            }
        }
示例#16
0
        public virtual void Keyboard(KeyboardManager keyboardManager)
        {
            #if XNA
            if (keyboardManager.IsNewKeyPress(Keys.F11))
                WorldSerializer.Serialize(World, "out.xml");

            if (keyboardManager.IsNewKeyPress(Keys.F12))
                WorldSerializer.Deserialize(World, "out.xml");
            #endif
        }
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsNewKeyPress(Keys.L))
            {
                _lineJoint.EnableLimit = !_lineJoint.EnableLimit;
                _fixedLineJoint.EnableLimit = !_fixedLineJoint.EnableLimit;
            }

            if (keyboardManager.IsNewKeyPress(Keys.M))
            {
                _lineJoint.MotorEnabled = !_lineJoint.MotorEnabled;
                _fixedLineJoint.MotorEnabled = !_fixedLineJoint.MotorEnabled;
            }
        }
示例#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);
        }
        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);
        }
 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();
     }
 }
示例#21
0
 public virtual void Keyboard(KeyboardManager keyboardManager)
 {
 }
示例#22
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsKeyDown(Keys.W))
            {
                Vector2 f = _body.GetWorldVector(new Vector2(0.0f, -200.0f));
                _body.ApplyForce(f);
            }
            if (keyboardManager.IsKeyDown(Keys.A))
            {
                _body.ApplyTorque(50.0f);
            }
            if (keyboardManager.IsKeyDown(Keys.D))
            {
                _body.ApplyTorque(-50.0f);
            }

            base.Keyboard(keyboardManager);
        }
示例#23
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;
         }
     }
 }
 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();
     }
 }
示例#25
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);
        }
示例#26
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;
                }
            }
        }
示例#27
0
        public override void Keyboard(KeyboardManager keyboardManager)
        {
            if (keyboardManager.IsKeyDown(Keys.C))
            {
                CreateCircle();
            }

            base.Keyboard(keyboardManager);
        }
示例#28
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);
        }
示例#29
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);
        }
示例#30
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);
        }
示例#31
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);
        }