i appreciate your help a lot. im still fairly new to programming (10 months), so
its hard for my to understand all of this. but i appreciate you helping me here.
I dont use SDL_PumpEvents. Instead, i do SDL_PollEvents(), but, to be honest,
inside this loop i dont do much, since most of the stuff i grab directly. For
example, my loop looks like this:
Inside this while loop, i dont do much. I only check for an SDL_QUIT message and
an SDL_UserEvent message. All other input is taken directly. After the loop, i do
keys = SDL_GetKeyState(NULL);
keys is a Uint8*. then, everywhere else in the game, i just do something like
somekey was pressed!
Nope, it does not mean that a key was pressed. It means a key is
currently being pressed. The way you are handling events can be OK for
mouse movement, you probably only want to know where it is, not where it
has been. But, and it is a very big but, doing what you are doing will
almost certainly cause you to miss key presses and mouse clicks. And,
the odds of missing them will depend on the frame rate of your game.
(I’m assuming you are doing your loop once per frame.) That means it
might work just fine on a fast machine and be flaky as all get out on a
slightly slower machine.
this is doing the same thing as PumpEvents then, no? im pretty sure calling
PollEvents() is the equivalent of calling PumpEvents(). so im missing input…
The way you are doing things the events are getting handled, and then
thrown away in your while loop.
im still not sure on how to avoid / fix this. could you please, if you dont
mind, explain or give a small example on how it would work then? it seems pretty
complicated. it doesnt help that my game is 5 months in development, 65+ files
and 10k + lines of code, either =(.
Sure, go to
read the article. It covers the basics of how to write an event loop
along with a bunch of other stuff.
You are going to have to rewrite a lot of that 10K of code. Don’t get
discouraged, we all have had to that at one time or another.
Bob PendletonOn Fri, 2004-09-17 at 15:31, Drew Ferraro wrote:
SDL mailing list
SDL at libsdl.org