GLUT and the keyboard

Started by
6 comments, last by Puzzler183 20 years, 7 months ago
Well, after hours of debugging I gave up and now have a working template with GLUT, ready to have logic code inserted. Except for one thing. Is there are way to detect multiple keys via GLUT? Perhaps in an array of bools, and turn them on and off? Or will I be forced to push something onto a queue every time I get a key? Does anyone have an altogether different idea? O__O
Advertisement
Turn off key repeat and change your array of bools every time you get a keydown or keyup callback.
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
Well I would do that except I haven''t found a way to do key down/key up with GLUT... And I''d prefer to keep this cross platform compatible and not use SDL although I''m thinking that''s what I may have to do...
If you are using Glut 3.7(I think), you have access to a glutKeyUpFunc or something like that. I would love to post the code but my harddisk just crashed and i lost most of my code in the process.

But it can definitely be done in GLUT.
Nvm i found it.

void glutKeyboardUpFunc(void (*func)(unsigned char key,int x,int y));
void glutSpecialUpFunc(void (*func)(int key,int x, int y));

What about the down function? Or is glutKeyboardFunc for the down function... I''m really confused... And the GLUT manual I found didn''t really help.:/
quote:Original post by Puzzler183
What about the down function? Or is glutKeyboardFunc for the down function... I''m really confused... And the GLUT manual I found didn''t really help.:/


Anyone?
Yes it is
glutKeyboardFunc();

Pretty easy to use. You might want to take a look at this:
http://www.lighthouse3d.com/opengl/glut/index.php3?7

This topic is closed to new replies.

Advertisement