using Microsoft.Xna.Framework.Input; using System.Collections.Generic; namespace Jumpy { public class KeyboardInput { private KeyboardState oldState = Keyboard.GetState(); private List newKeysDown = new List(); public void Update() { KeyboardState newState = Keyboard.GetState(); newKeysDown.Clear(); foreach (Keys k in newState.GetPressedKeys()) { if (!oldState.IsKeyDown(k)) { newKeysDown.Add(k); } } oldState = newState; } public List NewKeysDown() { return newKeysDown; } } }