コード例 #1
0
ファイル: HidReport.cs プロジェクト: SciLor/ScpToolkit
        /// <summary>
        ///     Sets the value of an analog axis.
        /// </summary>
        /// <param name="axis">The axis of the current report to manipulate.</param>
        /// <param name="value">The value to set the axis to.</param>
        public void Set(AxesEnum axis, byte value)
        {
            if (!_axesStates.ContainsKey(axis))
            {
                byte defaultValue = 0;
                switch (axis)
                {
                case AxesEnum.Lx:
                case AxesEnum.Ly:
                case AxesEnum.Rx:
                case AxesEnum.Ry:
                    defaultValue = 127;
                    break;

                default:
                    defaultValue = 0;
                    break;
                }
                _axesStates.Add(axis, new DsAxisState(defaultValue));
            }

            _axesStates[axis].Value = value;
        }
コード例 #2
0
ファイル: HidReport.cs プロジェクト: SciLor/ScpToolkit
 /// <summary>
 ///     Sets the value of an analog axis to it's default value.
 /// </summary>
 /// <param name="axis">The axis of the current report to manipulate.</param>
 public void Unset(AxesEnum axis)
 {
     Set(axis, _axesStates[axis].DefaultValue);
 }
コード例 #3
0
ファイル: HidReport.cs プロジェクト: SciLor/ScpToolkit
 /// <summary>
 ///     Gets the axis state of the current packet.
 /// </summary>
 /// <param name="axis">The DualShock axis to question.</param>
 /// <returns>The value of the axis in question.</returns>
 public IDsAxisStateImmutable this[AxesEnum axis] => _axesStates[axis];