public static bool KeyPressed(Keys key) { if (KeyboardStateNew.IsKeyDown(key) && KeyboardStateOld.IsKeyUp(key)) { return(true); } return(false); }
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); }