Mail Archives: djgpp/1999/10/07/13:20:44
Eli Zaretskii schrieb in Nachricht ...
>
>On Mon, 4 Oct 1999, Roland Moritz wrote:
>
>> And now my question is, how do I empty the keyboard buffer everytime the
>> loop is through, since I don't want, for example, that if a message is
shown
>> for 5 Seconds, and the player pushes some keys, that they will be used as
>> keyboard input the next time the loop is running through, since there are
>> still keys in the buffer...I've tried it with something simple like
>>
>> while (kbhit()
>> c = getch();
>>
>> But it does'nt work...
>
>The above *is* the way to empty the keyboard. If it doesn't work for
>you, please post the shortest test program that can be compiled and
>that demonstrates how does it fail. Please also tell how do you run
>the test program and what do you expect to happen if it did work.
Okay, the shortest test program is the following:
#include <stdlib.h>
#include <stdio.h>
#include "allegro.h"
int main()
{
int c;
allegro_init();
install_timer();
do
{
c = getch();
rest(1000);
while (kbhit())
c = getch();
}
while (c != 27);
}
It basically does the same that happens in a game loop, but doesn't work
(When I press a button for a longer time, I hear a loud beeping, which
means, that the kb-buffer is full, right?)
- Raw text -