Nitpicky cleanups on movie 2.0 code
This commit is contained in:
parent
7a3aba0681
commit
864d3ede2f
|
@ -10,9 +10,9 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
public class BooleanControllerMnemonicGenerator : IMnemonicGenerator
|
public class BooleanControllerMnemonicGenerator : IMnemonicGenerator
|
||||||
{
|
{
|
||||||
private NamedDictionary<string, char> _controllerMnemonics;
|
private readonly NamedDictionary<string, char> _controllerMnemonics;
|
||||||
|
|
||||||
public BooleanControllerMnemonicGenerator(string name, IDictionary<string, char> mnemonics)
|
public BooleanControllerMnemonicGenerator(string name, IEnumerable<KeyValuePair<string, char>> mnemonics)
|
||||||
{
|
{
|
||||||
_controllerMnemonics = new NamedDictionary<string, char>(name);
|
_controllerMnemonics = new NamedDictionary<string, char>(name);
|
||||||
foreach (var kvp in mnemonics)
|
foreach (var kvp in mnemonics)
|
||||||
|
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
|
||||||
var buttons = new Dictionary<string, bool>();
|
var buttons = new Dictionary<string, bool>();
|
||||||
var keys = _controllerMnemonics.Select(kvp => kvp.Key).ToList();
|
var keys = _controllerMnemonics.Select(kvp => kvp.Key).ToList();
|
||||||
|
|
||||||
for (int i = 0; i < mnemonicSegment.Length; i++)
|
for (var i = 0; i < mnemonicSegment.Length; i++)
|
||||||
{
|
{
|
||||||
buttons.Add(keys[i], mnemonicSegment[i] != '.');
|
buttons.Add(keys[i], mnemonicSegment[i] != '.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Client.Common
|
namespace BizHawk.Client.Common
|
||||||
|
@ -14,8 +10,8 @@ namespace BizHawk.Client.Common
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Will be prepended to all button names
|
/// Gets or sets the prefix that will be prepended to all button names
|
||||||
/// Example: "P1"
|
/// Example: "P1" would combine with "Up" to make "P1 Up"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string ControllerPrefix { get; set; }
|
string ControllerPrefix { get; set; }
|
||||||
|
|
||||||
|
@ -26,7 +22,7 @@ namespace BizHawk.Client.Common
|
||||||
string MnemonicString { get; }
|
string MnemonicString { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a string that represents an empty or default mnemonic
|
/// Gets a string that represents an empty or default mnemonic
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string EmptyMnemonicString { get; }
|
string EmptyMnemonicString { get; }
|
||||||
|
|
||||||
|
@ -37,9 +33,6 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IDictionary<string, bool> ParseMnemonicSegment(string mnemonicSegment);
|
IDictionary<string, bool> ParseMnemonicSegment(string mnemonicSegment);
|
||||||
|
|
||||||
// Analog Support TODO: this assume the Generator is boolean
|
|
||||||
//Dictionary<string, bool> GetBoolButtons();
|
|
||||||
|
|
||||||
Dictionary<string, char> AvailableMnemonics { get; }
|
Dictionary<string, char> AvailableMnemonics { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
|
||||||
|
|
||||||
namespace BizHawk.Client.Common
|
namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
|
@ -37,7 +33,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void SetButton(string button, bool pressed)
|
public void SetButton(string button, bool pressed)
|
||||||
{
|
{
|
||||||
InputChanged(new Dictionary<string, bool>() { { button, pressed } });
|
InputChanged(new Dictionary<string, bool> { { button, pressed } });
|
||||||
_boolButtons[button] = pressed;
|
_boolButtons[button] = pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +92,7 @@ namespace BizHawk.Client.Common
|
||||||
public delegate void InputEventHandler(object sender, InputEventArgs e);
|
public delegate void InputEventHandler(object sender, InputEventArgs e);
|
||||||
public event InputEventHandler OnChanged;
|
public event InputEventHandler OnChanged;
|
||||||
|
|
||||||
private void InputChanged(Dictionary <string, bool> editedButtons)
|
private void InputChanged(Dictionary<string, bool> editedButtons)
|
||||||
{
|
{
|
||||||
if (OnChanged != null)
|
if (OnChanged != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace BizHawk.Client.Common
|
namespace BizHawk.Client.Common
|
||||||
|
@ -8,8 +9,7 @@ namespace BizHawk.Client.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DONT USE ME RIGHT NOW
|
/// DONT USE ME RIGHT NOW
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tw"></param>
|
public void WriteToText(TextWriter tw)
|
||||||
public void WriteToText(System.IO.TextWriter tw)
|
|
||||||
{
|
{
|
||||||
tw.WriteLine("[Input]");
|
tw.WriteLine("[Input]");
|
||||||
tw.WriteLine("Frame {0}", Global.Emulator.Frame);
|
tw.WriteLine("Frame {0}", Global.Emulator.Frame);
|
||||||
|
|
Loading…
Reference in New Issue