[SDL] Events

Dave dgoehrig at valinux.com
Mon Apr 9 15:29:24 PDT 2001

On Mon, Apr 09, 2001 at 11:18:26PM +0200, Matthieu DUFOURNEAUD wrote:
>>> How is it possible to handle SDL events like Java AWT events?

A suggestion, avoid doing it like Java.

To do it like java, you first have to write an event dispatcher,
and then have your objects wait on IPC.  Java's event model is 
heavily thread oriented, and makes sense for that language, but
not as much when threading is done on say a process level.

If you are writing something in C, you are probably better off
with callback lists which gui elements register for, as with
typical X programming.  If you are doing this in C++ its not
that hard to write an interface class to handle all this, and
then derive the various event types.

These two approaches may simply seem semantically different, but
that is because the java class libraries have hidden the nasty
interface to the underlying event system from you...


david j. goehrig		bit twiddler		www.valinux.com

"There was nothing creative, charming, admirable or innovative in
Pokémon except that it parted small children from their
money with brutal efficiency. It inexplicably featured the
dramatic story of cockfighting monsters who lived in your pants..."

				- John Tynes

More information about the SDL mailing list