static public bool CheckTranslation(InputDeviceEvent ev) // safe to call without including SharpDirectInput Debug use { Keys ky = ToKeys(ev); Key sk = SharpKeyConversion.KeysToSharpKey(ky); Keys back = SharpKeyConversion.SharpKeyToKeys(sk); System.Diagnostics.Debug.WriteLine("Check " + ky.VKeyToString() + " -> " + sk + " ->" + back.VKeyToString()); return(ky == back); }
public List <InputDeviceEvent> GetEvents() // Events use keys enumeration { ks = keyboard.GetCurrentState(); KeyboardUpdate[] ke = keyboard.GetBufferedData(); List <InputDeviceEvent> events = new List <InputDeviceEvent>(); foreach (KeyboardUpdate k in ke) { Keys ky = SharpKeyConversion.SharpKeyToKeys(k.Key); //System.Diagnostics.Debug.WriteLine("** Sharp key " + k.Key + " " + (int)k.Key + k.IsPressed); //System.Diagnostics.Debug.WriteLine( " => " + ky.ToString() + " norm " + ky.VKeyToString() + ":" + (int)ky ); events.Add(new InputDeviceEvent(this, (int)ky, k.IsPressed)); } return((events.Count > 0) ? events : null); }