public RunCommandAction(InputCore core, string cmd, string args, bool onRelease) { Core = core; RunOnRelease = onRelease; Command = cmd; Arguments = args; }
public static RunCommandAction Parse(InputCore core, string parseable) { // Command,Arguments,WorkingDirectory,ErrorDialog,WindowStyle,RunOnRelease string[] props = parseable.Split(','); if (props.Length < 6) { throw new FormatException("Invalid property data for action 'Run Command'"); } string cmd = props[0].Replace("%comma;", ","); string args = props[1].Replace("%comma;", ","); string wd = props[2].Replace("%comma;", ","); bool ed = bool.Parse(props[3]); ProcessWindowStyle pws = (ProcessWindowStyle)Enum.Parse(typeof(ProcessWindowStyle), props[4]); bool runOnRelease = bool.Parse(props[5]); var a = new RunCommandAction(core, cmd, args, runOnRelease); a.WorkingDirectory = wd; a.ErrorDialog = ed; a.WindowStyle = pws; a.RunOnRelease = runOnRelease; return(a); }
public InputController(InputCore core, DI.Joystick dev, int index) { if (core == null) { throw new ArgumentNullException("core"); } if (dev == null) { throw new ArgumentNullException("dev"); } if (index < 0) { throw new ArgumentOutOfRangeException("index", "assertion failed: index >= 0"); } Core = core; Device = dev; ApplyExclusivity(); Device.Acquire(); ID = index; Buttons = new ButtonActions[ButtonCount]; Axes = new AxisActions[AxisCount]; for (int i = 0, max = Buttons.Length; i < max; ++i) { Buttons[i] = new ButtonActions(Core, false, i + 1); } for (int i = 0, max = Axes.Length; i < max; ++i) { Axes[i] = new AxisActions(Core, false, true, i + 1); } }
public OpenFileAction(InputCore core, string file, bool onRelease, bool showErrors) { Core = core; FileName = file; OpenOnRelease = onRelease; ErrorDialog = showErrors; }
public MousePointerAction(InputCore core, int x, int y) { Core = core; X = x; Y = y; UseIntensity = true; Continuous = true; }
public ButtonActions(InputCore core, bool enableGestures) { if (core == null) throw new ArgumentNullException("core"); Core = core; EnableGestures = enableGestures; Intensity = 1; }
public VirtualController(InputCore core) { if (core == null) { throw new ArgumentNullException("core"); } Core = core; Reset(); }
public static OpenFileAction Parse(InputCore core, string parseable) { string[] props = parseable.Split(','); if (props.Length < 3) throw new FormatException("Invalid property data for action 'Open File'"); var a = new OpenFileAction(core, props[0], bool.Parse(props[1]), bool.Parse(props[2])); return a; }
public AxisActions(InputCore core, bool enableGestures) { if (core == null) throw new ArgumentNullException("core"); Core = core; EnableGestures = enableGestures; Positive = new ButtonActions(core, enableGestures); Negative = new ButtonActions(core, enableGestures); }
public ButtonActions(InputCore core, bool enableGestures) { if (core == null) { throw new ArgumentNullException("core"); } Core = core; EnableGestures = enableGestures; Intensity = 1; }
public AxisActions(InputCore core, bool enableGestures) { if (core == null) { throw new ArgumentNullException("core"); } Core = core; EnableGestures = enableGestures; Positive = new ButtonActions(core, enableGestures); Negative = new ButtonActions(core, enableGestures); }
public static MousePointerAction Parse(InputCore core, string parseable) { string[] parts = parseable.Split(','); var mpa = new MousePointerAction(core, int.Parse(parts[0]), int.Parse(parts[1])); if (parts.Length > 2) { mpa.Continuous = bool.Parse(parts[2]); mpa.UseIntensity = bool.Parse(parts[3]); } return mpa; }
public AxisActions(InputCore core, bool enableGestures, AxisActions importMonitors) : this(core, enableGestures) { Deadzone = -1; PoleSize = -1; if (importMonitors != null) { NegativePress += importMonitors.NegativePress; NegativeRelease += importMonitors.NegativeRelease; PositivePress += importMonitors.PositivePress; PositiveRelease += importMonitors.PositiveRelease; Identifier = importMonitors.Identifier; } }
public static MouseWheelAction Parse(InputCore core, string parseable) { string[] parts = parseable.Split(','); var mwa = new MouseWheelAction(core, short.Parse(parts[0])); if (parts.Length > 1) { mwa.Continuous = bool.Parse(parts[1]); mwa.UseIntensity = bool.Parse(parts[2]); } return mwa; }
public static OpenFileAction Parse(InputCore core, string parseable) { string[] props = parseable.Split(','); if (props.Length < 3) { throw new FormatException("Invalid property data for action 'Open File'"); } var a = new OpenFileAction(core, props[0], bool.Parse(props[1]), bool.Parse(props[2])); return(a); }
public static MouseWheelAction Parse(InputCore core, string parseable) { string[] parts = parseable.Split(','); var mwa = new MouseWheelAction(core, short.Parse(parts[0])); if (parts.Length > 1) { mwa.Continuous = bool.Parse(parts[1]); mwa.UseIntensity = bool.Parse(parts[2]); } return(mwa); }
public static MousePointerAction Parse(InputCore core, string parseable) { string[] parts = parseable.Split(','); var mpa = new MousePointerAction(core, int.Parse(parts[0]), int.Parse(parts[1])); if (parts.Length > 2) { mpa.Continuous = bool.Parse(parts[2]); mpa.UseIntensity = bool.Parse(parts[3]); } return(mpa); }
public static KeyAction Parse(InputCore core, string parseable) { string[] parts = parseable.Split(','); string[] modChunks = parts[1].Split('|'); List<Keys> mods = new List<Keys> (); if (!string.IsNullOrEmpty(parts[1])) foreach (string modChunk in modChunks) mods.Add((Keys)Enum.Parse(typeof(Keys), modChunk)); var key = (Keys)Enum.Parse(typeof(Keys), parts[0]); var keyAction = new KeyAction(key, mods.ToArray()); if (parts.Length > 2 && !string.IsNullOrEmpty(parts[2])) { keyAction.Continuous = bool.Parse(parts[2]); } return keyAction; }
public InputController(InputCore core, DI.Joystick dev, int index) { if (core == null) throw new ArgumentNullException("core"); if (dev == null) throw new ArgumentNullException("dev"); if (index < 0) throw new ArgumentOutOfRangeException("index", "assertion failed: index >= 0"); Core = core; Device = dev; ApplyExclusivity(); Device.Acquire(); ID = index; Buttons = new ButtonActions[ButtonCount]; Axes = new AxisActions[AxisCount]; for (int i = 0, max = Buttons.Length; i < max; ++i) Buttons[i] = new ButtonActions(Core, false, i + 1); for (int i = 0, max = Axes.Length; i < max; ++i) Axes[i] = new AxisActions(Core, false, true, i + 1); }
public static KeyAction Parse(InputCore core, string parseable) { string[] parts = parseable.Split(','); string[] modChunks = parts[1].Split('|'); List <Keys> mods = new List <Keys> (); if (!string.IsNullOrEmpty(parts[1])) { foreach (string modChunk in modChunks) { mods.Add((Keys)Enum.Parse(typeof(Keys), modChunk)); } } var key = (Keys)Enum.Parse(typeof(Keys), parts[0]); var keyAction = new KeyAction(key, mods.ToArray()); if (parts.Length > 2 && !string.IsNullOrEmpty(parts[2])) { keyAction.Continuous = bool.Parse(parts[2]); } return(keyAction); }
public MouseButtonAction(InputCore core, Buttons button) { Core = core; Button = button; }
public MouseWheelAction(InputCore core, short value, bool continuous) : this(core, value) { Continuous = continuous; }
public static MouseButtonAction Parse(InputCore core, string parseable) { Buttons b = (Buttons)Enum.Parse(typeof(Buttons), parseable); return(new MouseButtonAction(core, b)); }
public MouseWheelAction(InputCore core, int amount) : this(core, amount, false) { }
public ButtonActions(InputCore core, bool enableGestures, object id) : this(core, enableGestures) { Identifier = id; }
public MouseWheelAction(InputCore core, int amount, bool continuous) { Core = core; Amount = amount; Continuous = continuous; }
public static RunCommandAction Parse(InputCore core, string parseable) { // Command,Arguments,WorkingDirectory,ErrorDialog,WindowStyle,RunOnRelease string[] props = parseable.Split(','); if (props.Length < 6) throw new FormatException("Invalid property data for action 'Run Command'"); string cmd = props[0].Replace("%comma;", ","); string args = props[1].Replace("%comma;", ","); string wd = props[2].Replace("%comma;", ","); bool ed = bool.Parse(props[3]); ProcessWindowStyle pws = (ProcessWindowStyle)Enum.Parse(typeof(ProcessWindowStyle), props[4]); bool runOnRelease = bool.Parse(props[5]); var a = new RunCommandAction(core, cmd, args, runOnRelease); a.WorkingDirectory = wd; a.ErrorDialog = ed; a.WindowStyle = pws; a.RunOnRelease = runOnRelease; return a; }
public void Initialize(PadTieForm form, InputCore core, Controller cc, int padNum) { mainForm = form; this.core = core; controller = cc; padNumber = padNum; padView.SelectedItemChanged += ControllerClick; deviceName.Text = cc.Device.Name; deviceGUID.Text = cc.Device.ProductGUID.ToUpper(); deviceInstanceGUID.Text = cc.Device.InstanceGUID.ToUpper(); deviceVendorID.Text = "0x" + cc.Device.VendorID.ToString("X4"); deviceProductID.Text = "0x" + cc.Device.ProductID.ToString("X4"); UpdateDeviceInfo(); deviceButtons.Text = string.Format("{0} buttons, {1} axes, {2} hats, force feedback: {3}", cc.Device.ButtonCount.ToString(), (cc.Device.AxisCount - cc.Device.HatCount).ToString(), cc.Device.HatCount.ToString(), cc.Device.ForceFeedback ? "yes" : "no"); cc.Virtual.AxisAnalogReceived += Analog; cc.Virtual.ButtonActiveReceived += Active; cc.Virtual.ButtonPressReceived += Press; cc.Virtual.ButtonReleaseReceived += Release; actionTree.ExpandAll(); currentMappings.Nodes.Clear(); foreach (var b in VirtualController.ButtonList) SetupButton(b); SetupAxisGesture(AxisGesture.LeftXNeg); SetupAxisGesture(AxisGesture.LeftXPos); SetupAxisGesture(AxisGesture.LeftYNeg); SetupAxisGesture(AxisGesture.LeftYPos); SetupAxisGesture(AxisGesture.RightXNeg); SetupAxisGesture(AxisGesture.RightXPos); SetupAxisGesture(AxisGesture.RightYNeg); SetupAxisGesture(AxisGesture.RightYPos); SetupAxisGesture(AxisGesture.DigitalXNeg); SetupAxisGesture(AxisGesture.DigitalXPos); SetupAxisGesture(AxisGesture.DigitalYNeg); SetupAxisGesture(AxisGesture.DigitalYPos); SetupAxisGesture(AxisGesture.TriggerNeg); SetupAxisGesture(AxisGesture.TriggerPos); currentMappings.ExpandAll(); RefreshDeviceMappings(); }
public AxisActions(InputCore core, bool enableGestures, bool enableDeadzone, object id) : this(core, enableGestures, id) { EnableDeadzone = enableDeadzone; }
public AxisActions(InputCore core, bool enableGestures, AxisActions importMonitors, object id) : this(core, enableGestures, importMonitors) { Identifier = id; }
public static MouseButtonAction Parse(InputCore core, string parseable) { Buttons b = (Buttons)Enum.Parse(typeof (Buttons), parseable); return new MouseButtonAction(core, b); }
public MouseController(InputCore core) { this.core = core; }
public VirtualController(InputCore core) { if (core == null) throw new ArgumentNullException("core"); Core = core; Reset(); }
public MouseWheelAction(InputCore core, short value) { Core = core; Value = value; }
static void Main(string[] args) { Console.WriteLine("Initializing PadTie..."); var core = new InputCore(IntPtr.Zero); if (core.Controllers.Count == 0) { Console.WriteLine("No gamepads detected."); } else { var vc = new VirtualController(core); var pad = core.Controllers[0]; pad.Axes[0].Analog = new VirtualController.AxisAction(vc, VirtualController.Axis.LeftX); pad.Axes[1].Analog = new VirtualController.AxisAction(vc, VirtualController.Axis.LeftX); pad.Axes[2].Analog = new VirtualController.AxisAction(vc, VirtualController.Axis.RightX); pad.Axes[3].Analog = new VirtualController.AxisAction(vc, VirtualController.Axis.RightY); // Face buttons pad.Buttons[0].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.X); pad.Buttons[1].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.A); pad.Buttons[2].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.B); pad.Buttons[3].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.Y); // Shoulder buttons pad.Buttons[4].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.Bl); pad.Buttons[5].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.Br); pad.Buttons[6].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.Tl); pad.Buttons[7].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.Tr); pad.Buttons[8].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.Back); pad.Buttons[9].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.Start); pad.Buttons[10].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.LeftAnalog); pad.Buttons[11].Raw = new VirtualController.ButtonAction(vc, VirtualController.Button.RightAnalog); /// *************** Real mapping (to virtual controller) **************** /// vc.LeftXAxis.Positive.Link = new KeyAction(User32InputHook.VK.VK_RIGHT); vc.LeftXAxis.Negative.Link = new KeyAction(User32InputHook.VK.VK_LEFT); vc.LeftYAxis.Positive.Link = new KeyAction(User32InputHook.VK.VK_DOWN); vc.LeftYAxis.Negative.Link = new KeyAction(User32InputHook.VK.VK_UP); vc.LeftXAxis.Positive.Link = new KeyAction('d'); vc.LeftXAxis.Negative.Link = new KeyAction('a'); vc.LeftYAxis.Positive.Link = new KeyAction('s'); vc.LeftYAxis.Negative.Link = new KeyAction('w'); vc.RightXAxis.Positive.Link = new MousePointerAction(core, 20, 0 ); vc.RightXAxis.Negative.Link = new MousePointerAction(core, -20, 0); vc.RightYAxis.Positive.Link = new MousePointerAction(core, 0, 20); vc.RightYAxis.Negative.Link = new MousePointerAction(core, 0, -20); vc.Br.Link = new MouseButtonAction(core, MouseButtonAction.Buttons.Left); vc.Tr.Link = new MouseButtonAction(core, MouseButtonAction.Buttons.Right); vc.X.Link = new KeyAction(User32InputHook.VK.VK_SPACE); vc.A.Link = new KeyAction('e'); vc.Bl.Link = new MouseWheelAction(core, 26, true); vc.Tl.Link = new MouseWheelAction(core, -26, true); vc.Start.Link = new KeyAction(User32InputHook.VK.VK_RETURN); vc.Back.Link = new KeyAction(User32InputHook.VK.VK_ESCAPE); vc.Back.Hold = new KeyAction(User32InputHook.VK.VK_TAB, User32InputHook.VK.VK_MENU); Console.WriteLine("Press keys..."); while (true) { core.RunIteration(); Thread.Sleep(0); } } Console.WriteLine("Press enter to exit."); Console.ReadLine(); }