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); }
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); } }
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); } } } }
public ButtonMappingEntry(GamepadButtonInputId to, GamepadButtonInputId from) { To = to; From = from; }
public HLEButtonMappingEntry(GamepadButtonInputId driverInputId, ControllerKeys hleInput) { DriverInputId = driverInputId; HLEInput = hleInput; }
public bool IsPressed(GamepadButtonInputId inputId) { throw new NotSupportedException(); }
public void SetPressed(GamepadButtonInputId inputId, bool value) => _buttonsState[(int)inputId] = value;
public bool IsPressed(GamepadButtonInputId inputId) => _buttonsState[(int)inputId];
public bool IsPressed(GamepadButtonInputId inputId) { throw new NotImplementedException(); }