Example #1
0
        private void ResetButtonResend(XInputButton button)
        {
            var state = keyWatches[button];

            state.Watch.Reset();
            state.IsReSending = false;
        }
        public static byte CalculateSWThrottleXinput(XInputButton button, State state)
        {
            if (button.IsButton)
            {
                var btnPress = DigitalHelper.GetButtonPressXinput(button, state, 0);
                if (btnPress == true)
                {
                    return(0xFF);
                }
                return(0x00);
            }

            if (button.IsLeftThumbY)
            {
                return(JvsHelper.CalculateGasPos(state.Gamepad.LeftThumbY, false, false));
            }

            if (button.IsRightThumbY)
            {
                return(JvsHelper.CalculateGasPos(state.Gamepad.RightThumbY, false, false));
            }

            if (button.IsLeftTrigger)
            {
                return(state.Gamepad.LeftTrigger);
            }

            if (button.IsRightTrigger)
            {
                return(state.Gamepad.RightTrigger);
            }
            return(0);
        }
Example #3
0
        private bool ShouldResendKey(XInputButton button)
        {
            var state     = keyWatches[button];
            var sendInput = false;
            var elapsed   = state.Watch.ElapsedMilliseconds;

            if (!state.Watch.IsRunning)
            {
                sendInput = true;
                state.Watch.Start();
            }
            else
            {
                if (!state.IsReSending && elapsed < resendDelay)
                {
                    sendInput = false;
                }
                else if (!state.IsReSending && elapsed > resendDelay)
                {
                    state.IsReSending = true;
                    state.Watch.Restart();
                    sendInput = true;
                }
                else
                {
                    if (state.IsReSending && elapsed > resendRate)
                    {
                        state.Watch.Restart();
                        sendInput = true;
                    }
                }
            }

            return(sendInput);
        }
Example #4
0
 public XInputEventArgs(Key key, XInputButtonState state, XInputButton button) :
     base(InputManager.Current.PrimaryKeyboardDevice, InputManager.Current.PrimaryKeyboardDevice.ActiveSource, Environment.TickCount, key)
 {
     XButtonState = state;
     XButton      = button;
     RoutedEvent  = state == XInputButtonState.Pressed ? Keyboard.KeyDownEvent : Keyboard.KeyUpEvent;
 }
Example #5
0
        private bool CheckButtonDown(PlayerIndex index, XInputButton button)
        {
            var state = GamePad.GetState(index, GamePadDeadZone.Circular);

            switch (button)
            {
            case XInputButton.A: return(state.Buttons.A == ButtonState.Pressed);

            case XInputButton.B: return(state.Buttons.B == ButtonState.Pressed);

            case XInputButton.X: return(state.Buttons.X == ButtonState.Pressed);

            case XInputButton.Y: return(state.Buttons.Y == ButtonState.Pressed);

            case XInputButton.Back: return(state.Buttons.Back == ButtonState.Pressed);

            case XInputButton.Start: return(state.Buttons.Start == ButtonState.Pressed);

            case XInputButton.Guide: return(state.Buttons.Guide == ButtonState.Pressed);

            case XInputButton.LeftShoulder: return(state.Buttons.LeftShoulder == ButtonState.Pressed);

            case XInputButton.LeftStick: return(state.Buttons.LeftStick == ButtonState.Pressed);

            case XInputButton.RightShoulder: return(state.Buttons.RightShoulder == ButtonState.Pressed);

            case XInputButton.RightStick: return(state.Buttons.RightStick == ButtonState.Pressed);

            default: throw new NotImplementedException();
            }
        }
Example #6
0
 private void ProcessAxisState(float currentState, XInputButton button, bool positive, PlayerIndex playniteIndex)
 {
     if (positive)
     {
         if (currentState > 0.5f && ShouldResendKey(button))
         {
             SendXInput(button, true);
             prevStates[playniteIndex][button] = ButtonState.Pressed;
             SimulateKeyInput(keyboardMap[button], true);
         }
         else if (currentState < 0.5f && prevStates[playniteIndex][button] == ButtonState.Pressed)
         {
             ResetButtonResend(button);
             SendXInput(button, false);
             prevStates[playniteIndex][button] = ButtonState.Released;
             SimulateKeyInput(keyboardMap[button], false);
         }
     }
     else
     {
         if (currentState < -0.5f && ShouldResendKey(button))
         {
             SendXInput(button, true);
             prevStates[playniteIndex][button] = ButtonState.Pressed;
             SimulateKeyInput(keyboardMap[button], true);
         }
         else if (currentState > -0.5f && prevStates[playniteIndex][button] == ButtonState.Pressed)
         {
             ResetButtonResend(button);
             SendXInput(button, false);
             prevStates[playniteIndex][button] = ButtonState.Released;
             SimulateKeyInput(keyboardMap[button], false);
         }
     }
 }
Example #7
0
 private void SendXInput(XInputButton button, bool pressed)
 {
     context.Send((a) =>
     {
         var args = new XInputEventArgs(Key.None, pressed ? XInputButtonState.Pressed : XInputButtonState.Released, button);
         inputManager.ProcessInput(args);
     }, null);
 }
Example #8
0
        public static byte CalculateAxisOrTriggerGasBrakeXinput(XInputButton button, State state, byte minVal = 0, byte maxVal = 255)
        {
            if (button.IsButton)
            {
                var btnPress = DigitalHelper.GetButtonPressXinput(button, state, 0);
                if (btnPress == true)
                {
                    return(0xFF);
                }
                return(0x00);
            }

            if (button.IsLeftThumbX)
            {
                return(JvsHelper.CalculateGasPos(state.Gamepad.LeftThumbX, true, false, minVal, maxVal));
            }

            if (button.IsLeftThumbY)
            {
                return(JvsHelper.CalculateGasPos(state.Gamepad.LeftThumbY, true, false, minVal, maxVal));
            }

            if (button.IsRightThumbX)
            {
                return(JvsHelper.CalculateGasPos(state.Gamepad.RightThumbX, true, false, minVal, maxVal));
            }

            if (button.IsRightThumbY)
            {
                return(JvsHelper.CalculateGasPos(state.Gamepad.RightThumbY, true, false, minVal, maxVal));
            }

            byte result = 0;

            if (button.IsLeftTrigger)
            {
                result = state.Gamepad.LeftTrigger;
            }

            if (button.IsRightTrigger)
            {
                result = state.Gamepad.RightTrigger;
            }

            if (result < minVal)
            {
                result = minVal;
            }
            if (result > maxVal)
            {
                result = maxVal;
            }
            return(result);
        }
Example #9
0
        private void HandleButton(GamepadButtonFlags buttonFlag, TextBox txt)
        {
            var button = new XInputButton
            {
                IsButton   = true,
                ButtonCode = (short)buttonFlag
            };

            txt.Text = buttonFlag.ToString();
            txt.Tag  = button;
        }
Example #10
0
        private void SendXInput(XInputButton button, bool pressed)
        {
            context.Post((a) =>
            {
                if (InputManager.Current.PrimaryKeyboardDevice?.ActiveSource == null)
                {
                    return;
                }

                var args = new XInputEventArgs(Key.None, pressed ? XInputButtonState.Pressed : XInputButtonState.Released, button);
                inputManager.ProcessInput(args);
            }, null);
        }
        private void HandleButton(GamepadButtonFlags buttonFlag, TextBox txt, int index)
        {
            var button = new XInputButton
            {
                IsButton    = true,
                ButtonCode  = (short)buttonFlag,
                XInputIndex = index
            };
            var t = txt.Tag as JoystickButtons;

            txt.Text       = $"Input Device {index} " + buttonFlag;
            t.BindNameXi   = txt.Text;
            t.XInputButton = button;
        }
Example #12
0
        public static byte CalculateWheelPosXinput(XInputButton button, State state, bool useSto0Z, int stoozPercent,
                                                   GameProfile gameProfile)
        {
            int minVal = 0;
            int maxVal = 255;

            switch (gameProfile.EmulationProfile)
            {
            case EmulationProfile.SegaInitialD:
                minVal = 0x1F;
                maxVal = 0xE1;
                break;

            case EmulationProfile.SegaInitialDLindbergh:
                minVal = 0x1F;
                maxVal = 0xE1;
                break;

            case EmulationProfile.SegaSonicAllStarsRacing:
                minVal = 0x1D;
                maxVal = 0xED;
                break;

            default:
                minVal = 0;
                maxVal = 255;
                break;
            }

            if (button.IsLeftThumbX)
            {
                return(useSto0Z ? JvsHelper.CalculateSto0ZWheelPos(state.Gamepad.LeftThumbX, stoozPercent, true) : JvsHelper.CalculateWheelPos(state.Gamepad.LeftThumbX, true, false, minVal, maxVal));
            }

            if (button.IsLeftThumbY)
            {
                return(useSto0Z ? JvsHelper.CalculateSto0ZWheelPos(state.Gamepad.LeftThumbY, stoozPercent, true) : JvsHelper.CalculateWheelPos(state.Gamepad.LeftThumbY, true, false, minVal, maxVal));
            }

            if (button.IsRightThumbX)
            {
                return(useSto0Z ? JvsHelper.CalculateSto0ZWheelPos(state.Gamepad.RightThumbX, stoozPercent, true) : JvsHelper.CalculateWheelPos(state.Gamepad.RightThumbX, true, false, minVal, maxVal));
            }

            if (button.IsRightThumbY)
            {
                return(useSto0Z ? JvsHelper.CalculateSto0ZWheelPos(state.Gamepad.RightThumbY, stoozPercent, true) : JvsHelper.CalculateWheelPos(state.Gamepad.RightThumbY, true, false, minVal, maxVal));
            }
            return(0x7F);
        }
Example #13
0
 private bool IsButtonNotNavigation(XInputButton button)
 {
     return(button == XInputButton.A ||
            button == XInputButton.B ||
            button == XInputButton.Back ||
            button == XInputButton.Guide ||
            button == XInputButton.LeftShoulder ||
            button == XInputButton.LeftStick ||
            button == XInputButton.None ||
            button == XInputButton.RightShoulder ||
            button == XInputButton.RightStick ||
            button == XInputButton.Start ||
            button == XInputButton.X ||
            button == XInputButton.Y);
 }
Example #14
0
 private void ProcessButtonState(ButtonState currentState, XInputButton button, PlayerIndex playniteIndex)
 {
     if (currentState == ButtonState.Pressed && ShouldResendKey(button))
     {
         SendXInput(button, true);
         prevStates[playniteIndex][button] = ButtonState.Pressed;
         SimulateKeyInput(keyboardMap[button], true);
     }
     else if (currentState == ButtonState.Released && prevStates[playniteIndex][button] == ButtonState.Pressed)
     {
         ResetButtonResend(button);
         SendXInput(button, false);
         prevStates[playniteIndex][button] = ButtonState.Released;
         SimulateKeyInput(keyboardMap[button], false);
     }
 }
Example #15
0
        /// <summary>
        /// Gets if button is pressed. Null if not the same as requested.
        /// </summary>
        /// <param name="button"></param>
        /// <param name="state"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public static bool?GetButtonPressXinput(XInputButton button, State state, int index)
        {
            if (button?.XInputIndex != index)
            {
                return(null);
            }

            if (button.IsLeftTrigger)
            {
                return(state.Gamepad.LeftTrigger != 0);
            }

            if (button.IsRightTrigger)
            {
                return(state.Gamepad.RightTrigger != 0);
            }
            var buttonButtonCode = (short)state.Gamepad.Buttons;

            return((buttonButtonCode & button.ButtonCode) != 0);
        }
Example #16
0
 private void GetJoystickInformation(TextBox txt, XInputButton xinputButton, bool isBrake = false, bool isGas = false)
 {
     if (xinputButton == null)
     {
         return;
     }
     if (xinputButton.IsButton)
     {
         txt.Text = ((GamepadButtonFlags)xinputButton.ButtonCode).ToString();
     }
     if (xinputButton.IsLeftThumbY)
     {
         txt.Text  = "LeftThumbY";
         txt.Text += xinputButton.IsAxisMinus ? "-" : "+";
     }
     if (xinputButton.IsLeftThumbX)
     {
         txt.Text  = "LeftThumbX";
         txt.Text += xinputButton.IsAxisMinus ? "-" : "+";
     }
     if (xinputButton.IsRightThumbX)
     {
         txt.Text  = "RightThumbX";
         txt.Text += xinputButton.IsAxisMinus ? "-" : "+";
     }
     if (xinputButton.IsRightThumbY)
     {
         txt.Text  = "RightThumbY";
         txt.Text += xinputButton.IsAxisMinus ? "-" : "+";
     }
     if (xinputButton.IsLeftTrigger)
     {
         txt.Text = "LeftTrigger";
     }
     if (xinputButton.IsRightTrigger)
     {
         txt.Text = "RightTrigger";
     }
     txt.Tag = xinputButton;
 }
Example #17
0
        private void UpdateController(PlayerIndex playerIndex)
        {
            int index = (int)playerIndex;

            // Move all keys from buttonPressed to buttonHeld
            for (int i = 0; i < buttonPressed[index].Count; i++)
            {
                buttonHeld[index].Add(buttonPressed[index][i]);
            }
            buttonPressed[index].Clear();
            buttonReleased[index].Clear();             // Clear all released key

            for (int i = 0; i < allButtons.Length; i++)
            {
                XInputButton key = allButtons[i];

                // If key is pressed
                if (CheckButtonDown(playerIndex, key))
                {
                    // If key was not previously held
                    if (!buttonHeld[index].Contains(key))
                    {
                        // Mark this key as just pressed
                        buttonPressed[index].Add(key);
                    }
                }
                else                 // Key not pressed
                {
                    // If this key is marked as pressed
                    if (buttonHeld[index].Contains(key))
                    {
                        // Remove it and mark it as released
                        buttonHeld[index].Remove(key);
                        buttonReleased[index].Add(key);
                    }
                }
            }
        }
Example #18
0
        /// <summary>
        /// Sets text box text and tag.
        /// </summary>
        /// <param name="newState">New state.</param>
        /// <param name="oldState">Previous state.</param>
        private void SetTextBoxText(State newState, State oldState)
        {
            Application.Current.Dispatcher.BeginInvoke(
                DispatcherPriority.Background,
                new Action(() =>
            {
                var txt = GetActiveTextBox();
                if (txt == null)
                {
                    return;
                }

                if (newState.Gamepad.Buttons != oldState.Gamepad.Buttons)
                {
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.A)
                    {
                        HandleButton(GamepadButtonFlags.A, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.B)
                    {
                        HandleButton(GamepadButtonFlags.B, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.X)
                    {
                        HandleButton(GamepadButtonFlags.X, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.Y)
                    {
                        HandleButton(GamepadButtonFlags.Y, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.Start)
                    {
                        HandleButton(GamepadButtonFlags.Start, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.Back)
                    {
                        HandleButton(GamepadButtonFlags.Back, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.LeftShoulder)
                    {
                        HandleButton(GamepadButtonFlags.LeftShoulder, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.RightShoulder)
                    {
                        HandleButton(GamepadButtonFlags.RightShoulder, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.LeftThumb)
                    {
                        HandleButton(GamepadButtonFlags.LeftThumb, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.RightThumb)
                    {
                        HandleButton(GamepadButtonFlags.RightThumb, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.DPadDown)
                    {
                        HandleButton(GamepadButtonFlags.DPadDown, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.DPadUp)
                    {
                        HandleButton(GamepadButtonFlags.DPadUp, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.DPadLeft)
                    {
                        HandleButton(GamepadButtonFlags.DPadLeft, txt);
                    }
                    if (newState.Gamepad.Buttons == GamepadButtonFlags.DPadRight)
                    {
                        HandleButton(GamepadButtonFlags.DPadRight, txt);
                    }
                    return;
                }

                if (newState.Gamepad.LeftThumbX != oldState.Gamepad.LeftThumbX)
                {
                    GetAnalogXInput(newState.Gamepad.LeftThumbX, true, txt, false);
                    return;
                }

                if (newState.Gamepad.RightThumbX != oldState.Gamepad.RightThumbX)
                {
                    GetAnalogXInput(newState.Gamepad.RightThumbX, false, txt, false);
                    return;
                }

                if (newState.Gamepad.LeftThumbY != oldState.Gamepad.LeftThumbY)
                {
                    GetAnalogXInput(newState.Gamepad.LeftThumbY, true, txt, true);
                    return;
                }

                if (newState.Gamepad.RightThumbY != oldState.Gamepad.RightThumbY)
                {
                    GetAnalogXInput(newState.Gamepad.RightThumbY, false, txt, true);
                    return;
                }

                if (newState.Gamepad.LeftTrigger != oldState.Gamepad.LeftTrigger)
                {
                    var button = new XInputButton {
                        IsLeftTrigger = true
                    };
                    txt.Text = "LeftTrigger";
                    txt.Tag  = button;
                    return;
                }

                if (newState.Gamepad.RightTrigger != oldState.Gamepad.RightTrigger)
                {
                    var button = new XInputButton {
                        IsRightTrigger = true
                    };
                    txt.Text = "RightTrigger";
                    txt.Tag  = button;
                }
            }));
        }
Example #19
0
        /// <summary>
        /// Get directional press from button, POV and analog.
        /// </summary>
        /// <param name="playerButtons"></param>
        /// <param name="button"></param>
        /// <param name="state"></param>
        /// <param name="direction"></param>
        public static void GetDirectionPressXinput(PokkenButtons pokkenButtons, XInputButton button, State state, Direction direction, int index)
        {
            if (button?.XInputIndex != index)
            {
                return;
            }

            // Analog Axis, we expect that the both direction are on same axis!!!!
            if (button.IsLeftThumbX || button.IsLeftThumbY || button.IsRightThumbX || button.IsRightThumbY)
            {
                var calcVal = 0;
                if (button.IsLeftThumbY)
                {
                    calcVal = state.Gamepad.LeftThumbY;
                }
                if (button.IsLeftThumbX)
                {
                    calcVal = state.Gamepad.LeftThumbX;
                }
                if (button.IsRightThumbX)
                {
                    calcVal = state.Gamepad.RightThumbX;
                }
                if (button.IsRightThumbY)
                {
                    calcVal = state.Gamepad.RightThumbY;
                }
                if (button.IsAxisMinus)
                {
                    if (calcVal >= 0 + 15000)
                    {
                    }
                    else if (calcVal <= 0 - 15000)
                    {
                        InputCode.SetPlayerDirection(pokkenButtons, direction);
                    }
                    else
                    {
                        if (direction == Direction.Left || direction == Direction.Right)
                        {
                            InputCode.SetPlayerDirection(pokkenButtons, Direction.HorizontalCenter);
                        }
                        if (direction == Direction.Up || direction == Direction.Down)
                        {
                            InputCode.SetPlayerDirection(pokkenButtons, Direction.VerticalCenter);
                        }
                    }
                }
                else
                {
                    if (calcVal >= 0 + 15000)
                    {
                        InputCode.SetPlayerDirection(pokkenButtons, direction);
                    }
                    else if (calcVal <= 0 - 15000)
                    {
                    }
                    else
                    {
                        if (direction == Direction.Left || direction == Direction.Right)
                        {
                            InputCode.SetPlayerDirection(pokkenButtons, Direction.HorizontalCenter);
                        }
                        if (direction == Direction.Up || direction == Direction.Down)
                        {
                            InputCode.SetPlayerDirection(pokkenButtons, Direction.VerticalCenter);
                        }
                    }
                }
            }

            // Normal button
            if (button.IsButton)
            {
                if ((button.ButtonCode & (short)state.Gamepad.Buttons) != 0)
                {
                    InputCode.SetPlayerDirection(pokkenButtons, direction);
                }
                else
                {
                    if (direction == Direction.Left && !pokkenButtons.RightPressed())
                    {
                        InputCode.SetPlayerDirection(pokkenButtons, Direction.HorizontalCenter);
                    }
                    if (direction == Direction.Right && !pokkenButtons.LeftPressed())
                    {
                        InputCode.SetPlayerDirection(pokkenButtons, Direction.HorizontalCenter);
                    }
                    if (direction == Direction.Up && !pokkenButtons.DownPressed())
                    {
                        InputCode.SetPlayerDirection(pokkenButtons, Direction.VerticalCenter);
                    }
                    if (direction == Direction.Down && !pokkenButtons.UpPressed())
                    {
                        InputCode.SetPlayerDirection(pokkenButtons, Direction.VerticalCenter);
                    }
                }
            }
        }
Example #20
0
        private void GetAnalogXInput(short value, bool isLeftThumb, TextBox txt, bool isY)
        {
            var          deadZone = isLeftThumb ? Gamepad.LeftThumbDeadZone : Gamepad.RightThumbDeadZone;
            XInputButton button   = new XInputButton {
                IsButton = false
            };

            if (value > 0 + deadZone)
            {
                txt.Text = isLeftThumb ? "LeftThumb" : "RightThumb";
                if (isY)
                {
                    if (isLeftThumb)
                    {
                        button.IsLeftThumbY = true;
                    }
                    else
                    {
                        button.IsRightThumbY = true;
                    }
                    txt.Text += "Y+";
                }
                else
                {
                    if (isLeftThumb)
                    {
                        button.IsLeftThumbX = true;
                    }
                    else
                    {
                        button.IsRightThumbX = true;
                    }
                    button.IsAxisMinus = false;
                    txt.Text          += "X+";
                }
                txt.Tag = button;
            }
            else if (value < 0 - deadZone)
            {
                txt.Text           = isLeftThumb ? "LeftThumb" : "RightThumb";
                button.IsAxisMinus = true;
                if (isY)
                {
                    if (isLeftThumb)
                    {
                        button.IsLeftThumbY = true;
                    }
                    else
                    {
                        button.IsRightThumbY = true;
                    }
                    txt.Text += "Y-";
                    txt.Tag   = button;
                }
                else
                {
                    if (isLeftThumb)
                    {
                        button.IsLeftThumbX = true;
                    }
                    else
                    {
                        button.IsRightThumbX = true;
                    }
                    txt.Text += "X-";
                    txt.Tag   = button;
                }
            }
        }
Example #21
0
 public bool IsButtonDown(PlayerIndex index, XInputButton button)
 {
     return(buttonHeld[(int)index].Contains(button) || buttonPressed[(int)index].Contains(button));
 }
Example #22
0
 public XInputGesture(XInputButton button)
 {
     this.button = button;
 }
Example #23
0
 public XInputBinding(ICommand command, XInputButton button)
 {
     Command = command;
     Button  = button;
 }
Example #24
0
 public bool IsButtonReleased(PlayerIndex index, XInputButton button)
 {
     return(buttonReleased[(int)index].Contains(button));
 }
        private void GetAnalogXInput(short value, bool isLeftThumb, TextBox txt, bool isY, int index)
        {
            var          deadZone = isLeftThumb ? Gamepad.LeftThumbDeadZone : Gamepad.RightThumbDeadZone;
            var          indexTxt = $"Input Device {index} ";
            XInputButton button   = new XInputButton {
                IsButton = false, XInputIndex = index
            };

            if (value > 0 + deadZone)
            {
                txt.Text = indexTxt + (isLeftThumb ? "LeftThumb" : "RightThumb");
                if (isY)
                {
                    if (isLeftThumb)
                    {
                        button.IsLeftThumbY = true;
                    }
                    else
                    {
                        button.IsRightThumbY = true;
                    }
                    txt.Text += indexTxt + "Y+";
                }
                else
                {
                    if (isLeftThumb)
                    {
                        button.IsLeftThumbX = true;
                    }
                    else
                    {
                        button.IsRightThumbX = true;
                    }
                    button.IsAxisMinus = false;
                    txt.Text          += indexTxt + "X+";
                }
                var t = txt.Tag as JoystickButtons;
                t.BindNameXi   = txt.Text;
                t.XInputButton = button;
            }
            else if (value < 0 - deadZone)
            {
                txt.Text           = indexTxt + (isLeftThumb ? "LeftThumb" : "RightThumb");
                button.IsAxisMinus = true;
                if (isY)
                {
                    if (isLeftThumb)
                    {
                        button.IsLeftThumbY = true;
                    }
                    else
                    {
                        button.IsRightThumbY = true;
                    }
                    txt.Text += indexTxt + "Y-";
                }
                else
                {
                    if (isLeftThumb)
                    {
                        button.IsLeftThumbX = true;
                    }
                    else
                    {
                        button.IsRightThumbX = true;
                    }
                    txt.Text += indexTxt + "X-";
                }
                var t = txt.Tag as JoystickButtons;
                t.BindNameXi   = txt.Text;
                t.XInputButton = button;
            }
        }
Example #26
0
 public static bool IsButtonReleased(PlayerIndex index, XInputButton button)
 {
     return(Instance.core.updateState == Core.UpdateState.FixedUpdate ?
            Instance.fixedUpdateXInput.IsButtonReleased(index, button) :
            Instance.normalUpdateXInput.IsButtonReleased(index, button));
 }