Virtualpads - Use VirtualPadButton instead of Checkbox (to give all buttons right-click autofire capability)
This commit is contained in:
parent
c3bcc0cbc8
commit
c15f9ce84d
|
@ -36,19 +36,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (button.Type)
|
||||
{
|
||||
case PadSchema.PadInputType.Boolean:
|
||||
var checkbox = new CheckBox
|
||||
var checkbox = new VirtualPadButton
|
||||
{
|
||||
Appearance = Appearance.Button,
|
||||
AutoSize = true,
|
||||
Location = button.Location,
|
||||
ForeColor = _schema.IsConsole ? Color.Red : SystemColors.ControlText,
|
||||
Name = button.Name,
|
||||
Text = button.DisplayName,
|
||||
Image = button.Icon
|
||||
};
|
||||
|
||||
checkbox.CheckedChanged += Boolean_CheckedChanged;
|
||||
|
||||
Controls.Add(checkbox);
|
||||
break;
|
||||
case PadSchema.PadInputType.FloatPair:
|
||||
|
@ -77,11 +73,5 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
private void Boolean_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
var cbox = sender as CheckBox;
|
||||
Global.StickyXORAdapter.SetSticky(cbox.Name, cbox.Checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public class VirtualPadButton : CheckBox
|
||||
{
|
||||
public string ControllerButton = String.Empty;
|
||||
private bool _rightClicked = false;
|
||||
|
||||
public VirtualPadButton()
|
||||
|
@ -18,8 +17,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
|
||||
Appearance = Appearance.Button;
|
||||
|
||||
ForeColor = Color.Black;
|
||||
AutoSize = true;
|
||||
ForeColor = SystemColors.ControlText;
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
|
@ -42,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
protected void SetSticky()
|
||||
{
|
||||
Global.StickyXORAdapter.SetSticky(ControllerButton, Checked);
|
||||
Global.StickyXORAdapter.SetSticky(Name, Checked);
|
||||
|
||||
if (Checked == false)
|
||||
{
|
||||
|
@ -52,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
protected void SetAutofireSticky()
|
||||
{
|
||||
Global.AutofireStickyXORAdapter.SetSticky(ControllerButton, Checked);
|
||||
Global.AutofireStickyXORAdapter.SetSticky(Name, Checked);
|
||||
|
||||
if (Checked == false)
|
||||
{
|
||||
|
@ -79,18 +78,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
_rightClicked = false;
|
||||
ForeColor = Color.Black;
|
||||
ForeColor = SystemColors.ControlText;
|
||||
}
|
||||
|
||||
base.OnMouseClick(e);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_rightClicked = false;
|
||||
ForeColor = Color.Black;
|
||||
ForeColor = SystemColors.ControlText;
|
||||
Checked = false;
|
||||
Global.AutofireStickyXORAdapter.SetSticky(ControllerButton, false);
|
||||
Global.StickyXORAdapter.SetSticky(ControllerButton, false);
|
||||
Global.AutofireStickyXORAdapter.SetSticky(Name, false);
|
||||
Global.StickyXORAdapter.SetSticky(Name, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue