示例#1
0
 internal Pad(PlayerIndex playerIndex, IPadInputProvider provider)
 {
     PlayerIndex   = playerIndex;
     this.provider = provider;
     Is            = new IsSub(GetState, GetOldState);
     Was           = new WasSub(GetOldState);
 }
示例#2
0
 /// <summary>
 ///     Constructor that lets you inject input-providers for testing purposes.
 /// </summary>
 public InputManager(IKeyInputProvider keyInputProvider, IMouseInputProvider mouseInputProvider,
                     IPadInputProvider padInputProvider, ITouchInputProvider touchInputProvider)
 {
     Key   = new Key(keyInputProvider);
     Mouse = new Mouse(mouseInputProvider);
     SetProviderForPads(padInputProvider);
     Touch = new Touch(touchInputProvider);
 }
示例#3
0
        private void SetProviderForPads(IPadInputProvider provider)
        {
            var players = Enum.GetNames(typeof(PlayerIndex));

            pads = new Pad[players.Length];
            for (var i = 0; i < players.Length; i++)
            {
                pads[i] = new Pad((PlayerIndex)i, provider);
            }
        }