Esempio n. 1
0
        public string EventName(InputDeviceEvent e) // need to return frontier naming convention!
        {
            Key k = (Key)(e.EventNumber);

            string keyname = k.ToString();
            string newname = keyname;

            if (keyname.Length == 2 && keyname[0] == 'D')
            {
                newname = keyname.Substring(1);
            }
            else if (keyname.StartsWith("NumberPad") && char.IsDigit(keyname[9]))
            {
                newname = "Numpad_" + keyname[9];
            }
            else
            {
                int i = Array.FindIndex(strtx, x => x.Item1.Equals(keyname));
                if (i >= 0)
                {
                    newname = strtx[i].Item2;
                }
            }

            newname = "Key_" + newname;
            //System.Diagnostics.Debug.WriteLine("Name is " + keyname + "=>" + newname);
            return(newname);
        }
        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 string EventName(InputDeviceEvent e)
 {
     if (e.EventNumber < POVBase)
     {
         return("Joy_" + e.EventNumber);
     }
     else if (e.EventNumber < AxisBase)
     {
         string j = "Joy_POV" + (e.EventNumber - POVBase);
         return(j + ((povdir.ContainsKey(e.Value)) ? (povdir[e.Value]) : "Centred"));
     }
     else
     {
         return("Joy_" + ((Axis)(e.EventNumber - AxisBase)).ToString() + "Axis");
     }
 }
 static public System.Windows.Forms.Keys ToKeys(InputDeviceEvent ev) // safe to call without including SharpDirectInput
 {
     return((Keys)ev.EventNumber);
 }
        public string EventName(InputDeviceEvent e)     // in Forms.keys naming convention - not in sharp DX.
        {
            Keys k = (Keys)(e.EventNumber);

            return(k.VKeyToString());
        }
Esempio n. 6
0
 static public bool CheckTranslation(InputDeviceEvent ev, Keys winkey) // safe to call without including SharpDirectInput
 {
     return(KeyConversion.CheckTranslation((Key)ev.EventNumber, winkey));
 }
Esempio n. 7
0
 static public string SharpKeyName(InputDeviceEvent ev) // safe to call without including SharpDirectInput
 {
     return(((Key)ev.EventNumber).ToString());
 }
Esempio n. 8
0
        public string EventName(InputDeviceEvent e) // need to return frontier naming convention!
        {
            Key k = (Key)(e.EventNumber);

            return(KeyConversion.SharpKeyToFrontierName(k));
        }
Esempio n. 9
0
 public string EventName(InputDeviceEvent e) // need to return frontier naming convention!
 {
     return("Mouse_" + e.EventNumber.ToStringInvariant());
 }