Beispiel #1
0
 private void RaiseButtonDown(Buttons button)
 {
     ButtonDown?.Invoke(this, MakeArgs(button));
     ButtonRepeated?.Invoke(this, MakeArgs(button));
     _lastButton          = button;
     _repeatedButtonTimer = 0;
 }
Beispiel #2
0
        private void CheckRepeatButton()
        {
            _repeatedButtonTimer += _gameTime.ElapsedGameTime.Milliseconds;

            if ((_repeatedButtonTimer < RepeatInitialDelay) || (_lastButton == 0))
            {
                return;
            }

            if (_repeatedButtonTimer < RepeatInitialDelay + RepeatDelay)
            {
                ButtonRepeated?.Invoke(this, MakeArgs(_lastButton));
                _repeatedButtonTimer = RepeatDelay + RepeatInitialDelay;
            }
            else
            {
                if (_repeatedButtonTimer > RepeatInitialDelay + RepeatDelay * 2)
                {
                    ButtonRepeated?.Invoke(this, MakeArgs(_lastButton));
                    _repeatedButtonTimer = RepeatDelay + RepeatInitialDelay;
                }
            }
        }