Help! Need keyboard input during while loop

Hello,

I’m in trouble. I need to be able to use the glutKeyboardFunc(’’’) function to accept input from the keyboard while my shapes are moving across the screen. I’m using a while loop to move the shapes, and I’m doing this in the void display(void) function. When I enter a loop, my keyboard dies. It’s in c. Any help would save me! I tried to look at the tutorials, but they don’t answer my question. Please help!

hello, i don’t know the answer, but,
maybe, there is a function that let the OS do what it needs to do,
vb programmers are familiar with DoEvents,
i think that msdn talk about this even for c++.

you put a DoEven in the loop and each loop a small amount of time is given to the OS to perform things like IO, etc…

i don’t know how to do with glut, but hope it will be usefull.

Marsu

Thanks for replying! I already got that advice at work today, but I figured aout what to do anyway. I ditched the while loop and let my keyboard function keep calling the display function to get the iteration. Now onto circles… lol

BTW, I have another problem. I need to restart the program when a certain key is pressed, and I don’t know of an easy way to do it (I can exit easily, though). Well, my work-around is to reset a few globals, but the moving shapes carry on from the last location even though I reset the x,y coordinate.

Sorry about being so wordy, I’m hyped up now that I have keyboard functionality and this darn homework is almost done.

Thanks again…