Hello all.
I'm writing a simple pong game in python, using pyOpenGL of course. I've =
got most of it down, but when I used glutKeyboardFunc to capture input =
from the keyboard, I encountered a problem: when a key is pressed and =
not released, instead of being called continuously (good), my callback =
function is called once, then there's a small delay, and only then is it =
called continuously (bad). I'm not especially knowledgeable about how =
the keyboard works, but this is obviously the same behavior as in a text =
box, when you press any key, it delays a bit after the initial press =
before generating more keypresses.
I've looked in the OpenGL and GLU reference, but none of them seem to =
have any functions that deal with keyboard input. GLUT doesn't seem to =
have any alternate way of checking keypresses, as in SDL, where you can =
check if a key is being pressed NOW, or stack up all key presses so that =
you can deal with them one at a time.
Is there any way to solve this from within OpenGL? Assuming that the =
answer to that is NO, I'm not exactly sure how to approach this problem: =
I've tried doing it through the various modules that come with python, =
no success there (not even a good lead). I've also tried finding other =
libraries or modules to do this with. It occurred to me that I could use =
SDL only for this part of my game, but I don't especially like the idea =
of importing all of it for only this small part that I can't seem to get =
around.
Portability is rather important, but if there's no single module I can =
use to read (what do you call this type of keyboard input anyway?) the =
keyboard in the desired way, a platform-specific solution would be =
helpful also, and the best would be one from within PyOpenGL itself.=20
Oh, and I've searched google for it for lengthy periods of time, and =
even found a thread about a guy who was making.. a pong game! Sadly, no =
one seems to have encountered this problem - or maybe they were not =
bothered by it - or maybe the solution is really obvious - or maybe this =
is all one giant hallucination (God is teasing me again). Either way, =
help would by appreciated.
Amos |