• Advertisement

Archived

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

GLUT and the keyboard

This topic is 5286 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Turn off key repeat and change your array of bools every time you get a keydown or keyup callback.

Share this post


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

Share this post


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

  • Advertisement