Virtualpads - Some Progress

This commit is contained in:
adelikat 2014-06-22 15:43:45 +00:00
parent 41e4a3b13a
commit 2009e07e35
9 changed files with 147 additions and 11 deletions

View File

@ -887,8 +887,12 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="tools\VirtualPads\IVirtualPad.cs" />
<Compile Include="tools\VirtualPads\schema\N64Schema.cs" />
<Compile Include="tools\VirtualPads\schema\NesSchema.cs" />
<Compile Include="tools\VirtualPads\schema\PadSchema.cs" />
<Compile Include="tools\VirtualPads\schema\PceSchema.cs" />
<Compile Include="tools\VirtualPads\schema\SmsSchema.cs" />
<Compile Include="tools\VirtualPads\schema\SnesSchema.cs" />
<Compile Include="tools\VirtualPads\VirtualPad.cs">
<SubType>UserControl</SubType>
</Compile>

View File

@ -36,18 +36,20 @@ namespace BizHawk.Client.EmuHawk
switch (button.Type)
{
case PadSchema.PadInputType.Boolean:
var checkbox = new VirtualPadButton
Controls.Add(new VirtualPadButton
{
AutoSize = true,
Location = button.Location,
Name = button.Name,
Text = button.DisplayName,
Location = button.Location,
Image = button.Icon
};
Controls.Add(checkbox);
});
break;
case PadSchema.PadInputType.FloatPair:
case PadSchema.PadInputType.AnalogStick:
Controls.Add(new VirtualPadAnalogStick
{
Name = button.Name,
Location = button.Location
});
break;
}
}

View File

@ -67,6 +67,7 @@ namespace BizHawk.Client.EmuHawk
{
ControllerBox.Controls.Clear();
// TODO: be more clever than this
switch(Global.Emulator.SystemId)
{
case "NES":
@ -81,7 +82,36 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(200, 15)
});
break;
case "N64":
ControllerBox.Controls.Add(new VirtualPad(
N64Schema.StandardController(1))
{
Location = new Point(15, 15)
});
break;
case "SMS":
case "SG":
case "GG": // TODO: test if all 3 of these are needed
ControllerBox.Controls.Add(new VirtualPad(
SmsSchema.StandardController(1))
{
Location = new Point(15, 15)
});
break;
case "PCE":
ControllerBox.Controls.Add(new VirtualPad(
PceSchema.StandardController(1))
{
Location = new Point(15, 15)
});
break;
case "SNES":
ControllerBox.Controls.Add(new VirtualPad(
SnesSchema.StandardController(1))
{
Location = new Point(15, 15)
});
break;
}
}

View File

@ -5,7 +5,7 @@ using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public sealed class AnalogControlPanel : Panel, IVirtualPadControl
public sealed class VirtualPadAnalogStick : Panel, IVirtualPadControl
{
public int X = 0;
public int Y = 0;
@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
private readonly Bitmap dot = new Bitmap(7, 7);
private readonly Bitmap graydot = new Bitmap(7, 7);
public AnalogControlPanel()
public VirtualPadAnalogStick()
{
Size = new Size(129, 129);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);

View File

@ -0,0 +1,58 @@
using System.Drawing;
namespace BizHawk.Client.EmuHawk
{
public class N64Schema
{
public static PadSchema StandardController(int controller)
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(200, 316),
Buttons = new[]
{
new PadSchema.ButtonScema
{
Name = "P" + controller + " X Axis",
DisplayName = "",
Location = new Point(6, 14),
Type = PadSchema.PadInputType.AnalogStick
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(24, 195),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(24, 216),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(3, 207),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(45, 207),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
}
}

View File

@ -13,7 +13,7 @@ namespace BizHawk.Client.EmuHawk
public enum PadInputType
{
Boolean, // A single on/off button
FloatPair, // An analog stick X,Y Pair
AnalogStick, // An analog stick X,Y Pair
FloatSingle, // A single analog button (pressure sensitive button for instance)
TargetedPair // A X,Y pair intended to be a screen cooridnate (for zappers, mouse, stylus, etc)
}

View File

@ -0,0 +1,14 @@
using System.Drawing;
namespace BizHawk.Client.EmuHawk
{
public static class PceSchema
{
public static PadSchema StandardController(int controller)
{
return new PadSchema
{
};
}
}
}

View File

@ -0,0 +1,14 @@
using System.Drawing;
namespace BizHawk.Client.EmuHawk
{
public static class SmsSchema
{
public static PadSchema StandardController(int controller)
{
return new PadSchema
{
};
}
}
}

View File

@ -0,0 +1,14 @@
using System.Drawing;
namespace BizHawk.Client.EmuHawk
{
public static class SnesSchema
{
public static PadSchema StandardController(int controller)
{
return new PadSchema
{
};
}
}
}