示例#1
0
        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));
        }
示例#2
0
        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);
        }
示例#3
0
 static public bool CheckTranslation(InputDeviceEvent ev, Keys winkey) // safe to call without including SharpDirectInput
 {
     return(KeyConversion.CheckTranslation((Key)ev.EventNumber, winkey));
 }
示例#4
0
 static public System.Windows.Forms.Keys ToKeys(InputDeviceEvent ev) // safe to call without including SharpDirectInput
 {
     return(KeyConversion.SharpKeyToKeys((Key)ev.EventNumber));
 }
示例#5
0
        public string EventName(InputDeviceEvent e) // need to return frontier naming convention!
        {
            Key k = (Key)(e.EventNumber);

            return(KeyConversion.SharpKeyToFrontierName(k));
        }