private void RaiseButtonDown(Buttons button) { ButtonDown.Raise(this, MakeArgs(button)); ButtonRepeated.Raise(this, MakeArgs(button)); _lastButton = button; _repeatedButtonTimer = 0; }
private void CheckRepeatButton() { _repeatedButtonTimer += _gameTime.ElapsedGameTime.Milliseconds; if (_repeatedButtonTimer < RepeatInitialDelay || _lastButton == 0) { return; } if (_repeatedButtonTimer < RepeatInitialDelay + RepeatDelay) { ButtonRepeated.Raise(this, MakeArgs(_lastButton)); _repeatedButtonTimer = RepeatDelay + RepeatInitialDelay; } else if (_repeatedButtonTimer > RepeatInitialDelay + RepeatDelay * 2) { ButtonRepeated.Raise(this, MakeArgs(_lastButton)); _repeatedButtonTimer = RepeatDelay + RepeatInitialDelay; } }