Multi Keyboard inputs & GLUT

Hello,
I am using Ansi c under win 98 in VC++ (6). I have created a little game using glut where 2 ship shoot at each other. My problem is I want to ba able to hold down say 4 keys at once and be able to detect them (so that I can shoot, turn and accelerate at once). Glut only allows me to do 1 at a time. Does any one know a way around this before I go off and try and figure it out?

Thanks heaps
Jason

The method is to use a buffer and then check later if the key are pressed.

bool buffer[256];

void keyboard(int key, int x, int y )
{
buffer[key] = true;
}

this the keyboard function

Now every frame or everytime you want to update your gameworld, you just check wich keys are down using the buffer and work accordingly.

The other part of that one is

void keyboardUp( int key, int x, int y )
{
buffer[key] = false;
}

and register it with glut as glutKeyboardUpFunc( keyboardUp ).

that should help solve the problem.

Note that you’ll probably need to use glutSpecialFunc() and glutSpecialUpFunc() if you want to use arrow keys, function keys, etc.

I will give it a go.
Thanks for the quick and helpful response.
Cheers
Jason

oups, that was dumb of me to forget that! Thanks phlake!

Worked perfectly, as if i doubted you!

Thank you very much!
Cheers
Jason (big fat meaty smile)