Re: Design for a game with Gtkmm as GUI and GLibmm for threads



Niko Demmel wrote:
> Then I have a multithreaded approach where there is a GUI thread, a
> thread for game logic, possibly later, maybe one for networking and even
> AI. The idea is that every thread runs a Glib::MainLoop and the threads
> communicate through signals and Glib::Dispatchers.

Hm.  Why do you need all the threads at all?  You should be fine with one
and one is times easier to implement than many.  If you need to receive
some non-standard events, e.g. from your network, you can subclass
Glib::Source.  Or just use existing Glib::IOSource, it is sufficient in
many cases.

> Here I've encountered the first problem: you can't have parameters for
> your Dispatcher signals... I'm allready working on a solution: A new
> Dispatcher class template that can take 1, 2, 3... parameters and is
> used in the same fashion as Glib::Dispatcher (I'm kinda mixing ideas of
> libsigcx into the Dispatcher concept of glibmm. Maybe if I do a good job
> this could be reuseable).

Use sigc::bind.  Again, I think you can get away without Dispatcher in
the first place.

Paul



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]