sneak/Jumpy.Shared/KeyboardInput.cs
Colin McMillen 149ecf8075 Basic working skeleton in OpenGL and UWP.
GitOrigin-RevId: 762b683654e20eb28346d9b2de7fbb8c826a2966
2020-02-13 14:39:05 -05:00

24 lines
593 B
C#

using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
namespace Jumpy {
public class KeyboardInput {
private KeyboardState oldState = Keyboard.GetState();
private List<Keys> newKeysDown = new List<Keys>();
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<Keys> NewKeysDown() {
return newKeysDown;
}
}
}