Ejemplo n.º 1
0
        public XboxGamepadBackInterfaceAxis Bind(XboxInputLabel.Buttons?upLabel, XboxInputLabel.Buttons?rightLabel, XboxInputLabel.Buttons?downLabel, XboxInputLabel.Buttons?leftLabel)
        {
            IEnumerable sources = _sources;
            ButtonAxisInputSource <XboxGamepadDevice> buttonAxis = FindSource <ButtonAxisInputSource <XboxGamepadDevice> >(ref sources);

            if (buttonAxis == null)
            {
                buttonAxis = new ButtonAxisInputSource <XboxGamepadDevice>(Device);
                _sources.Add(buttonAxis);
                SourceAdded(buttonAxis);
            }

            bool isSourceModified = false;

            if (upLabel.HasValue)
            {
                buttonAxis.AddUp(Device.CreateButtonSource(upLabel.Value));
                isSourceModified = true;
            }

            if (rightLabel.HasValue)
            {
                buttonAxis.AddRight(Device.CreateButtonSource(rightLabel.Value));
                isSourceModified = true;
            }

            if (downLabel.HasValue)
            {
                buttonAxis.AddDown(Device.CreateButtonSource(downLabel.Value));
                isSourceModified = true;
            }

            if (leftLabel.HasValue)
            {
                buttonAxis.AddLeft(Device.CreateButtonSource(leftLabel.Value));
                isSourceModified = true;
            }

            if (isSourceModified)
            {
                SourceModified(buttonAxis);
            }

            return(this);
        }
Ejemplo n.º 2
0
 public MouseButtonBackInterfaceAxis(MouseDevice device) : base(device)
 {
     _source = new ButtonAxisInputSource <MouseDevice>(device);
 }
Ejemplo n.º 3
0
 public KeyboardBackInterfaceAxis(KeyboardDevice device) : base(device)
 {
     _source = new ButtonAxisInputSource <KeyboardDevice>(device);
 }