[gtkmm] How to do call a function once every 'frame'? And some documentation feedback.



Hi,

I'm trying to find out how to have a function called once every 'frame'. In a Win32 program that would mean something like:

while (!quit)
{
    // Win32 event handling here
    // ...

    DoFrame();
}

How would I do this in gtkmm2?

Looking through the reference documentation I get a pretty long list of candidates that might have something to do with it: Gtk::Main::signal_run, Gtk::Main::run_impl, Gtk::Main::iteration_impl, Glib::MainLoop, etc. But all of them are pretty poorly documented. I tried connection &DoFrame to signal_run but it seems this is not what I want. As for the rest, I don't even know how to try them out. Should I sub-class Gtk::Main to override the virtual functions ..._impl (the Template Method pattern)? Should I use Glib::MainLoop? How? What's a MainContext?

All of these questions remain (largely) unanswered. It seems the reference documentation can use a lot of improvement. There's a lot of missing documentation and also a lot of plain stupid documentation. Here is one example that shows the latter:


SignalIdle Glib::MainContext::signal_idle()

Idle signal, attached to this MainContext.

Returns:
    A signal proxy; you want to use SignalIdle::connect().


This little piece of documentation tells you ABSOLUTELY NOTHING that the function signature doesn't tell you. I don't want to know that signal_idle stands for the idle signal, I want to know WHAT an idle signal is and WHEN it is called. The documentation for Gtk::Main::signal_quit is much better for example.

The tutorial is very good IMHO, but it does not tell you everything. That's what the reference documentation is supposed to do, right?

So can anyone who knows gtkmm2 well enough that he doesn't need the reference tell me how I would accomplish my once every 'frame' function?

Thanks in advance,
Dirk Gerrits






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