Archived

This topic is now archived and is closed to further replies.

Puzzler183

GLUT and the keyboard

Recommended Posts

Puzzler183    540
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

Share this post


Link to post
Share on other sites
Puzzler183    540
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...

Share this post


Link to post
Share on other sites
GamerSg    378
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.

Share this post


Link to post
Share on other sites
GamerSg    378
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));

Share this post


Link to post
Share on other sites
Puzzler183    540
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?

Share this post


Link to post
Share on other sites
GamerSg    378
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

Share this post


Link to post
Share on other sites