# Fast keyboard repeat code

**URL:** <https://discourse.libsdl.org/t/fast-keyboard-repeat-code/1393>\
**Category:** SDL Development\
**Created:** [December 17, 1999, 12:20pm UTC](https://discourse.libsdl.org/t/fast-keyboard-repeat-code/1393 "1999-12-17T12:20:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Wahle](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/r/6f9a4e/32.png) [@Ryan\_Wahle](https://discourse.libsdl.org/u/Ryan_Wahle)\
**Post date:** [December 17, 1999, 12:20pm UTC](https://discourse.libsdl.org/t/fast-keyboard-repeat-code/1393/1 "1999-12-17T12:20:23Z")

</div>

Here’s some old code that I found that uses the Console… i’m not at  
home right now, but later tonight i will post one that doesn’t use the  
console…

You will probably have to paste it in a bigger window to read it. hehe.

while (quit\_game == FALSE) {  
if (show\_console == TRUE) {  
DrawConsole();  
SDL\_UpdateRect(screen, 0,0,0,0);  
} else {

SDL\_FillRect(screen,0,SDL\_MapRGB(screen-\>format,0,0,0));  
DisplayLogo(screen, “graphics/help.dat”);  
}  
while (SDL\_PollEvent(&event)) {  
if ( event.type == SDL\_QUIT) {  
quit\_game = TRUE;  
}

```
                    if ( event.type == SDL_KEYDOWN) {
                                    if ( event.key.keysym.sym ==

```

SDLK\_BACKQUOTE) {  
if (show\_console == FALSE)  
{  
show\_console =  
TRUE;

SDL\_EnableUNICODE(1);  
} else {  
show\_console =  
FALSE;

SDL\_EnableUNICODE(0);  
}  
}

```
                                    if ( event.key.keysym.sym ==

```

SDLK\_ESCAPE) {  
quit\_game = TRUE;  
}  
if ( show\_console == TRUE ) {  
ConsoleEvents(&event);  
}  
}  
}
