private void InputUpdate() { this.prevState = this.state; this.state = GamePad.GetState(this.playerIndex); if (this._pos < this._maxLength) { if (this.state.IsConnected) { InputThread.InputStruct inputStruct = this.inputsIn[this._pos]; InputFilter inputFilter = this.leftXFilter; GamePadThumbSticks thumbSticks = this.state.ThumbSticks; GamePadThumbSticks.StickValue left = thumbSticks.Left; inputStruct.leftX = inputFilter.Filter((double)left.X); InputThread.InputStruct inputStruct1 = this.inputsIn[this._pos]; InputFilter inputFilter1 = this.leftYFilter; thumbSticks = this.state.ThumbSticks; left = thumbSticks.Left; inputStruct1.leftY = inputFilter1.Filter((double)left.Y); InputThread.InputStruct inputStruct2 = this.inputsIn[this._pos]; InputFilter inputFilter2 = this.rightXFilter; thumbSticks = this.state.ThumbSticks; left = thumbSticks.Right; inputStruct2.rightX = inputFilter2.Filter((double)left.X); InputThread.InputStruct inputStruct3 = this.inputsIn[this._pos]; InputFilter inputFilter3 = this.rightYFilter; thumbSticks = this.state.ThumbSticks; left = thumbSticks.Right; inputStruct3.rightY = inputFilter3.Filter((double)left.Y); this.inputsIn[this._pos].time = DateTime.UtcNow.Ticks; this.inputsIn[this._pos].leftXVel = this.GetVel(this.inputsIn[this._pos].leftX, this._lastFrameData.leftX, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].leftYVel = this.GetVel(this.inputsIn[this._pos].leftY, this._lastFrameData.leftY, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].rightXVel = this.GetVel(this.inputsIn[this._pos].rightX, this._lastFrameData.rightX, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].rightYVel = this.GetVel(this.inputsIn[this._pos].rightY, this._lastFrameData.rightY, this.inputsIn[this._pos].time, this._lastFrameData.time); this._lastFrameData.leftX = this.inputsIn[this._pos].leftX; this._lastFrameData.leftY = this.inputsIn[this._pos].leftY; this._lastFrameData.rightX = this.inputsIn[this._pos].rightX; this._lastFrameData.rightY = this.inputsIn[this._pos].rightY; this._lastFrameData.time = this.inputsIn[this._pos].time; this._pos++; return; } this.inputsIn[this._pos].leftX = this.leftXFilter.Filter((double)((Mathf.Abs(this.inputController.player.GetAxis("LeftStickX")) < 0.1f ? 0f : this.inputController.player.GetAxis("LeftStickX")))); this.inputsIn[this._pos].leftY = this.leftYFilter.Filter((double)this.inputController.player.GetAxis("LeftStickY")); this.inputsIn[this._pos].rightX = this.rightXFilter.Filter((double)((Mathf.Abs(this.inputController.player.GetAxis("RightStickX")) < 0.1f ? 0f : this.inputController.player.GetAxis("RightStickX")))); this.inputsIn[this._pos].rightY = this.rightYFilter.Filter((double)this.inputController.player.GetAxis("RightStickY")); this.inputsIn[this._pos].time = DateTime.UtcNow.Ticks; this.inputsIn[this._pos].leftXVel = this.GetVel(this.inputsIn[this._pos].leftX, this._lastFrameData.leftX, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].leftYVel = this.GetVel(this.inputsIn[this._pos].leftY, this._lastFrameData.leftY, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].rightXVel = this.GetVel(this.inputsIn[this._pos].rightX, this._lastFrameData.rightX, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].rightYVel = this.GetVel(this.inputsIn[this._pos].rightY, this._lastFrameData.rightY, this.inputsIn[this._pos].time, this._lastFrameData.time); this._lastFrameData.leftX = this.inputsIn[this._pos].leftX; this._lastFrameData.leftY = this.inputsIn[this._pos].leftY; this._lastFrameData.rightX = this.inputsIn[this._pos].rightX; this._lastFrameData.rightY = this.inputsIn[this._pos].rightY; this._lastFrameData.time = this.inputsIn[this._pos].time; this._pos++; } }
public void Filter_WhenNoKeysArePressed_ReturnsNoKeys() { Keys[] result = subject.Filter(new Keys[] {}); Assert.That(result, Is.Empty); }