Fix NES Zapper target being 210 pixels tall instead of 240.

Fix max X/Y value of target being high by 1.
This commit is contained in:
jdpurcell 2015-01-01 22:14:03 +00:00
parent 4e0e5958ed
commit 260176e458
6 changed files with 32 additions and 18 deletions

View File

@ -76,7 +76,7 @@ namespace BizHawk.Client.EmuHawk
{
// When scaling up, unfortunately the icon will look too small, but at least we can make the rest of the button bigger
buttonControl.AutoSize = false;
buttonControl.Size = new Size(UIHelper.ScaleX(button.Icon.Width) + 6, UIHelper.ScaleY(button.Icon.Height) + 6);
buttonControl.Size = UIHelper.Scale(button.Icon.Size) + new Size(6, 6);
}
PadBox.Controls.Add(buttonControl);
break;
@ -95,7 +95,7 @@ namespace BizHawk.Client.EmuHawk
{
Name = button.Name,
Location = UIHelper.Scale(button.Location),
Size = button.TargetSize, // TODO: Scale size without messing up X/Y range
TargetSize = button.TargetSize,
XName = button.Name,
YName = button.SecondaryNames[0],
RangeX = button.MaxValue,

View File

@ -39,9 +39,6 @@
//
// TargetPanel
//
this.TargetPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TargetPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.TargetPanel.Location = new System.Drawing.Point(0, 0);
this.TargetPanel.Name = "TargetPanel";
@ -94,7 +91,8 @@
//
// VirtualPadTargetScreen
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.YLabel);
this.Controls.Add(this.YNumeric);
this.Controls.Add(this.XLabel);

View File

@ -29,8 +29,8 @@ namespace BizHawk.Client.EmuHawk
private void VirtualPadTargetScreen_Load(object sender, EventArgs e)
{
XNumeric.Maximum = TargetPanel.Width;
YNumeric.Maximum = TargetPanel.Height;
XNumeric.Maximum = TargetPanel.Width - 1;
YNumeric.Maximum = TargetPanel.Height - 1;
}
#region IVirtualPadControl Implementation
@ -105,6 +105,22 @@ namespace BizHawk.Client.EmuHawk
#endregion
// Size of the extra controls to the right / bottom of the target panel at 96 DPI
private Size PaddingSize
{
get { return new Size(0, 30); }
}
public Size TargetSize
{
get { return TargetPanel.Size; }
set
{
TargetPanel.Size = value;
Size = UIHelper.Scale(value + PaddingSize);
}
}
// These are the value that a maximum x or y actually represent, used to translate from control X,Y to values the core expects
public int RangeX { get; set; }
public int RangeY { get; set; }
@ -157,9 +173,9 @@ namespace BizHawk.Client.EmuHawk
{
get
{
if (overrideY.HasValue)
if (overrideY.HasValue) // Shouldn't this be overrideX?
{
return overrideY.Value;
return overrideY.Value; // Shouldn't this be overrideX?
}
return (int)(Global.StickyXORAdapter.GetFloat(XName) / MultiplierX);
@ -191,7 +207,7 @@ namespace BizHawk.Client.EmuHawk
{
if (overrideY.HasValue)
{
return overrideX.Value;
return overrideX.Value; // Shouldn't this be overrideY?
}
return (int)(Global.StickyXORAdapter.GetFloat(YName) / MultiplierY);

View File

@ -187,8 +187,8 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Light Gun",
IsConsole = false,
DefaultSize = new Size(356, 260),
MaxSize = new Size(356, 260),
DefaultSize = new Size(356, 290),
MaxSize = new Size(356, 290),
Buttons = new[]
{
new PadSchema.ButtonScema

View File

@ -228,7 +228,7 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(14, 17),
Type = PadSchema.PadInputType.TargetedPair,
MaxValue = 10000,
TargetSize = new Size(320, 270),
TargetSize = new Size(320, 240),
SecondaryNames = new []
{
"P" + controller + " Lightgun Y",

View File

@ -366,8 +366,8 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Zapper",
IsConsole = false,
DefaultSize = new Size(356, 260),
MaxSize = new Size(356, 260),
DefaultSize = new Size(356, 290),
MaxSize = new Size(356, 290),
Buttons = new[]
{
new PadSchema.ButtonScema
@ -526,8 +526,8 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Tablet",
IsConsole = false,
DefaultSize = new Size(356, 260),
MaxSize = new Size(356, 260),
DefaultSize = new Size(356, 290),
MaxSize = new Size(356, 290),
Buttons = new[]
{
new PadSchema.ButtonScema