Input Widget - allow mapping to just ctrl, alt, or shift
This commit is contained in:
parent
a659c05b21
commit
0e36c7d401
|
@ -22,7 +22,7 @@ namespace BizHawk.MultiClient
|
||||||
public static string[] SMSControlList = new string[] { "Up", "Down", "Left", "Right", "B1", "B2", "Pause", "Reset" };
|
public static string[] SMSControlList = new string[] { "Up", "Down", "Left", "Right", "B1", "B2", "Pause", "Reset" };
|
||||||
public static string[] PCEControlList = new string[] { "Up", "Down", "Left", "Right", "I", "II", "Run", "Select" };
|
public static string[] PCEControlList = new string[] { "Up", "Down", "Left", "Right", "I", "II", "Run", "Select" };
|
||||||
public static string[] GenesisControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "C", "Start", "X,T,0", "Y=", "Z" };
|
public static string[] GenesisControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "C", "Start", "X,T,0", "Y=", "Z" };
|
||||||
public static string[] NESControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "Select", "Start"};
|
public static string[] NESControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "Select", "Start" };
|
||||||
public static string[] TI83ControlList = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "ON",
|
public static string[] TI83ControlList = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "ON",
|
||||||
"ENTER", "Up", "Down", "Left", "Right", "+", "-", "Multiply", "Divide", "CLEAR", "^", "-", "(", ")", "TAN", "VARS",
|
"ENTER", "Up", "Down", "Left", "Right", "+", "-", "Multiply", "Divide", "CLEAR", "^", "-", "(", ")", "TAN", "VARS",
|
||||||
"COS", "PRGM", "STAT", "Matrix", "X", "STO->", "LN", "LOG", "^2", "^-1", "MATH", "ALPHA", "GRAPH", "TRACE", "ZOOM", "WINDOW",
|
"COS", "PRGM", "STAT", "Matrix", "X", "STO->", "LN", "LOG", "^2", "^-1", "MATH", "ALPHA", "GRAPH", "TRACE", "ZOOM", "WINDOW",
|
||||||
|
@ -630,7 +630,7 @@ namespace BizHawk.MultiClient
|
||||||
prevHeight = Size.Height;
|
prevHeight = Size.Height;
|
||||||
AllowLR.Checked = Global.Config.AllowUD_LR;
|
AllowLR.Checked = Global.Config.AllowUD_LR;
|
||||||
|
|
||||||
if(Global.Game != null)
|
if (Global.Game != null)
|
||||||
switch (Global.Game.System)
|
switch (Global.Game.System)
|
||||||
{
|
{
|
||||||
case "SMS":
|
case "SMS":
|
||||||
|
|
|
@ -13,6 +13,9 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IBinding> Bindings = new List<IBinding>();
|
public List<IBinding> Bindings = new List<IBinding>();
|
||||||
|
bool ctrlWasPressed = false;
|
||||||
|
bool altWasPressed = false;
|
||||||
|
bool shiftWasPressed = false;
|
||||||
|
|
||||||
void UpdateLabel()
|
void UpdateLabel()
|
||||||
{
|
{
|
||||||
|
@ -52,6 +55,78 @@ namespace BizHawk.MultiClient
|
||||||
this.Parent.SelectNextControl(this, true, true, true, true);
|
this.Parent.SelectNextControl(this, true, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnKeyUp(KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyData == Keys.ControlKey)
|
||||||
|
{
|
||||||
|
if (ctrlWasPressed)
|
||||||
|
{
|
||||||
|
KeyboardBinding kb = new KeyboardBinding();
|
||||||
|
kb.key = Keys.ControlKey;
|
||||||
|
Bindings.Clear();
|
||||||
|
Bindings.Add(kb);
|
||||||
|
UpdateLabel();
|
||||||
|
this.Parent.SelectNextControl(this, true, true, true, true);
|
||||||
|
ctrlWasPressed = false;
|
||||||
|
shiftWasPressed = false;
|
||||||
|
altWasPressed = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ctrlWasPressed = true;
|
||||||
|
shiftWasPressed = false;
|
||||||
|
altWasPressed = false;
|
||||||
|
BackColor = SystemColors.ControlLight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (e.KeyData == Keys.ShiftKey)
|
||||||
|
{
|
||||||
|
if (shiftWasPressed)
|
||||||
|
{
|
||||||
|
KeyboardBinding kb = new KeyboardBinding();
|
||||||
|
kb.key = Keys.ShiftKey;
|
||||||
|
Bindings.Clear();
|
||||||
|
Bindings.Add(kb);
|
||||||
|
UpdateLabel();
|
||||||
|
this.Parent.SelectNextControl(this, true, true, true, true);
|
||||||
|
ctrlWasPressed = false;
|
||||||
|
shiftWasPressed = false;
|
||||||
|
altWasPressed = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shiftWasPressed = true;
|
||||||
|
altWasPressed = false;
|
||||||
|
ctrlWasPressed = false;
|
||||||
|
BackColor = SystemColors.ControlLight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (e.KeyData == Keys.Menu)
|
||||||
|
{
|
||||||
|
if (altWasPressed)
|
||||||
|
{
|
||||||
|
KeyboardBinding kb = new KeyboardBinding();
|
||||||
|
kb.key = Keys.Menu;
|
||||||
|
Bindings.Clear();
|
||||||
|
Bindings.Add(kb);
|
||||||
|
UpdateLabel();
|
||||||
|
this.Parent.SelectNextControl(this, true, true, true, true);
|
||||||
|
ctrlWasPressed = false;
|
||||||
|
shiftWasPressed = false;
|
||||||
|
altWasPressed = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
altWasPressed = true;
|
||||||
|
ctrlWasPressed = false;
|
||||||
|
shiftWasPressed = false;
|
||||||
|
BackColor = SystemColors.ControlLight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnKeyUp(e);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnKeyPress(KeyPressEventArgs e)
|
protected override void OnKeyPress(KeyPressEventArgs e)
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
@ -91,6 +166,12 @@ namespace BizHawk.MultiClient
|
||||||
string str = "";
|
string str = "";
|
||||||
|
|
||||||
str += key.ToString();
|
str += key.ToString();
|
||||||
|
if (str.Length == 10 && str == "ControlKey")
|
||||||
|
str = "LeftControl";
|
||||||
|
if (str.Length == 4 && str == "Menu")
|
||||||
|
str = "LeftAlt";
|
||||||
|
if (str.Length == 8 && str == "ShiftKey")
|
||||||
|
str = "LeftShift";
|
||||||
if (str.Length == 2 && str == "Up")
|
if (str.Length == 2 && str == "Up")
|
||||||
str = "UpArrow";
|
str = "UpArrow";
|
||||||
if (str.Length == 4 && str == "Down")
|
if (str.Length == 4 && str == "Down")
|
||||||
|
|
Loading…
Reference in New Issue