[gcompris-devel] howto implement a timer?

Bruno Coudoin bruno.coudoin at free.fr
Thu Mar 21 10:44:07 UTC 2002


In gcompris we use widely:

id = gtk_timeout_add (200,(GtkFunction) clickgame_drop_items, NULL);

gtk_timeout_remove (id);

200 is in mili seconds, an example of usage is in clickgame.c

Are you planning another great feature for gcompris ;)

Something we miss is to be able to play animated png. Nobody never
looked at that, but it would make gcompris much more friendly.
Especially, Renaud already sent me the boat moving in the waves ;)

Bruno.



le jeu 21-03-2002 à 19:30, Bastiaan Verhoef a écrit :
> Sorry for this stupid question, but.
> 
> For example I want to draw  lines but animated. with a timer.
> I have a function draw_a_line.how can I do it?
> 
> int i;
> for( i=0;i<10;i++)
> {
> 	draw_a_line(my_canvas,i,i,i+2,i,"green");
> }
> 
> -----------------------------
> 
> static void
> draw_a_line(GnomeCanvasGroup *group,
> 	    int x1, int y1, int x2, int y2, char *color)
> {
> 	GnomeCanvasPoints *points;
> 
> 	points = gnome_canvas_points_new (2);
> 
> 	points->coords[0] = x1;
> 	points->coords[1] = y1;
> 	points->coords[2] = x2;
> 	points->coords[3] = y2;
> 	gnome_canvas_item_new(group,
> 			      gnome_canvas_line_get_type(),
> 			      "points", points,
> 			      "fill_color", color,
> 			      "width_units", (double)thickness,
> 			      NULL);
> 
> 	gnome_canvas_points_free(points);
> }
> 
> 
> 
> 
> _______________________________________________
> gcompris-devel mailing list
> gcompris-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gcompris-devel






More information about the Gcompris-devel mailing list