Exemplo n.º 1
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                if (!inputTouch.IsConnected || !inputTouch.CurrentTouches.Any())
                {
                    this.Value = 0;
                    return;
                }

                bool leftTouch;
                bool rightTouch;

                if (this.isVertical)
                {
                    leftTouch  = inputTouch.CurrentTouches.Any(a => a.Position.Y < this.region.Height / 2f);
                    rightTouch = inputTouch.CurrentTouches.Any(a => a.Position.Y >= this.region.Height / 2f);
                }
                else
                {
                    leftTouch  = inputTouch.CurrentTouches.Any(a => a.Position.X < this.region.Width / 2f);
                    rightTouch = inputTouch.CurrentTouches.Any(a => a.Position.X >= this.region.Width / 2f);
                }

                this.SetValue(leftTouch, rightTouch);
            }
Exemplo n.º 2
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                if (inputGamePad.DpadRightDown)
                {
                    this.ValueX = 1;
                }
                else if (inputGamePad.DpadLeftDown)
                {
                    this.ValueX = -1;
                }
                else
                {
                    this.ValueX = 0;
                }

                if (inputGamePad.DpadDownDown)
                {
                    this.ValueY = 1;
                }
                else if (inputGamePad.DpadUpDown)
                {
                    this.ValueY = -1;
                }
                else
                {
                    this.ValueY = 0;
                }
            }
Exemplo n.º 3
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                if (!inputTouch.IsConnected || !inputTouch.CurrentTouches.Any())
                {
                    this.ValueX = 0;
                    this.ValueY = 0;
                    return;
                }

                bool leftTouch;
                bool rightTouch;
                bool upTouch;
                bool downTouch;

                upTouch    = inputTouch.CurrentTouches.Any(a => a.Position.Y < this.region.Height / 2f);
                downTouch  = inputTouch.CurrentTouches.Any(a => a.Position.Y >= this.region.Height / 2f);
                leftTouch  = inputTouch.CurrentTouches.Any(a => a.Position.X < this.region.Width / 2f);
                rightTouch = inputTouch.CurrentTouches.Any(a => a.Position.X >= this.region.Width / 2f);

                this.SetValue(upTouch, downTouch, leftTouch, rightTouch);
            }
Exemplo n.º 4
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputKeyboard.IsKeyDown(this.Key);
 }
Exemplo n.º 5
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = this.ButtonValue;
 }
Exemplo n.º 6
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputTouch.IsConnected && inputTouch.CurrentTouches.Any();
 }
Exemplo n.º 7
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputMouse.RightMouseButtonDown;
 }
Exemplo n.º 8
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputGamePad.IsRightTriggerDown(this.Threshold);
 }
Exemplo n.º 9
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.SetValue(inputMouse.LeftMouseButtonDown, inputMouse.RightMouseButtonDown);
 }
Exemplo n.º 10
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.Value = this.AxisValue;
 }
Exemplo n.º 11
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputGamePad.DpadLeftDown;
 }
Exemplo n.º 12
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.SetValue(inputKeyboard.IsKeyDown(this.Negative), inputKeyboard.IsKeyDown(this.Positive));
 }
Exemplo n.º 13
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.Value = Mathf.SignThreshold(inputGamePad.GetRightStick(this.Deadzone).Y, this.Deadzone);
 }
Exemplo n.º 14
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.ValueX = this.JoysticValue.X;
     this.ValueY = this.JoysticValue.Y;
 }
Exemplo n.º 15
0
 public virtual void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     foreach (var node in this.Nodes)
     {
         node.Update(inputKeyboard, inputMouse, inputTouch, inputGamePad);
     }
 }
Exemplo n.º 16
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                var value = inputGamePad.GetRightStick(this.Deadzone);

                this.ValueX = value.X;
                this.ValueY = value.Y;
            }
Exemplo n.º 17
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                var multiplier = this.InvertResult ? -1 : 1;

                this.Value = multiplier * Mathf.SignThreshold(
                    inputGamePad.GetLeftStick(this.Deadzone).Y,
                    this.Deadzone);
            }
Exemplo n.º 18
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                var up    = inputKeyboard.IsKeyDown(this.Up);
                var down  = inputKeyboard.IsKeyDown(this.Down);
                var left  = inputKeyboard.IsKeyDown(this.Left);
                var right = inputKeyboard.IsKeyDown(this.Right);

                this.SetValue(up, down, left, right);
            }
Exemplo n.º 19
0
        public override void Update(
            InputKeyboardComponent inputKeyboard,
            InputMouseComponent inputMouse,
            InputTouchComponent inputTouch,
            InputGamePadComponent inputGamePad)
        {
            base.Update(inputKeyboard, inputMouse, inputTouch, inputGamePad);

            var thisTickValue = 0f;

            for (var i = 0; i < this.Nodes.Count; i++)
            {
                var val = ((Node)this.Nodes[i]).Value;

                if (val == null)
                {
                    thisTickValue = this.CheckOverlap(this.Value);
                    break;
                }

                if (val == 0)
                {
                    continue;
                }

                var newResult = Math.Sign(val.Value);
                var oldResult = Math.Sign(thisTickValue);

                if (oldResult == newResult)
                {
                    continue;
                }

                if (thisTickValue == 0)
                {
                    thisTickValue = newResult;
                    continue;
                }

                thisTickValue = this.CheckOverlap(this.Value);
                break;
            }

            this.Value = thisTickValue;
        }
Exemplo n.º 20
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     if (inputGamePad.DpadDownDown)
     {
         this.Value = 1f;
     }
     else if (inputGamePad.DpadUpDown)
     {
         this.Value = -1f;
     }
     else
     {
         this.Value = 0f;
     }
 }
Exemplo n.º 21
0
        public override void Update(
            InputKeyboardComponent inputKeyboard,
            InputMouseComponent inputMouse,
            InputTouchComponent inputTouch,
            InputGamePadComponent inputGamePad)
        {
            base.Update(inputKeyboard, inputMouse, inputTouch, inputGamePad);

            var downLastFrame = this.IsDown;

            this.IsDown = false;
            foreach (var node in this.Nodes)
            {
                if (((Node)node).IsDown)
                {
                    this.IsDown = true;
                    break;
                }
            }

            this.IsPressed  = !downLastFrame && this.IsDown;
            this.IsReleased = downLastFrame && !this.IsDown;
        }
Exemplo n.º 22
0
 public abstract void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad);