コード例 #1
0
ファイル: KeyboardMatrix.cs プロジェクト: alfishe/ZXMAK2
        //private int MakeRowValue(
        //    Func<IKeyboardState, bool>[] conditions,
        //    IKeyboardState state)
        //{
        //    return conditions
        //        .Select((arg, index) => arg(state) ? 1 << index : 0)
        //        .Aggregate((seed, item) => seed | item);
        //}

        private Func <IKeyboardState, bool> GetCondition(SpeccyKey key)
        {
            var binding = _keyBindings
                          .FirstOrDefault(arg => arg.Key == key);

            if (binding == null)
            {
                return(arg => false);
            }
            return(arg => binding.Match(arg));
        }
コード例 #2
0
ファイル: KeyBinding.cs プロジェクト: zxmak/ZXMAK2
 public KeyBinding(SpeccyKey key, IEnumerable <IKeyCondition> conditions)
 {
     Key         = key;
     _conditions = conditions;
 }