fix compile error, some nitpick cleanups
This commit is contained in:
parent
b964ff4c32
commit
ff029968f3
|
@ -20,10 +20,7 @@ namespace BizHawk.Client.Common
|
||||||
_bb = null;
|
_bb = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] GetVideoBuffer()
|
public int[] GetVideoBuffer() => _bb.Pixels;
|
||||||
{
|
|
||||||
return _bb.Pixels;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int VirtualWidth => _bb.Width;
|
public int VirtualWidth => _bb.Width;
|
||||||
|
|
||||||
|
|
|
@ -10,38 +10,23 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ClickyVirtualPadController : IController
|
public class ClickyVirtualPadController : IController
|
||||||
{
|
{
|
||||||
|
private readonly HashSet<string> _pressed = new HashSet<string>();
|
||||||
|
|
||||||
public ControllerDefinition Definition { get; set; }
|
public ControllerDefinition Definition { get; set; }
|
||||||
|
|
||||||
public bool IsPressed(string button)
|
public bool IsPressed(string button) => _pressed.Contains(button);
|
||||||
{
|
|
||||||
return _pressed.Contains(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float AxisValue(string name)
|
public float AxisValue(string name) => 0.0f;
|
||||||
{
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call this once per frame to do the timekeeping for the hold and release
|
/// Call this once per frame to do the timekeeping for the hold and release
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void FrameTick()
|
public void FrameTick() => _pressed.Clear();
|
||||||
{
|
|
||||||
_pressed.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call this to hold the button down for one frame
|
/// Call this to hold the button down for one frame
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Click(string button)
|
public void Click(string button) => _pressed.Add(button);
|
||||||
{
|
|
||||||
_pressed.Add(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Unclick(string button)
|
|
||||||
{
|
|
||||||
_pressed.Remove(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Toggle(string button)
|
public void Toggle(string button)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +51,5 @@ namespace BizHawk.Client.Common
|
||||||
_pressed.Add(button);
|
_pressed.Add(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly HashSet<string> _pressed = new HashSet<string>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,9 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
public ControllerDefinition Definition => Curr.Definition;
|
public ControllerDefinition Definition => Curr.Definition;
|
||||||
|
|
||||||
public bool IsPressed(string button)
|
public bool IsPressed(string button) => Curr.IsPressed(button);
|
||||||
{
|
|
||||||
return Curr.IsPressed(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float AxisValue(string name)
|
public float AxisValue(string name) => Curr.AxisValue(name);
|
||||||
{
|
|
||||||
return Curr.AxisValue(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IController Source { get; set; }
|
public IController Source { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ namespace BizHawk.Client.Common
|
||||||
=> _axisOverrides.ContainsKey(name)
|
=> _axisOverrides.ContainsKey(name)
|
||||||
? _axisOverrides[name]
|
? _axisOverrides[name]
|
||||||
: 0.0F;
|
: 0.0F;
|
||||||
|
|
||||||
|
|
||||||
public IEnumerable<string> Overrides => _overrides.Select(kvp => kvp.Key);
|
public IEnumerable<string> Overrides => _overrides.Select(kvp => kvp.Key);
|
||||||
|
|
||||||
|
|
|
@ -27,15 +27,9 @@ namespace BizHawk.Client.Common
|
||||||
set => Buttons[button] = value;
|
set => Buttons[button] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool IsPressed(string button)
|
public virtual bool IsPressed(string button) => this[button];
|
||||||
{
|
|
||||||
return this[button];
|
|
||||||
}
|
|
||||||
|
|
||||||
public float AxisValue(string name)
|
public float AxisValue(string name) => Axes[name];
|
||||||
{
|
|
||||||
return Axes[name];
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<KeyValuePair<string, bool>> BoolButtons()
|
public IEnumerable<KeyValuePair<string, bool>> BoolButtons()
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void RemoveAllBtn_Click(object sender, EventArgs e)
|
private void RemoveAllBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_registeredFunctions.Clear();
|
_registeredFunctions.Clear(Global.Emulator); // TODO: don't use Global
|
||||||
PopulateListView();
|
PopulateListView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue