Refactor input display to use the GetControllersAsMneumonic() function from the emulator core. Hook up PCE GetControllersAsMneumonic()

This commit is contained in:
andres.delikat 2011-02-26 22:04:17 +00:00
parent 0ed57b443b
commit d0e37373a4
3 changed files with 30 additions and 69 deletions

View File

@ -15,7 +15,29 @@
public string GetControllersAsMneumonic()
{
return "|........|0|"; //TODO: implement
//TODO: Implement all controllers
string input = "";
if (Controller.IsPressed("Up")) input += "U";
else input += " ";
if (Controller.IsPressed("Down")) input += "D";
else input += " ";
if (Controller.IsPressed("Left")) input += "L";
else input += " ";
if (Controller.IsPressed("Right")) input += "R";
else input += " ";
if (Controller.IsPressed("I")) input += "1";
else input += " ";
if (Controller.IsPressed("II")) input += "2";
else input += " ";
if (Controller.IsPressed("Select")) input += "S";
else input += " ";
if (Controller.IsPressed("Run")) input += "R";
else input += " ";
input += "|.|"; //TODO: Add commands like reset here
return input;
}
private byte inputSelector;

View File

@ -48,7 +48,7 @@
input += "|";
if (Controller.IsPressed("Reset")) input += "R";
else input += "0";
else input += ".";
input += "|";

View File

@ -259,20 +259,7 @@ namespace BizHawk.MultiClient
if (Global.Config.DisplayInput)
{
string input = "";
switch (Global.Emulator.SystemId)
{
case "SMS":
input = MakeSMSInputDisplay();
break;
case "PCE":
input = MakePCEInputDisplay();
break;
default:
break;
}
string input = MakeInputDisplay();
MessageFont.DrawString(null, input, 1, 16, new Color4(Color.White));
}
}
@ -309,60 +296,12 @@ namespace BizHawk.MultiClient
}
}
public string MakeSMSInputDisplay()
public string MakeInputDisplay()
{
string input = "";
if (Global.Emulator.Controller.IsPressed("P1 Up")) input += "U";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P1 Down")) input += "D";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P1 Left")) input += "L";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P1 Right")) input += "R";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P1 B1")) input += "1";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P1 B2")) input += "2";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P2 Up")) input += "U";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P2 Down")) input += "D";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P2 Left")) input += "L";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P2 Right")) input += "R";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P2 B1")) input += "1";
else input += " ";
if (Global.Emulator.Controller.IsPressed("P2 B2")) input += "2";
else input += " ";
if (Global.Emulator.Controller.IsPressed("Pause")) input += "S";
else input += " ";
if (Global.Emulator.Controller.IsPressed("Reset")) input += "R";
else input += " ";
return input;
}
public string MakePCEInputDisplay()
{
string input = "";
if (Global.Emulator.Controller.IsPressed("Up")) input += "U";
else input += " ";
if (Global.Emulator.Controller.IsPressed("Down")) input += "D";
else input += " ";
if (Global.Emulator.Controller.IsPressed("Left")) input += "L";
else input += " ";
if (Global.Emulator.Controller.IsPressed("Right")) input += "R";
else input += " ";
if (Global.Emulator.Controller.IsPressed("I")) input += "1";
else input += " ";
if (Global.Emulator.Controller.IsPressed("II")) input += "2";
else input += " ";
if (Global.Emulator.Controller.IsPressed("Select")) input += "S";
else input += " ";
if (Global.Emulator.Controller.IsPressed("Run")) input += "R";
else input += " ";
return input;
string tmp = Global.Emulator.GetControllersAsMneumonic();
tmp = tmp.Replace(".", " ");
tmp = tmp.Replace("|", "");
return tmp;
}
}