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)
|
switch (button.Type)
|
||||||
{
|
{
|
||||||
case PadSchema.PadInputType.Boolean:
|
case PadSchema.PadInputType.Boolean:
|
||||||
var checkbox = new CheckBox
|
var checkbox = new VirtualPadButton
|
||||||
{
|
{
|
||||||
Appearance = Appearance.Button,
|
|
||||||
AutoSize = true,
|
AutoSize = true,
|
||||||
Location = button.Location,
|
Location = button.Location,
|
||||||
ForeColor = _schema.IsConsole ? Color.Red : SystemColors.ControlText,
|
|
||||||
Name = button.Name,
|
Name = button.Name,
|
||||||
Text = button.DisplayName,
|
Text = button.DisplayName,
|
||||||
Image = button.Icon
|
Image = button.Icon
|
||||||
};
|
};
|
||||||
|
|
||||||
checkbox.CheckedChanged += Boolean_CheckedChanged;
|
|
||||||
|
|
||||||
Controls.Add(checkbox);
|
Controls.Add(checkbox);
|
||||||
break;
|
break;
|
||||||
case PadSchema.PadInputType.FloatPair:
|
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 class VirtualPadButton : CheckBox
|
||||||
{
|
{
|
||||||
public string ControllerButton = String.Empty;
|
|
||||||
private bool _rightClicked = false;
|
private bool _rightClicked = false;
|
||||||
|
|
||||||
public VirtualPadButton()
|
public VirtualPadButton()
|
||||||
|
@ -18,8 +17,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
SetStyle(ControlStyles.DoubleBuffer, true);
|
SetStyle(ControlStyles.DoubleBuffer, true);
|
||||||
|
|
||||||
Appearance = Appearance.Button;
|
Appearance = Appearance.Button;
|
||||||
|
AutoSize = true;
|
||||||
ForeColor = Color.Black;
|
ForeColor = SystemColors.ControlText;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void WndProc(ref Message m)
|
protected override void WndProc(ref Message m)
|
||||||
|
@ -42,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
protected void SetSticky()
|
protected void SetSticky()
|
||||||
{
|
{
|
||||||
Global.StickyXORAdapter.SetSticky(ControllerButton, Checked);
|
Global.StickyXORAdapter.SetSticky(Name, Checked);
|
||||||
|
|
||||||
if (Checked == false)
|
if (Checked == false)
|
||||||
{
|
{
|
||||||
|
@ -52,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
protected void SetAutofireSticky()
|
protected void SetAutofireSticky()
|
||||||
{
|
{
|
||||||
Global.AutofireStickyXORAdapter.SetSticky(ControllerButton, Checked);
|
Global.AutofireStickyXORAdapter.SetSticky(Name, Checked);
|
||||||
|
|
||||||
if (Checked == false)
|
if (Checked == false)
|
||||||
{
|
{
|
||||||
|
@ -79,18 +78,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (e.Button == MouseButtons.Left)
|
if (e.Button == MouseButtons.Left)
|
||||||
{
|
{
|
||||||
_rightClicked = false;
|
_rightClicked = false;
|
||||||
ForeColor = Color.Black;
|
ForeColor = SystemColors.ControlText;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnMouseClick(e);
|
base.OnMouseClick(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
_rightClicked = false;
|
_rightClicked = false;
|
||||||
ForeColor = Color.Black;
|
ForeColor = SystemColors.ControlText;
|
||||||
Checked = false;
|
Checked = false;
|
||||||
Global.AutofireStickyXORAdapter.SetSticky(ControllerButton, false);
|
Global.AutofireStickyXORAdapter.SetSticky(Name, false);
|
||||||
Global.StickyXORAdapter.SetSticky(ControllerButton, false);
|
Global.StickyXORAdapter.SetSticky(Name, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue