Improve scaling. Still needs some work but it's better than it was.
This commit is contained in:
parent
9a1108e9f7
commit
7b4c5636bd
|
@ -37,5 +37,15 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
return (int)Math.Round(size * AutoScaleFactorY);
|
||||
}
|
||||
|
||||
public static Point Scale(Point p)
|
||||
{
|
||||
return new Point(ScaleX(p.X), ScaleY(p.Y));
|
||||
}
|
||||
|
||||
public static Size Scale(Size s)
|
||||
{
|
||||
return new Size(ScaleX(s.Width), ScaleY(s.Height));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using System.Drawing;
|
||||
|
||||
|
@ -56,27 +57,35 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void VirtualPadControl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Size = _schema.DefaultSize;
|
||||
MaximumSize = _schema.MaxSize ?? _schema.DefaultSize;
|
||||
Size = UIHelper.Scale(_schema.DefaultSize);
|
||||
MaximumSize = UIHelper.Scale(_schema.MaxSize ?? _schema.DefaultSize);
|
||||
PadBox.Text = _schema.DisplayName;
|
||||
foreach (var button in _schema.Buttons)
|
||||
{
|
||||
// TODO: Size of all controls should ideally be scaled, only implemented on button for now
|
||||
switch (button.Type)
|
||||
{
|
||||
case PadSchema.PadInputType.Boolean:
|
||||
PadBox.Controls.Add(new VirtualPadButton
|
||||
var buttonControl = new VirtualPadButton
|
||||
{
|
||||
Name = button.Name,
|
||||
Text = button.DisplayName,
|
||||
Location = button.Location,
|
||||
Location = UIHelper.Scale(button.Location),
|
||||
Image = button.Icon,
|
||||
});
|
||||
};
|
||||
if (button.Icon != null && UIHelper.AutoScaleFactorX > 1F && UIHelper.AutoScaleFactorY > 1F)
|
||||
{
|
||||
// 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 = UIHelper.Scale(new Size(button.Icon.Width + 4, button.Icon.Height + 4));
|
||||
}
|
||||
PadBox.Controls.Add(buttonControl);
|
||||
break;
|
||||
case PadSchema.PadInputType.AnalogStick:
|
||||
PadBox.Controls.Add(new VirtualPadAnalogStick
|
||||
{
|
||||
Name = button.Name,
|
||||
Location = button.Location,
|
||||
Location = UIHelper.Scale(button.Location),
|
||||
Size = new Size(button.MaxValue + 79, button.MaxValue + 9), // TODO: don't use hardcoded values here, at least make them defaults in the AnalogStick object itself
|
||||
RangeX = button.MaxValue,
|
||||
RangeY = button.MaxValue // TODO ability to pass in a different Y max
|
||||
|
@ -86,10 +95,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
PadBox.Controls.Add(new VirtualPadTargetScreen
|
||||
{
|
||||
Name = button.Name,
|
||||
Location = button.Location,
|
||||
Location = UIHelper.Scale(button.Location),
|
||||
Size = button.TargetSize,
|
||||
XName = button.Name,
|
||||
YName = button.SecondaryNames[0],
|
||||
Size = button.TargetSize,
|
||||
RangeX = button.MaxValue,
|
||||
RangeY = button.MaxValue // TODO: ability to have a different Y than X
|
||||
});
|
||||
|
@ -99,7 +108,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Name = button.Name,
|
||||
DisplayName = button.DisplayName,
|
||||
Location = button.Location,
|
||||
Location = UIHelper.Scale(button.Location),
|
||||
Size = button.TargetSize,
|
||||
MinValue = button.MinValue,
|
||||
MaxValue = button.MaxValue
|
||||
|
@ -110,7 +119,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Name = button.Name,
|
||||
//DisplayName = button.DisplayName,
|
||||
Location = button.Location,
|
||||
Location = UIHelper.Scale(button.Location),
|
||||
Size = button.TargetSize,
|
||||
OwnerEmulator = button.OwnerEmulator
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue