示例#1
0
 private Key FromXxKey(XxKey key)
 {
     if (mapping.TryGetValue(key, out var value))
     {
         return(value);
     }
     return(Key.Unknown);
 }
示例#2
0
        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);
                }
            }
        }
示例#3
0
        public bool IsKeyJustPressed(XxKey key)
        {
            var tkKey = FromXxKey(key);

            return(currentState.IsKeyDown(tkKey) && !previousState.IsKeyDown(tkKey));
        }
示例#4
0
        public bool IsKeyJustReleased(XxKey key)
        {
            var tkKey = FromXxKey(key);

            return(!currentState.IsKeyDown(tkKey) && previousState.IsKeyDown(tkKey));
        }
示例#5
0
 public bool IsKeyDown(XxKey key) => currentState.IsKeyDown(FromXxKey(key));