Implement GetPressedKey for joysticks, untested; keyboard polling is in progress

This commit is contained in:
beirich 2011-07-04 20:45:05 +00:00
parent fed74b17b2
commit 9bd1d75ba1
1 changed files with 18 additions and 1 deletions

View File

@ -83,7 +83,24 @@ namespace BizHawk.MultiClient
public static string GetPressedKey()
{
//for (int j = 0; j < GamePad.Devices.Count; j++)
// Poll Joystick input
for (int j = 0; j < GamePad.Devices.Count; j++)
{
if (GamePad.Devices[j].Up) return "J" + (j+1) + " Up";
if (GamePad.Devices[j].Down) return "J" + (j+1) + " Down";
if (GamePad.Devices[j].Left) return "J" + (j+1) + " Left";
if (GamePad.Devices[j].Right) return "J" + (j+1) + " Right";
var buttons = GamePad.Devices[j].Buttons;
for (int b=0; b<buttons.Length; b++)
{
if (buttons[b])
return "J" + (j+1) + " B" + (b+1);
}
}
// TODO: poll keyboard input
return null;
}
}