From a3df5345f6fc5f12d738619a004c808ddd342f63 Mon Sep 17 00:00:00 2001 From: beirich Date: Mon, 4 Jul 2011 23:36:06 +0000 Subject: [PATCH] GetPressedKey() progress, returns keyboard with desired modifier-key properties --- BizHawk.MultiClient/Input/Input.cs | 4 +- BizHawk.MultiClient/Input/Keyboard.cs | 82 +++++++++++++++++++++++---- 2 files changed, 72 insertions(+), 14 deletions(-) diff --git a/BizHawk.MultiClient/Input/Input.cs b/BizHawk.MultiClient/Input/Input.cs index 1065b62aeb..dc1b539999 100644 --- a/BizHawk.MultiClient/Input/Input.cs +++ b/BizHawk.MultiClient/Input/Input.cs @@ -99,9 +99,7 @@ namespace BizHawk.MultiClient } } - // TODO: poll keyboard input - - return null; + return KeyInput.GetPressedKey(); } } } diff --git a/BizHawk.MultiClient/Input/Keyboard.cs b/BizHawk.MultiClient/Input/Keyboard.cs index b9cdac558e..e008dcecac 100644 --- a/BizHawk.MultiClient/Input/Keyboard.cs +++ b/BizHawk.MultiClient/Input/Keyboard.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Text; using SlimDX; using SlimDX.DirectInput; @@ -64,20 +65,79 @@ namespace BizHawk.MultiClient return false; } - public static Key? GetPressedKey() + public static string GetPressedKey() { - // TODO uhh this will return the same key over and over though. if (state.PressedKeys.Count == 0) return null; - if (state.PressedKeys[0] == Key.NumberPad8) - return Key.UpArrow; - if (state.PressedKeys[0] == Key.NumberPad2) - return Key.DownArrow; - if (state.PressedKeys[0] == Key.NumberPad4) - return Key.LeftArrow; - if (state.PressedKeys[0] == Key.NumberPad6) - return Key.RightArrow; - return state.PressedKeys[0]; + + Key? key = null; + for (int i=0; i