Split TargetedPairSchema.MaxValue to MaxX/MaxY and cleanup
* split TargetedPairSchema ctor and added docs to clarify its behaviour * renamed VirtualPadTargetScreen.RangeX/RangeY to MaxX/MaxY * left TODOs in the three places MaxValue was actually used
This commit is contained in:
parent
509560fa1a
commit
a89b0dfdcd
|
@ -110,8 +110,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
_inputManager.StickyXorAdapter,
|
||||
targetedPair.Name,
|
||||
targetedPair.SecondaryName,
|
||||
targetedPair.MaxValue,
|
||||
targetedPair.MaxValue // TODO split into MaxX and MaxY, and rename VirtualPadTargetScreen.RangeX/RangeY
|
||||
targetedPair.MaxX,
|
||||
targetedPair.MaxY
|
||||
)
|
||||
{
|
||||
Location = UIHelper.Scale(targetedPair.Location),
|
||||
|
|
|
@ -25,14 +25,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
StickyXorAdapter stickyXorAdapter,
|
||||
string nameX,
|
||||
string nameY,
|
||||
int rangeX,
|
||||
int rangeY)
|
||||
int maxX,
|
||||
int maxY)
|
||||
{
|
||||
_stickyXorAdapter = stickyXorAdapter;
|
||||
Name = XName = nameX;
|
||||
YName = nameY;
|
||||
RangeX = rangeX;
|
||||
RangeY = rangeY;
|
||||
MaxX = maxX;
|
||||
MaxY = maxY;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
@ -122,16 +122,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// These are the value that a maximum x or y actually represent, used to translate from control X,Y to values the core expects
|
||||
private readonly int RangeX;
|
||||
private readonly int RangeY;
|
||||
private readonly int MaxX;
|
||||
private readonly int MaxY;
|
||||
|
||||
public float MultiplierX
|
||||
{
|
||||
get
|
||||
{
|
||||
if (RangeX > 0)
|
||||
if (MaxX > 0)
|
||||
{
|
||||
return RangeX / (float)TargetPanel.Width;
|
||||
return MaxX / (float)TargetPanel.Width;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -142,9 +142,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
get
|
||||
{
|
||||
if (RangeY > 0)
|
||||
if (MaxY > 0)
|
||||
{
|
||||
return RangeY / (float)TargetPanel.Height;
|
||||
return MaxY / (float)TargetPanel.Height;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Size = new Size(356, 300),
|
||||
Buttons = new PadSchemaControl[]
|
||||
{
|
||||
new TargetedPairSchema(14, 17, $"P{controller} Lightgun X", 10000)
|
||||
new TargetedPairSchema(14, 17, $"P{controller} Lightgun X", 10000, 10000) //TODO (10000, 10000) matches previous behaviour - what was intended here?
|
||||
{
|
||||
TargetSize = new Size(320, 240)
|
||||
},
|
||||
|
|
|
@ -106,18 +106,28 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>An (X, Y) pair intended to be a screen coordinate (for zappers, mouse, stylus, etc.)</summary>
|
||||
public sealed class TargetedPairSchema : PadSchemaControl
|
||||
{
|
||||
public int MaxValue { get; }
|
||||
public int MaxX { get; }
|
||||
|
||||
public int MaxY { get; }
|
||||
|
||||
public string SecondaryName { get; set; }
|
||||
|
||||
public Size TargetSize { get; set; }
|
||||
|
||||
public TargetedPairSchema(int x, int y, string nameX, int maxValue = default)
|
||||
/// <remarks>Using this ctor, the valid ranges for the X and Y axes are taken to be <c>(0..TargetSize.Width)</c> and <c>(0..TargetSize.Height)</c>.</remarks>
|
||||
public TargetedPairSchema(int x, int y, string nameX)
|
||||
: base(new Point(x, y), nameX)
|
||||
{
|
||||
MaxValue = maxValue;
|
||||
SecondaryName = nameX.Replace("X", "Y");
|
||||
}
|
||||
|
||||
/// <remarks>Using this ctor, the valid ranges for the X and Y axes are taken to be <c>(0..maxX)</c> and <c>(0..maxY)</c>.</remarks>
|
||||
public TargetedPairSchema(int x, int y, string nameX, int maxX, int maxY)
|
||||
: this(x, y, nameX)
|
||||
{
|
||||
MaxX = maxX;
|
||||
MaxY = maxY;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class DiscManagerSchema : PadSchemaControl
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Size = new Size(375, 320),
|
||||
Buttons = new PadSchemaControl[]
|
||||
{
|
||||
new TargetedPairSchema(14, 17, $"P{controller} Motion Left / Right", AxisRange.Max)
|
||||
new TargetedPairSchema(14, 17, $"P{controller} Motion Left / Right", AxisRange.Max, AxisRange.Max) //TODO (0xFFFF, 0xFFFF) matches previous behaviour - what was intended here?
|
||||
{
|
||||
SecondaryName = $"P{controller} Motion Up / Down",
|
||||
TargetSize = new Size(256, 256)
|
||||
|
@ -264,7 +264,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Size = new Size(375, 320),
|
||||
Buttons = new PadSchemaControl[]
|
||||
{
|
||||
new TargetedPairSchema(14, 17, $"P{controller} X Axis", AxisRange.Max)
|
||||
new TargetedPairSchema(14, 17, $"P{controller} X Axis", AxisRange.Max, AxisRange.Max) //TODO (0xFFFF, 0xFFFF) matches previous behaviour - what was intended here?
|
||||
{
|
||||
SecondaryName = $"P{controller} Y Axis",
|
||||
TargetSize = new Size(256, 256)
|
||||
|
|
Loading…
Reference in New Issue