[SDL] Re: Game event loop and input
david at olofson.net
Fri Jan 31 16:13:01 PST 2003
On Friday 31 January 2003 19.59, Calvin Spealman wrote:
> David Olofson wrote:
> > In Kobo Deluxo, I'm using a generic game state class for this.
> > When you add a state to the game, you derive from a state class,
> > override handlers for events, video frames, game logic frames
> > etc. The state manager class has methods for switching and
> > pushing states, so you can either replace the current state with
> > another state, or "call" the another state, subroutine style.
> This sounds like a very useful system and much like what I was
> thinking of doing in my project. Your way seems much better tho.
> I'm going to have to take a look at the kobo-deluxe source and see
> what i can learn.
Please, go ahead. That code (as most other new files I've added) is
LGPL, so you can even use it as is or modified, regardless of what
license you use for your game.
BTW, as you might notice, Kobo Deluxe implements "state on state" by
calling back to the previous state on the stack. That's how I put
menues and stuff on top of whatever game state is running. So, you
could just have someone fire up the options dialog in the middle of
the game. In fact, it would work even if you have one or more other
menues "active" on the stack, as they'd just pass the "up calls" on.
//David Olofson - Programmer, Composer, Open Source Advocate
.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`---------------------------> http://olofson.net/audiality -'
--- http://olofson.net --- http://www.reologica.se ---
More information about the SDL