Input Widget - when autotab is off, cycle through the key mappings instead

This commit is contained in:
andres.delikat 2011-07-09 17:50:52 +00:00
parent 7dbe4472d9
commit b1e1fa498c
1 changed files with 13 additions and 1 deletions

View File

@ -7,7 +7,10 @@ namespace BizHawk.MultiClient
{ {
public class InputWidget : TextBox public class InputWidget : TextBox
{ {
//TODO: when binding, make sure that the new key combo is not in one of the other bindings
int MaxBind = 4; //Max number of bindings allowed int MaxBind = 4; //Max number of bindings allowed
int pos = 0; //Which mapping the widget will listen for
private Timer timer = new Timer(); private Timer timer = new Timer();
public bool AutoTab = true; public bool AutoTab = true;
string[] Bindings = new string[4]; string[] Bindings = new string[4];
@ -39,6 +42,7 @@ namespace BizHawk.MultiClient
protected override void OnEnter(EventArgs e) protected override void OnEnter(EventArgs e)
{ {
pos = 0;
timer.Start(); timer.Start();
base.OnEnter(e); base.OnEnter(e);
Input.Update(); Input.Update();
@ -74,7 +78,8 @@ namespace BizHawk.MultiClient
if (TempBindingStr == "Alt+F4") if (TempBindingStr == "Alt+F4")
return; return;
Bindings[0] = TempBindingStr; Bindings[pos] = TempBindingStr;
wasPressed = TempBindingStr;
UpdateLabel(); UpdateLabel();
Increment(); Increment();
} }
@ -103,6 +108,13 @@ namespace BizHawk.MultiClient
{ {
if (AutoTab) if (AutoTab)
this.Parent.SelectNextControl(this, true, true, true, true); this.Parent.SelectNextControl(this, true, true, true, true);
else
{
if (pos == MaxBind - 1)
pos = 0;
else
pos++;
}
} }
public void ClearBindings() public void ClearBindings()