Nitpicky cleanups on movie 2.0 code

This commit is contained in:
adelikat 2014-01-11 15:05:41 +00:00
parent 7a3aba0681
commit 864d3ede2f
4 changed files with 12 additions and 23 deletions

View File

@ -10,9 +10,9 @@ namespace BizHawk.Client.Common
{
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);
foreach (var kvp in mnemonics)
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
var buttons = new Dictionary<string, bool>();
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] != '.');
}

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common
@ -14,8 +10,8 @@ namespace BizHawk.Client.Common
string Name { get; }
/// <summary>
/// Will be prepended to all button names
/// Example: "P1"
/// Gets or sets the prefix that will be prepended to all button names
/// Example: "P1" would combine with "Up" to make "P1 Up"
/// </summary>
string ControllerPrefix { get; set; }
@ -26,7 +22,7 @@ namespace BizHawk.Client.Common
string MnemonicString { get; }
/// <summary>
/// Returns a string that represents an empty or default mnemonic
/// Gets a string that represents an empty or default mnemonic
/// </summary>
string EmptyMnemonicString { get; }
@ -37,9 +33,6 @@ namespace BizHawk.Client.Common
/// </summary>
IDictionary<string, bool> ParseMnemonicSegment(string mnemonicSegment);
// Analog Support TODO: this assume the Generator is boolean
//Dictionary<string, bool> GetBoolButtons();
Dictionary<string, char> AvailableMnemonics { get; }
}
}

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common
{
@ -37,7 +33,7 @@ namespace BizHawk.Client.Common
public void SetButton(string button, bool pressed)
{
InputChanged(new Dictionary<string, bool>() { { button, pressed } });
InputChanged(new Dictionary<string, bool> { { button, pressed } });
_boolButtons[button] = pressed;
}
@ -96,7 +92,7 @@ namespace BizHawk.Client.Common
public delegate void InputEventHandler(object sender, InputEventArgs e);
public event InputEventHandler OnChanged;
private void InputChanged(Dictionary <string, bool> editedButtons)
private void InputChanged(Dictionary<string, bool> editedButtons)
{
if (OnChanged != null)
{

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace BizHawk.Client.Common
@ -8,8 +9,7 @@ namespace BizHawk.Client.Common
/// <summary>
/// DONT USE ME RIGHT NOW
/// </summary>
/// <param name="tw"></param>
public void WriteToText(System.IO.TextWriter tw)
public void WriteToText(TextWriter tw)
{
tw.WriteLine("[Input]");
tw.WriteLine("Frame {0}", Global.Emulator.Frame);