Virtualpads - more progress
This commit is contained in:
parent
c15f9ce84d
commit
41e4a3b13a
|
@ -882,16 +882,19 @@
|
|||
<Compile Include="tools\VirtualPads\controls\AnalogControlPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadButton.cs" />
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadControl.Designer.cs">
|
||||
<DependentUpon>VirtualPadControl.cs</DependentUpon>
|
||||
<Compile Include="tools\VirtualPads\controls\IVirtualPadControl.cs" />
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\IVirtualPad.cs" />
|
||||
<Compile Include="tools\VirtualPads\schema\NesSchema.cs" />
|
||||
<Compile Include="tools\VirtualPads\schema\PadSchema.cs" />
|
||||
<Compile Include="tools\VirtualPads\VirtualPad.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\VirtualPad.Designer.cs">
|
||||
<DependentUpon>VirtualPad.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\VirtualpadTool.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -1215,8 +1218,8 @@
|
|||
<EmbeddedResource Include="tools\TI83\TI83KeyPad.resx">
|
||||
<DependentUpon>TI83KeyPad.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\VirtualPads\controls\VirtualPadControl.resx">
|
||||
<DependentUpon>VirtualPadControl.cs</DependentUpon>
|
||||
<EmbeddedResource Include="tools\VirtualPads\VirtualPad.resx">
|
||||
<DependentUpon>VirtualPad.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\VirtualPads\VirtualpadTool.resx">
|
||||
<DependentUpon>VirtualpadTool.cs</DependentUpon>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
partial class VirtualPadControl
|
||||
partial class VirtualPad
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
|
|
@ -12,11 +12,11 @@ using BizHawk.Client.Common;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class VirtualPadControl : UserControl, IVirtualPad
|
||||
public partial class VirtualPad : UserControl, IVirtualPad
|
||||
{
|
||||
private PadSchema _schema;
|
||||
|
||||
public VirtualPadControl(PadSchema schema)
|
||||
public VirtualPad(PadSchema schema)
|
||||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
|
@ -56,11 +56,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void Clear()
|
||||
{
|
||||
Controls
|
||||
.OfType<CheckBox>()
|
||||
.OfType<IVirtualPadControl>()
|
||||
.ToList()
|
||||
.ForEach(c => {
|
||||
c.Checked = false;
|
||||
Global.StickyXORAdapter.SetSticky(c.Name, false);
|
||||
c.Clear();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.PadsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ClearAllMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.StickyMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.PadMenu.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -165,10 +166,12 @@
|
|||
// PadsSubMenu
|
||||
//
|
||||
this.PadsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ClearAllMenuItem});
|
||||
this.ClearAllMenuItem,
|
||||
this.StickyMenuItem});
|
||||
this.PadsSubMenu.Name = "PadsSubMenu";
|
||||
this.PadsSubMenu.Size = new System.Drawing.Size(44, 20);
|
||||
this.PadsSubMenu.Text = "&Pads";
|
||||
this.PadsSubMenu.DropDownOpened += new System.EventHandler(this.PadsSubMenu_DropDownOpened);
|
||||
//
|
||||
// ClearAllMenuItem
|
||||
//
|
||||
|
@ -178,6 +181,13 @@
|
|||
this.ClearAllMenuItem.Text = "&Clear All";
|
||||
this.ClearAllMenuItem.Click += new System.EventHandler(this.ClearAllMenuItem_Click);
|
||||
//
|
||||
// StickyMenuItem
|
||||
//
|
||||
this.StickyMenuItem.Name = "StickyMenuItem";
|
||||
this.StickyMenuItem.Size = new System.Drawing.Size(174, 22);
|
||||
this.StickyMenuItem.Text = "Sticky";
|
||||
this.StickyMenuItem.Click += new System.EventHandler(this.StickyMenuItem_Click);
|
||||
//
|
||||
// VirtualpadTool
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -215,5 +225,6 @@
|
|||
private System.Windows.Forms.CheckBox StickyBox;
|
||||
private System.Windows.Forms.ToolStripMenuItem ClearAllMenuItem;
|
||||
private System.Windows.Forms.GroupBox ControllerBox;
|
||||
private System.Windows.Forms.ToolStripMenuItem StickyMenuItem;
|
||||
}
|
||||
}
|
|
@ -13,12 +13,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
private int _defaultWidth;
|
||||
private int _defaultHeight;
|
||||
|
||||
private List<IVirtualPad> Pads
|
||||
private List<VirtualPad> Pads
|
||||
{
|
||||
get
|
||||
{
|
||||
return ControllerBox.Controls
|
||||
.OfType<IVirtualPad>()
|
||||
.OfType<VirtualPad>()
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public VirtualpadTool()
|
||||
{
|
||||
InitializeComponent();
|
||||
Closing += (o, e) => SaveConfigSettings();
|
||||
TopMost = Global.Config.VirtualPadSettings.TopMost;
|
||||
}
|
||||
|
||||
private void VirtualpadTool_Load(object sender, EventArgs e)
|
||||
|
@ -68,12 +70,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch(Global.Emulator.SystemId)
|
||||
{
|
||||
case "NES":
|
||||
ControllerBox.Controls.Add(new VirtualPadControl(
|
||||
ControllerBox.Controls.Add(new VirtualPad(
|
||||
NesSchema.StandardController(1))
|
||||
{
|
||||
Location = new Point(15, 15)
|
||||
});
|
||||
ControllerBox.Controls.Add(new VirtualPadControl(
|
||||
ControllerBox.Controls.Add(new VirtualPad(
|
||||
NesSchema.StandardController(2))
|
||||
{
|
||||
Location = new Point(200, 15)
|
||||
|
@ -83,6 +85,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void SaveConfigSettings()
|
||||
{
|
||||
Global.Config.VirtualPadSettings.Wndx = Location.X;
|
||||
Global.Config.VirtualPadSettings.Wndy = Location.Y;
|
||||
Global.Config.VirtualPadSettings.Width = Right - Left;
|
||||
Global.Config.VirtualPadSettings.Height = Bottom - Top;
|
||||
|
||||
Global.Config.VirtualPadSticky = StickyBox.Checked;
|
||||
}
|
||||
|
||||
private void RefreshFloatingWindowControl()
|
||||
{
|
||||
Owner = Global.Config.VirtualPadSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||
|
@ -110,7 +122,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
if (!Global.Config.VirtualPadSticky)
|
||||
if (!StickyBox.Checked)
|
||||
{
|
||||
Pads.ForEach(pad => pad.Clear());
|
||||
}
|
||||
|
@ -167,11 +179,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
Close();
|
||||
}
|
||||
|
||||
private void PadsSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
StickyMenuItem.Checked = StickyBox.Checked;
|
||||
}
|
||||
|
||||
private void ClearAllMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClearVirtualPadHolds();
|
||||
}
|
||||
|
||||
private void StickyMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
StickyBox.Checked ^= true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -5,7 +5,7 @@ using BizHawk.Client.Common;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public sealed class AnalogControlPanel : Panel
|
||||
public sealed class AnalogControlPanel : Panel, IVirtualPadControl
|
||||
{
|
||||
public int X = 0;
|
||||
public int Y = 0;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public interface IVirtualPadControl
|
||||
{
|
||||
void Clear();
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ using BizHawk.Client.Common;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public class VirtualPadButton : CheckBox
|
||||
public class VirtualPadButton : CheckBox, IVirtualPadControl
|
||||
{
|
||||
private bool _rightClicked = false;
|
||||
|
||||
|
@ -25,14 +25,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
switch (m.Msg)
|
||||
{
|
||||
case 0x0204://WM_RBUTTONDOWN
|
||||
case 0x0204: // WM_RBUTTONDOWN
|
||||
_rightClicked = true;
|
||||
ForeColor = Color.Red;
|
||||
ForeColor = SystemColors.HotTrack;
|
||||
Checked ^= true;
|
||||
return;
|
||||
case 0x0205://WM_RBUTTONUP
|
||||
case 0x0205: // WM_RBUTTONUP
|
||||
return;
|
||||
case 0x0206://WM_RBUTTONDBLCLK
|
||||
case 0x0206: // WM_RBUTTONDBLCLK
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue