Original Post
🔒 Locked
detect space bar release
Advertisement
Quote:
Original post by Codeka
OpenGL is a graphics library, it has no support for keyboard input at all.
What platform are you running on? Do you already have a library to handle input?
I am using Visual Studio C++ 2008. For input, I am using glutKeyboardFunc() to capture a space bar hit (detects an ASCII value of 32 if input is through the space bar), but the problem is when do I find out the user is not pressing the space bar anymore?
Let me be a little more specific here. I am developing a golf game in which space bar is provided to the user as an input to provide the force with which the ball is hit. Now, the user has to press the space bar if he wants to increase the force. The moment he/she releases the space bar, my program will have to hit the ball with the force provided by the user, which means, I need to find out, when the user actually released the space bar, so that I can grab those values and calculate the necessary vectors.
Quote:A Google search for 'glut key release' led me here (first hit). In particular, look here and here.
I am using Visual Studio C++ 2008. For input, I am using glutKeyboardFunc() to capture a space bar hit (detects an ASCII value of 32 if input is through the space bar), but the problem is when do I find out the user is not pressing the space bar anymore?
Let me be a little more specific here. I am developing a golf game in which space bar is provided to the user as an input to provide the force with which the ball is hit. Now, the user has to press the space bar if he wants to increase the force. The moment he/she releases the space bar, my program will have to hit the ball with the force provided by the user, which means, I need to find out, when the user actually released the space bar, so that I can grab those values and calculate the necessary vectors.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement