コード例 #1
0
            public void AddInput(GamepadButtonInputId button, float value)
            {
                InputSummary inputSummary;

                if (!_stats.TryGetValue(button, out inputSummary))
                {
                    inputSummary = new InputSummary();
                    _stats.Add(button, inputSummary);
                }

                inputSummary.AddInput(value);
            }
コード例 #2
0
 public bool IsPressed(GamepadButtonInputId inputId)
 {
     if (inputId == GamepadButtonInputId.LeftTrigger)
     {
         return(ConvertRawStickValue(SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_TRIGGERLEFT)) > _triggerThreshold);
     }
     else if (inputId == GamepadButtonInputId.RightTrigger)
     {
         return(ConvertRawStickValue(SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) > _triggerThreshold);
     }
     else if (_buttonsDriverMapping[(int)inputId] == SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_INVALID)
     {
         return(false);
     }
     else
     {
         return(SDL_GameControllerGetButton(_gamepadHandle, _buttonsDriverMapping[(int)inputId]) == 1);
     }
 }
コード例 #3
0
        private void CollectButtonStats()
        {
            if (_forStick)
            {
                for (StickInputId inputId = StickInputId.Left; inputId < StickInputId.Count; inputId++)
                {
                    (float x, float y) = _currState.GetStick(inputId);

                    float value;

                    if (x != 0.0f)
                    {
                        value = x;
                    }
                    else if (y != 0.0f)
                    {
                        value = y;
                    }
                    else
                    {
                        continue;
                    }

                    _detector.AddInput((GamepadButtonInputId)inputId, value);
                }
            }
            else
            {
                for (GamepadButtonInputId inputId = GamepadButtonInputId.A; inputId < GamepadButtonInputId.Count; inputId++)
                {
                    if (_currState.IsPressed(inputId) && !_prevState.IsPressed(inputId))
                    {
                        _detector.AddInput(inputId, 1);
                    }

                    if (!_currState.IsPressed(inputId) && _prevState.IsPressed(inputId))
                    {
                        _detector.AddInput(inputId, -1);
                    }
                }
            }
        }
コード例 #4
0
 public ButtonMappingEntry(GamepadButtonInputId to, GamepadButtonInputId from)
 {
     To   = to;
     From = from;
 }
コード例 #5
0
ファイル: NpadController.cs プロジェクト: piyachetk/Ryujinx
 public HLEButtonMappingEntry(GamepadButtonInputId driverInputId, ControllerKeys hleInput)
 {
     DriverInputId = driverInputId;
     HLEInput      = hleInput;
 }
コード例 #6
0
ファイル: GTK3Keyboard.cs プロジェクト: zh010zh/Ryujinx
 public bool IsPressed(GamepadButtonInputId inputId)
 {
     throw new NotSupportedException();
 }
コード例 #7
0
 public void SetPressed(GamepadButtonInputId inputId, bool value) => _buttonsState[(int)inputId] = value;
コード例 #8
0
 public bool IsPressed(GamepadButtonInputId inputId) => _buttonsState[(int)inputId];
コード例 #9
0
ファイル: AvaloniaMouse.cs プロジェクト: WilliamWsyHK/Ryujinx
 public bool IsPressed(GamepadButtonInputId inputId)
 {
     throw new NotImplementedException();
 }