Enable nullability in AxisSpec and related types
This commit is contained in:
parent
d0f96339ce
commit
4f7c1a0b76
|
@ -1,9 +1,11 @@
|
|||
#nullable enable
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public interface AxisConstraint
|
||||
{
|
||||
public string Class { get; }
|
||||
public string? Class { get; }
|
||||
|
||||
public string PairedAxis { get; }
|
||||
public string? PairedAxis { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
/// <summary>represents the direction of <c>(+, +)</c></summary>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
|
||||
using BizHawk.Common;
|
||||
|
@ -11,7 +13,7 @@ namespace BizHawk.Emulation.Common
|
|||
/// For instance, a N64 controller's analog range is actually larger than the amount allowed by the plastic that artificially constrains it to lower values
|
||||
/// Axis constraints provide a way to technically allow the full range but have a user option to constrain down to typical values that a real control would have
|
||||
/// </summary>
|
||||
public readonly AxisConstraint Constraint;
|
||||
public readonly AxisConstraint? Constraint;
|
||||
|
||||
public Range<float> FloatRange => ((float) Min).RangeTo(Max);
|
||||
|
||||
|
@ -27,11 +29,11 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
public int Min => Range.Start;
|
||||
|
||||
public string PairedAxis => Constraint?.PairedAxis;
|
||||
public string? PairedAxis => Constraint?.PairedAxis;
|
||||
|
||||
public readonly Range<int> Range;
|
||||
|
||||
public AxisSpec(Range<int> range, int mid, bool isReversed = false, AxisConstraint constraint = null)
|
||||
public AxisSpec(Range<int> range, int mid, bool isReversed = false, AxisConstraint? constraint = null)
|
||||
{
|
||||
Constraint = constraint;
|
||||
IsReversed = isReversed;
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public sealed class CircularAxisConstraint : AxisConstraint
|
||||
{
|
||||
public string Class { get; }
|
||||
public string? Class { get; }
|
||||
|
||||
private readonly float Magnitude;
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#nullable enable
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public sealed class NoOpAxisConstraint : AxisConstraint
|
||||
{
|
||||
public string Class { get; } = null;
|
||||
public string? Class { get; } = null;
|
||||
|
||||
public string PairedAxis { get; }
|
||||
public string? PairedAxis { get; }
|
||||
|
||||
public NoOpAxisConstraint(string pairedAxis) => PairedAxis = pairedAxis;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue