internal Pad(PlayerIndex playerIndex, IPadInputProvider provider) { PlayerIndex = playerIndex; this.provider = provider; Is = new IsSub(GetState, GetOldState); Was = new WasSub(GetOldState); }
/// <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); }
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); } }