Beispiel #1
0
 public static Point?GetDirectionPressed(this IDictionary <Keys, Point> map, InputTwinState state, int repeatStart, int repeatStep)
 {
     if (map.Any(x => state.IsKeyPressed(x.Key, repeatStart, repeatStep)))
     {
         return(GetDirectionDown(map, state));
     }
     return(null);
 }
Beispiel #2
0
        public static Point?GetDirectionNumpadPressed(InputTwinState state, int repeatStart, int repeatStep)
        {
            var result = NumpadKeys.Where(x => state.IsKeyPressed(x.Key, repeatStart, repeatStep)).Select(x => x.Value);

            if (result.Count() == 1)
            {
                return(result.Single());
            }
            return(null);
        }
Beispiel #3
0
        public static int?GetNumberPressed(this IDictionary <Keys, int> map, InputTwinState state, int repeatStart, int repeatStep)
        {
            var result = map.Where(x => state.IsKeyPressed(x.Key, repeatStart, repeatStep)).Select(x => x.Value);

            if (result.Count() == 1)
            {
                return(result.Single());
            }
            return(null);
        }