public LookAction(ControllerMapping parent) : base(parent) { _thread = new Thread(CursorThreadCode); _thread.IsBackground = true; _thread.Name = "ControllerX Cursor Govenor"; _thread.Start(); _handler.OnThumbStickReleased += () => { Console.Out.WriteLine("Thumb released."); movementX = 0; movementY = 0; deltaX = 0; deltaY = 0; }; }
private void btnInitialize_Click(object sender, RoutedEventArgs e) { mapping = ControllerMapping.Default(); numSensitivity.Value = (int)mapping.Configuration.CursorSensitivity; numMovementThreshold.Value = (int)(mapping.Configuration.StickMoveThreshold * 100); numCursorThreshold.Value = (int)(mapping.Configuration.StickLookThreshold * 100); numLeftDeadzone.Value = mapping.Configuration.StickLeftDeadzone; numRightDeadzone.Value = mapping.Configuration.StickRightDeadzone; controller = new Controller(UserIndex.One); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(10); timer.Tick += Timer_Tick; timer.Start(); }
public static ControllerMapping Default() { ControllerMapping controllerMapping = new ControllerMapping(); controllerMapping.Map(Mapping.Create(GamepadButtonFlags.RightThumb, new LookAction())); controllerMapping.Map(Mapping.Create(GamepadButtonFlags.LeftThumb, new MoveAction())); controllerMapping.Map(Mapping.Create(GamepadButtonFlags.RightShoulder, new MouseAction(Action.MouseOption.Left))); controllerMapping.Map(Mapping.Create(GamepadButtonFlags.LeftShoulder, new MouseAction(Action.MouseOption.Right))); //mapping._controlMapping.Add(Mapping.Create(GamepadButtonFlags., new MouseAction(Action.MouseOption.Right))); //mapping._controlMapping.Add(Mapping.Create(GamepadButtonFlags.LeftShoulder, new MouseAction(Action.MouseOption.Right))); //mapping._controlMapping.Add(Mapping.Create(GamepadButtonFlags., new MouseAction(Action.MouseOption.Left))); return(controllerMapping); }
protected StickAction(ControllerMapping parent) : base(parent) { _handler = new ThumbStickHandler(); _handler.OnThumbStickMoved += Handler_OnThumbStickMoved; }
protected Action(ControllerMapping parent) { MappingParent = parent; }
public MouseAction(MouseOption option, ControllerMapping parent) : base(parent) { Option = option; }
public MoveAction(ControllerMapping parent) : base(parent) { }
public ButtonAction(VirtualKeyCode key, ControllerMapping parent) : base(parent) { Key = key; }