Example #1
0
 void AddDirectionNode(TreeNode root, Controller cc, VirtualController.Axis axis, bool pos, string name)
 {
     var cap = new CapturedInput(axis, false);
     var n = root.Nodes.Add(name);
     n.Tag = new SlotNodeTag { cc = cc, slot = cap };
     if (IncludeGestures) AddGestureNodes(n, cc, cap);
 }
Example #2
0
        public CapturedInput Clone()
        {
            var ci = new CapturedInput(Button);

            ci.IsAxisGesture = IsAxisGesture;
            ci.Axis          = Axis;
            ci.IsPositive    = IsPositive;
            ci.ButtonGesture = this.ButtonGesture;
            return(ci);
        }
Example #3
0
        public void SetInput(CapturedInput input, bool alreadyMapped)
        {
            Controller.Virtual.CancelCapture();

            if (input == null) {
                lblSlot.Text = "";
                Value = null;
                return;
            }

            if (alreadyMapped)
                previousMapping = input.Clone();

            input = input.Clone();
            bool error = false;

            if (input.IsAxisGesture) {
                string name = "Unknown Axis";
                string dir = "Unknown direction";
                var slot = Controller.Virtual.GetAxis(input.Axis).GetPole(input.AxisGesture).GetGesture(input.ButtonGesture);

                name = Util.GetStickDisplayName(input.Axis);
                dir = Util.GetAxisGestureName(input.Axis, input.IsPositive);

                lblSlot.Text = "Slot: " + name + " (" + dir + ")";

                if (slot != null && previousMapping != input) {
                    lblSlot.Text += ", which is already assigned to " + Util.GetActionName(slot) + ". This action will be replaced.";
                    error = true;
                }
            } else {
                string name = input.Button.ToString();

                if (input.Button == VirtualController.Button.Bl) name = "Left Bumper";
                if (input.Button == VirtualController.Button.Br) name = "Right Bumper";
                if (input.Button == VirtualController.Button.Tl) name = "Left Trigger";
                if (input.Button == VirtualController.Button.Tr) name = "Right Trigger";

                lblSlot.Text = "Slot: " + name;

            }

            if (error) {
                lblSlot.Font = new Font(lblSlot.Font, FontStyle.Regular);
                lblSlot.ForeColor = Color.Maroon;
            } else {
                lblSlot.Font = new Font(lblSlot.Font, FontStyle.Regular);
                lblSlot.ForeColor = Control.DefaultForeColor;
            }

            if ((int)input.ButtonGesture != this.gestureBox.SelectedIndex)
                this.gestureBox.SelectedIndex = (int)input.ButtonGesture;

            Value = input;
        }
Example #4
0
 public static void Map(PadTieForm form, VirtualController vc, CapturedInput slot, InputAction action)
 {
     if (slot.IsAxisGesture) {
         form.MapAxisGesture(vc,
             slot.Axis,
             slot.IsPositive ? AxisActions.Gestures.Positive : AxisActions.Gestures.Negative,
             slot.ButtonGesture,
             action);
     } else {
         var gesture = slot.ButtonGesture;
         form.MapButton(vc, slot.Button, gesture, action);
     }
 }
Example #5
0
        void AddGestureNodes(TreeNode root, Controller cc, CapturedInput slot)
        {
            var n = root.Nodes.Add("Link");
            n.Tag = new GestureTag { cc = cc, slot = slot, g = ButtonActions.Gesture.Link };

            n = root.Nodes.Add("Tap");
            n.Tag = new GestureTag { cc = cc, slot = slot, g = ButtonActions.Gesture.Tap };

            n = root.Nodes.Add("Double Tap");
            n.Tag = new GestureTag { cc = cc, slot = slot, g = ButtonActions.Gesture.DoubleTap };

            n = root.Nodes.Add("Hold");
            n.Tag = new GestureTag { cc = cc, slot = slot, g = ButtonActions.Gesture.Hold };
        }
Example #6
0
 public void SetInput(CapturedInput input)
 {
     SetInput(input, false);
 }
Example #7
0
		public void SetInput(CapturedInput slot)
		{
			slotCapture.SetInput(slot);
		}
Example #8
0
        void AddPad(Controller cc)
        {
            var padNode = options.Nodes.Add("Pad #" + cc.Index);
            padNode.Tag = cc;
            foreach (var btn in VirtualController.ButtonList) {
                var btnNode = padNode.Nodes.Add(Util.GetButtonDisplayName(btn));
                var btnSlot = new CapturedInput(btn);
                btnNode.Tag = new SlotNodeTag { cc = cc, slot = btnSlot };
                if (IncludeGestures) AddGestureNodes(btnNode, cc, btnSlot);
            }

            AddStickNodes(padNode, cc);
        }
Example #9
0
 public CapturedInput Clone()
 {
     var ci = new CapturedInput(Button);
     ci.IsAxisGesture = IsAxisGesture;
     ci.Axis = Axis;
     ci.IsPositive = IsPositive;
     ci.ButtonGesture = this.ButtonGesture;
     return ci;
 }