Beispiel #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);
            }
Beispiel #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;
                }
            }
Beispiel #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);
            }
Beispiel #4
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputKeyboard.IsKeyDown(this.Key);
 }
Beispiel #5
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = this.ButtonValue;
 }
Beispiel #6
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputTouch.IsConnected && inputTouch.CurrentTouches.Any();
 }
Beispiel #7
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputMouse.RightMouseButtonDown;
 }
Beispiel #8
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputGamePad.IsRightTriggerDown(this.Threshold);
 }
Beispiel #9
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.SetValue(inputMouse.LeftMouseButtonDown, inputMouse.RightMouseButtonDown);
 }
Beispiel #10
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.Value = this.AxisValue;
 }
Beispiel #11
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputGamePad.DpadLeftDown;
 }
Beispiel #12
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.SetValue(inputKeyboard.IsKeyDown(this.Negative), inputKeyboard.IsKeyDown(this.Positive));
 }
Beispiel #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);
 }
Beispiel #14
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.ValueX = this.JoysticValue.X;
     this.ValueY = this.JoysticValue.Y;
 }
Beispiel #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);
     }
 }
Beispiel #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;
            }
Beispiel #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);
            }
Beispiel #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);
            }
Beispiel #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;
        }
Beispiel #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;
     }
 }
Beispiel #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;
        }
Beispiel #22
0
 public abstract void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad);