Beispiel #1
0
 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;
     };
 }
Beispiel #2
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);
        }
Beispiel #4
0
 protected StickAction(ControllerMapping parent) : base(parent)
 {
     _handler = new ThumbStickHandler();
     _handler.OnThumbStickMoved += Handler_OnThumbStickMoved;
 }
Beispiel #5
0
 protected Action(ControllerMapping parent)
 {
     MappingParent = parent;
 }
Beispiel #6
0
 public MouseAction(MouseOption option, ControllerMapping parent) : base(parent)
 {
     Option = option;
 }
Beispiel #7
0
 public MoveAction(ControllerMapping parent) : base(parent)
 {
 }
Beispiel #8
0
 public ButtonAction(VirtualKeyCode key, ControllerMapping parent) : base(parent)
 {
     Key = key;
 }