Exemplo n.º 1
0
        public Axis AddAxisCommand(string name, Device device, Device.Control posControl, Device.Control negControl)
        {
            Command cmd = Commands.Find(x => x.FunctionName == name);

            if (cmd == null)
            {
                cmd = new Axis();
                cmd.FunctionName = name;

                Commands.Add(cmd);
            }

            if (cmd as Axis != null)
            {
                Axis.AxisInput axis = new Axis.AxisInput();
                axis.NegativeButton = negControl;
                BindInput(cmd, axis, device, posControl);
            }

            return(cmd as Axis);
        }
Exemplo n.º 2
0
        public Axis AddAxisKeyboardCommand(string name, Keyboard device, Keyboard.KeyCodes posKey, Keyboard.KeyCodes negKey = Keyboard.KeyCodes.Unknown)
        {
            Command cmd = Commands.Find(x => x.FunctionName == name);

            if (cmd == null)
            {
                cmd = new Axis();
                cmd.FunctionName = name;

                Commands.Add(cmd);
            }


            if (device == null)
            {
                device = ControlerLibrary.DefaultKeyboard;
            }

            if (device != null && cmd as Axis != null)
            {
                Axis.AxisInput axis = new Axis.AxisInput();
                axis.NegativeButton = device.Keys;
                BindInput(cmd, axis, device, device.Keys);

                if (negKey == Keyboard.KeyCodes.Unknown)
                {
                    axis.BoundInputName = posKey.ToString();
                }
                else
                {
                    axis.BoundInputName = posKey.ToString() + ":" + negKey.ToString();
                }
            }

            return(cmd as Axis);
        }
Exemplo n.º 3
0
        public Axis AddAxisCommand(string name, Device device = null, Device.Control control = null, AxisSignTypes sign = AxisSignTypes.Normal, InverseTypes invert = InverseTypes.Normal, NegationTypes negate = NegationTypes.Normal)
        {
            Command cmd = Commands.Find(x => x.FunctionName == name);

            if (cmd == null)
            {
                cmd = new Axis();
                cmd.FunctionName = name;

                Commands.Add(cmd);
            }

            if (cmd as Axis != null)
            {
                Axis.AxisInput axis = new Axis.AxisInput();
                BindInput(cmd, axis, device, control);

                axis.Sign      = sign;
                axis.Negation  = negate;
                axis.Inversion = (sign == AxisSignTypes.Unsigned) ? invert : InverseTypes.Normal;
            }

            return(cmd as Axis);
        }