예제 #1
0
 public static bool KeyPressed(Keys key)
 {
     if (KeyboardStateNew.IsKeyDown(key) && KeyboardStateOld.IsKeyUp(key))
     {
         return(true);
     }
     return(false);
 }
예제 #2
0
        public static List <Keys> GetPressedKeys()
        {
            List <Keys> keysNew = new List <Keys>();

            keysNew.AddRange(KeyboardStateNew.GetPressedKeys());
            List <Keys> keysOld = new List <Keys>();

            keysOld.AddRange(KeyboardStateOld.GetPressedKeys());

            foreach (Keys key in keysOld)
            {
                keysNew.Remove(key);
            }

            return(keysNew);
        }