[gcompris-devel] howto implement a timer?

Bastiaan Verhoef b.f.verhoef at student.utwente.nl
Thu Mar 21 10:32:06 UTC 2002


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);
}







More information about the Gcompris-devel mailing list