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

            return(KeyConversion.SharpKeyToFrontierName(k));
        }