gtk_curve help



Hello,
 
I wonder if you could help me with a problem I'm having with the gtk_curve widget.
 
I want to use a curve to control and edit the animation of a character in an avatar customisation application.  Editing the spline curve and getting points from the curve using  gtk_curve_get_vector  works fine.  However it is important to be able to save and reload the curves.  To test reloading I have defined an array of gfloats

gfloat start[]={0.0, 10.0, 50.0, 100.0, 180.0};

and I would like to set up a spline curve using these points.  I realise that gtk_curve_set_vector sets the curve type to GTK_CURVE_TYPE_FREE so I then set the curve type to GTK_CURVE_TYPE_SPLINE.
 
Here's the code:
 
    curveY = gtk_curve_new ();

    gtk_box_pack_start(GTK_BOX(box1), curveY, TRUE, TRUE, 2);

    gtk_curve_set_range(GTK_CURVE (curveY), 0.0, 200.0, -180.0, 180.0);

    gtk_curve_set_vector (GTK_CURVE (curveY), 5, start);

    gtk_curve_set_curve_type(GTK_CURVE (curveY), GTK_CURVE_TYPE_SPLINE);

    gtk_widget_show(curveY);

Unfortunately this doesn't work...

If I miss out the gtk_curve_set_curve_type then I get five straight lines at the right height for the five values in the array, so I assume the proble is in the conversion form free to spline curve type.

Please help!

Thanks in advance,

Alex Daltas



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