[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Reference to a C++ object in GTK+ callbacks
- From: Daryl Lee <dlee altaregos com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Reference to a C++ object in GTK+ callbacks
- Date: Tue, 13 Dec 2005 20:29:31 -0700
On Tue, 2005-12-13 at 16:30 -0800, Stephen Pollei wrote:
> On 12/13/05, Paul Santa Maria <paulsm1021 yahoo com> wrote:
> > I'm coding in C++, but using the "raw" GTK+ C
> > libraries.
> I'm doing similiar for a game I'm making.
>
> > ------------------
> > gboolean
> > play_cb (gpointer data)
> > {
> > // Deference the object pointer to do the actual work
> > AnimationFile *ani = (AnimationFile *)data;
> > ani->start ();
> > }
> Are you sure that is the right style for that callback?
> static void
> rocket_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
> {
> class city_node *city=static_cast<class city_node *>(data);
> global_game.rocket_up(*city);
> city->update_targets();
> each_tick(NULL);
> }
C++ functions do, indeed, have to be "static" to be used as GTK+
callbacks.
--
Daryl Lee
Open the Present--It's a Gift.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]