All pastes #544269 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-06 11:30 UTC
rendered paste body
        public void Update ( )
        {
            KeysElapsed += DeltaTime;

            for ( int i = 0; i < Key.Length; i++ )
            {
                char Chr = ( char ) i;

                if ( Key [ i ] && KeysElapsed >= 50 )
                {
                    if ( Char.IsLetterOrDigit ( Chr ) || Char.IsPunctuation ( Chr ) )
                    {
                        if ( LastChar == Chr && KeysElapsed < 500 )
                            return;
                        else
                            if ( LastChar == Chr && KeysElapsed >= 500 )
                            {
                                KeyHeldDuration += DeltaTime;
                                if ( KeyHeldDuration >= 50 )
                                {
                                    Engine.Renderer.Driver.Debug.AddText ( "Key '" + Chr + "' was pressed", Color.LightBlue.ToArgb ( ) );
                                    KeyHeldDuration = 0;
                                }
                                break;
                            }

                        LastChar = Chr;

                        Engine.Renderer.Driver.Debug.AddText ( "Key '" + Chr + "' was pressed", Color.LightBlue.ToArgb ( ) );
                    }

                    KeysElapsed = 0;
                }
            }
        }