Virtualpads - re-implement the "bump" hotkeys
This commit is contained in:
parent
3a011ad788
commit
8cf0f3b379
|
@ -113,5 +113,23 @@ namespace BizHawk.Client.EmuHawk
|
||||||
.ToList()
|
.ToList()
|
||||||
.ForEach(c => c.SetPrevious(previous));
|
.ForEach(c => c.SetPrevious(previous));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void BumpAnalog(int? x, int? y)
|
||||||
|
{
|
||||||
|
PadControls
|
||||||
|
.OfType<VirtualPadAnalogStick>()
|
||||||
|
.ToList()
|
||||||
|
.ForEach(a => a.Bump(x, y));
|
||||||
|
|
||||||
|
PadControls
|
||||||
|
.OfType<VirtualPadAnalogButton>()
|
||||||
|
.ToList()
|
||||||
|
.ForEach(a => a.Bump(x));
|
||||||
|
|
||||||
|
PadControls
|
||||||
|
.OfType<VirtualPadTargetScreen>()
|
||||||
|
.ToList()
|
||||||
|
.ForEach(a => a.Bump(x, y));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Pads.ForEach(pad => pad.Clear());
|
Pads.ForEach(pad => pad.Clear());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BumpAnalogValue(int? dx, int? dy) // TODO: multi-player
|
public void BumpAnalogValue(int? x, int? y) // TODO: multi-player
|
||||||
{
|
{
|
||||||
|
Pads.ForEach(pad => pad.BumpAnalog(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreatePads()
|
private void CreatePads()
|
||||||
|
|
|
@ -59,6 +59,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public void Bump(int? x)
|
||||||
|
{
|
||||||
|
if (x.HasValue)
|
||||||
|
{
|
||||||
|
CurrentValue = CurrentValue + x.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void VirtualPadAnalogButton_Load(object sender, EventArgs e)
|
private void VirtualPadAnalogButton_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DisplayNameLabel.Text = DisplayName;
|
DisplayNameLabel.Text = DisplayName;
|
||||||
|
@ -110,8 +118,22 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
int val;
|
||||||
|
if (value > AnalogTrackBar.Maximum)
|
||||||
|
{
|
||||||
|
val = AnalogTrackBar.Maximum;
|
||||||
|
}
|
||||||
|
else if (value < AnalogTrackBar.Minimum)
|
||||||
|
{
|
||||||
|
val = AnalogTrackBar.Minimum;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
val = value;
|
||||||
|
}
|
||||||
|
|
||||||
_programmaticallyChangingValue = true;
|
_programmaticallyChangingValue = true;
|
||||||
AnalogTrackBar.Value = value;
|
AnalogTrackBar.Value = val;
|
||||||
ValueLabel.Text = AnalogTrackBar.Value.ToString();
|
ValueLabel.Text = AnalogTrackBar.Value.ToString();
|
||||||
_programmaticallyChangingValue = false;
|
_programmaticallyChangingValue = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,23 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public void Bump(int? x, int? y)
|
||||||
|
{
|
||||||
|
if (x.HasValue)
|
||||||
|
{
|
||||||
|
AnalogStick.HasValue = true;
|
||||||
|
AnalogStick.X += x.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y.HasValue)
|
||||||
|
{
|
||||||
|
AnalogStick.HasValue = true;
|
||||||
|
AnalogStick.Y += y.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetNumericsFromAnalog();
|
||||||
|
}
|
||||||
|
|
||||||
public void SetPrevious(IController previous)
|
public void SetPrevious(IController previous)
|
||||||
{
|
{
|
||||||
AnalogStick.SetPrevious(previous);
|
AnalogStick.SetPrevious(previous);
|
||||||
|
|
|
@ -76,6 +76,21 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public void Bump(int? x, int? y)
|
||||||
|
{
|
||||||
|
if (x.HasValue)
|
||||||
|
{
|
||||||
|
X = X + x.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y.HasValue)
|
||||||
|
{
|
||||||
|
Y = Y + y.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
public string XName { get; set; }
|
public string XName { get; set; }
|
||||||
public string YName { get; set; }
|
public string YName { get; set; }
|
||||||
public string FireButton { get; set; } // Fire, Press, etc
|
public string FireButton { get; set; } // Fire, Press, etc
|
||||||
|
|
Loading…
Reference in New Issue