private Key FromXxKey(XxKey key) { if (mapping.TryGetValue(key, out var value)) { return(value); } return(Key.Unknown); }
public OpenTkKeyboard() { foreach (var name in Enum.GetNames(typeof(XxKey))) { XxKey key = Enum.Parse <XxKey>(name); if (Enum.TryParse <Key>(name, out var value)) { mapping.Add(key, value); } } }
public bool IsKeyJustPressed(XxKey key) { var tkKey = FromXxKey(key); return(currentState.IsKeyDown(tkKey) && !previousState.IsKeyDown(tkKey)); }
public bool IsKeyJustReleased(XxKey key) { var tkKey = FromXxKey(key); return(!currentState.IsKeyDown(tkKey) && previousState.IsKeyDown(tkKey)); }
public bool IsKeyDown(XxKey key) => currentState.IsKeyDown(FromXxKey(key));