On 2/15/07, Matthieu Fertré <[EMAIL PROTECTED]> wrote:

Hi,

I have began rewriting input management in a cleaner way but I am
currently in
front of a problem.

First of all, let's speak about the game loop to understand!
...

I have been trying to understand the game loop / keyboard input recently
myself (in an effort to figure out why wormux pegs my cpu at 100%), and have
come across a few questions of my own that I don't understand in the
keyboard management.

1. Goto statements in Keyboard::HandleKeyPressed()
 This just seems like an awful idea. Every state that doesn't return
executes a goto, which makes me wonder why they don't just break and run the
goto'ed code right after the switch and before the last return. Unless the
code uses goto's for a very specific reason (and I can't see one) I would
recommend making this change.

2. The reason for disabling the sdl repeat keys option and instead handling
it via Keyboard::Refresh.
 I believe I might understand this one, but I would like to know if I am
right. It would seem that in using the sdl library's repeat key option, the
event queue could quickly get swamped with events that would slow down
rendering, so wormux handles them in a special case to make sure a held down
key is only processed once a frame. I haven't looked at if the
HandleKeyRefreshed_X() functions do anything different then the other key
press functions, but I suppose using the sdl way wouldn't allow for this
type of differentiation even if it was needed?
This second misunderstanding isn't really important, but I am curious as to
why wormux handles held down keys the way it does. Is any part of my hunch
correct?


kyle (robo210)
_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à