Ejemplo n.º 1
0
        public bool Check()
        {
            if (KeyboardComponent.KeyReleased(_key))
            {
                _tempTime = TimeBetweenRepeat;
            }

            if (KeyboardComponent.KeyPressed(_key))
            {
                return(true);
            }

            if (KeyboardComponent.KeyHolded(_key, RequireElapsedTime) &&
                KeyboardComponent.TotalTimeKeyPressed[_key] >= _tempTime)
            {
                // _tempTime == TimeBetweenRepeat its like
                // KeyHoldedFirstTriggering possibly variable
                // If we do not do it we notice undesirable triggering
                // (RequireElapsedTime.Miliseconds / TimeBetweenRepeat.Miliseconds) times
                if (_tempTime == TimeBetweenRepeat)
                {
                    _tempTime += RequireElapsedTime;
                }

                _tempTime += TimeBetweenRepeat;
                return(true);
            }

            return(false);
        }