public bool IsKeyPressed(Keys k, bool recheck = false) // check. Optional rescan or use GetEvents. Needs a diff name from above for some reason { if (recheck || ks == null) { ks = keyboard.GetCurrentState(); } Key ky = KeyConversion.KeysToSharpKey(k); return(ks.IsPressed(ky)); }
public bool?IsPressed(string frontierkeyname) // frontier naming convention.. GetEvents must have filled in ks { Key?k = KeyConversion.FrontierNameToSharpKey(frontierkeyname); if (k != null) { return((ks != null) ? ks.IsPressed(k.Value) : false); } else { System.Diagnostics.Debug.WriteLine("FAILED IsPressed " + frontierkeyname); } return(false); }
static public bool CheckTranslation(InputDeviceEvent ev, Keys winkey) // safe to call without including SharpDirectInput { return(KeyConversion.CheckTranslation((Key)ev.EventNumber, winkey)); }
static public System.Windows.Forms.Keys ToKeys(InputDeviceEvent ev) // safe to call without including SharpDirectInput { return(KeyConversion.SharpKeyToKeys((Key)ev.EventNumber)); }
public string EventName(InputDeviceEvent e) // need to return frontier naming convention! { Key k = (Key)(e.EventNumber); return(KeyConversion.SharpKeyToFrontierName(k)); }