Mail Archives: djgpp/1997/07/26/12:01:06
You wrote:
>Hello fellow DJGPP'ers, I have a bit of code that does not exactly do
>what I think IT should do. I think that the code should loop without
>any user intervention but that does not seem to be the case. The
>printf statement is only executed whenver I touch a key, I wanteds it
>to be continous without key input, what am I doing wrong?
>
>Sorry for teh following code snippet, but I'm at work now and don't
>have the real code in front of me, but here is what it does
>
>The "readkey" is an ALLEGRO function for reading keyboard input
A direct quote from ALLEGRO.TXT:
int readkey();
Returns the next character from the keyboard buffer. If the buffer is
empty, it waits until a key is pressed.
>void main_loop(void)
>{
>
> while (quit != 1)
> {
> readkey(...
> readkey(...
> readkey(...
> readkey(...
> readkey(...
What are all these readkeys trying to accomplish? As it reads you are just
getting keypresses and ignoring them. There's a function called clear_keybuf
if that's what you want.
>
> if (this and that) do this...
> if (this and that) do this...
> if (this and that) do this...
>
> printf("Depth: %d Heading: %d Speed: %d\n",depth,heading,speed);
> } // end while loop
>} //end function
HTH
Nate Eldredge
eldredge AT ap DOT net
- Raw text -