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