[SDL] Game event loop and input

Gabriel Gambetta mystml at adinet.com.uy
Sat Feb 9 14:31:39 PST 2008


>
> So what I came up with is kind of similar, I guess. ^_^  I'm not sure
> why or if the layers idea would be better, but either could be easily
> done in SDL (on-topic!) and work rather nicely, I think.
>

Great minds think alike? ;) Our (http://www.mysterystudio.com) framework is
based on this same concept (we call them GameModes) and has been used in
quite a few commercially released games. So it the idea works :)

About input processing and stuff, our GameModes have a few flags :
GMF_PASS_INPUT, GMF_PASS_DRAW and GMF_PASS_UPDATE. The flags determine
whether or not input, a chance to draw, or timer ticks can pass to the mode
below it in the stack, respectively. Most combinations are useful - for
example, a full-screen mode (main menu, game screen) have none of the flags
set. Modal dialogs have PASS_DRAW - you see what's below, but it's stopped.
Non-modal dialogs have PASS_DRAW | PASS_INPUT | PASS_UPDATE - the mode below
continues to run while showing the dialog. Finally, remember Doom's map,
where you saw the 2D overhead map but the game continued to run below?
PASS_INPUT | PASS_UPDATE. Actually, it was with this last example in mind I
designed the mode stack and the flags :)

--Gabriel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080209/fc9afed8/attachment.html 


More information about the SDL mailing list