My code upto now is attached.
It is some very basic code for a Pong game.
Two issues here...
1. Cannot figure out how to make the motion of the paddles instantaneous and smooth.
2. In the code, I think ive written it such that the paddle speed is 0 when i release the direction keys. But it doesn't seem to work
Thank you guys!
OpenGl AutoRepeat Issues
This is input code; OpenGL has nothing whatsoever to do with input - it's for graphics only and nothing else.
It's also GLUT. GLUT isn't OpenGL and OpenGL isn't GLUT. GLUT is a simple and relatively high-level framework for handling some of the required OS interaction stuff in a portable manner. It's a layer between OpenGL and your OS, and that's all. It's also not intended to be fully-featured in these respects, so it's probably not a suitable choice for game input.
My advice? Port to something like SDL instead.
It's also GLUT. GLUT isn't OpenGL and OpenGL isn't GLUT. GLUT is a simple and relatively high-level framework for handling some of the required OS interaction stuff in a portable manner. It's a layer between OpenGL and your OS, and that's all. It's also not intended to be fully-featured in these respects, so it's probably not a suitable choice for game input.
My advice? Port to something like SDL instead.
This is input code; OpenGL has nothing whatsoever to do with input - it's for graphics only and nothing else.
It's also GLUT. GLUT isn't OpenGL and OpenGL isn't GLUT. GLUT is a simple and relatively high-level framework for handling some of the required OS interaction stuff in a portable manner. It's a layer between OpenGL and your OS, and that's all. It's also not intended to be fully-featured in these respects, so it's probably not a suitable choice for game input.
My advice? Port to something like SDL instead.
Thank You, but I knew that this was a GLUT issue.
I just couldn't find the concerned forum. Sorry to waste your time
I don't have any experience about GLUT, but the basic idea is to make variables for the keys. For example bool keyUp, and set keyUp to true when the up key is pressed (and set it false when the key is released). Now... when you update the scene, if(keyUp == true) movePaddle();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement