ClutterBehaviourPath

ClutterBehaviourPath — A behaviour class interpolating actors along a defined path.

Synopsis




                    ClutterKnot;
ClutterKnot*        clutter_knot_copy                   (const ClutterKnot *knot);
void                clutter_knot_free                   (ClutterKnot *knot);
gboolean            clutter_knot_equal                  (const ClutterKnot *knot_a,
                                                         const ClutterKnot *knot_b);
                    ClutterBehaviourPath;
                    ClutterBehaviourPathClass;
ClutterBehaviour*   clutter_behaviour_path_new          (ClutterAlpha *alpha,
                                                         const ClutterKnot *knots,
                                                         guint n_knots);
GSList*             clutter_behaviour_path_get_knots    (ClutterBehaviourPath *pathb);
void                clutter_behaviour_path_append_knot  (ClutterBehaviourPath *pathb,
                                                         const ClutterKnot *knot);
void                clutter_behaviour_path_append_knots (ClutterBehaviourPath *pathb,
                                                         const ClutterKnot *first_knot,
                                                         ...);
void                clutter_behaviour_path_insert_knot  (ClutterBehaviourPath *pathb,
                                                         guint offset,
                                                         const ClutterKnot *knot);
void                clutter_behaviour_path_remove_knot  (ClutterBehaviourPath *pathb,
                                                         guint offset);
void                clutter_behaviour_path_clear        (ClutterBehaviourPath *pathb);


Object Hierarchy


  GObject
   +----ClutterBehaviour
         +----ClutterBehaviourPath

Properties


  "knot"                     ClutterKnot           : Write

Signals


  "knot-reached"                                   : Run Last

Description

ClutterBehaviourPath interpolates actors along a defined path.

A path is a set of ClutterKnots object given when creating a new ClutterBehaviourPath instance. Knots can be also added to the path using clutter_behaviour_path_append_knot(). The whole path can be cleared using clutter_behaviour_path_clear(). Each time the behaviour reaches a knot in the path, the "knot-reached" signal is emitted.

Details

ClutterKnot

typedef struct {
  gint x,y;
  /* FIXME: optionally include bezier control points also ? */
} ClutterKnot;

A single node of the path followed by a ClutterBehaviourPath.

gint x; X coordinate of the node
gint y; Y coordinate of the node

clutter_knot_copy ()

ClutterKnot*        clutter_knot_copy                   (const ClutterKnot *knot);

Makes an allocated copy of a knot.

knot : a ClutterKnot
Returns : the copied knot.

Since 0.2


clutter_knot_free ()

void                clutter_knot_free                   (ClutterKnot *knot);

Frees the memory of an allocated knot.

knot : a ClutterKnot

Since 0.2


clutter_knot_equal ()

gboolean            clutter_knot_equal                  (const ClutterKnot *knot_a,
                                                         const ClutterKnot *knot_b);

Compares to knot and checks if the point to the same location.

knot_a : First knot
knot_b : Second knot
Returns : TRUE if the knots point to the same location.

Since 0.2


ClutterBehaviourPath

typedef struct _ClutterBehaviourPath ClutterBehaviourPath;

The ClutterBehaviourPath structure contains only private data, and should not be accessed directly.


ClutterBehaviourPathClass

typedef struct {
  ClutterBehaviourClass   parent_class;

  void (*knot_reached) (ClutterBehaviourPath *pathb,
                        const ClutterKnot    *knot);

  void (*_clutter_path_1) (void);
  void (*_clutter_path_2) (void);
  void (*_clutter_path_3) (void);
  void (*_clutter_path_4) (void);
} ClutterBehaviourPathClass;

Class structure for ClutterBehaviourPath.


clutter_behaviour_path_new ()

ClutterBehaviour*   clutter_behaviour_path_new          (ClutterAlpha *alpha,
                                                         const ClutterKnot *knots,
                                                         guint n_knots);

Creates a new path behaviour. You can use this behaviour to drive actors along the nodes of a path, described by the knots.

alpha : a ClutterAlpha, or NULL
knots : a list of ClutterKnots, or NULL for an empty path
n_knots : the number of nodes in the path
Returns : a ClutterBehaviour

Since 0.2


clutter_behaviour_path_get_knots ()

GSList*             clutter_behaviour_path_get_knots    (ClutterBehaviourPath *pathb);

Returns a copy of the list of knots contained by pathb

pathb : a ClutterBehvaiourPath
Returns : a GSList of the paths knots.

Since 0.2


clutter_behaviour_path_append_knot ()

void                clutter_behaviour_path_append_knot  (ClutterBehaviourPath *pathb,
                                                         const ClutterKnot *knot);

Appends a ClutterKnot to the path

pathb : a ClutterBehvaiourPath
knot : a ClutterKnot to append.

Since 0.2


clutter_behaviour_path_append_knots ()

void                clutter_behaviour_path_append_knots (ClutterBehaviourPath *pathb,
                                                         const ClutterKnot *first_knot,
                                                         ...);

Adds a NULL-terminated list of knots to a path. This function is equivalent to calling clutter_behaviour_path_append_knot() for each member of the list.

pathb : a ClutterBehvaiourPath
first_knot : the ClutterKnot knot to add to the path
... : additional knots to add to the path

Since 0.2


clutter_behaviour_path_insert_knot ()

void                clutter_behaviour_path_insert_knot  (ClutterBehaviourPath *pathb,
                                                         guint offset,
                                                         const ClutterKnot *knot);

Inserts a ClutterKnot in the path at specified position. Values greater than total number of knots will append the knot at the end of path.

pathb : a ClutterBehvaiourPath
offset : position in path to insert knot.
knot : a ClutterKnot to append.

Since 0.2


clutter_behaviour_path_remove_knot ()

void                clutter_behaviour_path_remove_knot  (ClutterBehaviourPath *pathb,
                                                         guint offset);

Removes a ClutterKnot in the path at specified offset.

pathb : a ClutterBehvaiourPath
offset : position in path to remove knot.

Since 0.2


clutter_behaviour_path_clear ()

void                clutter_behaviour_path_clear        (ClutterBehaviourPath *pathb);

Removes all knots from a path

pathb : a ClutterBehvaiourPath

Since 0.2

Property Details

The "knot" property

  "knot"                     ClutterKnot           : Write

This property can be used to append a new knot to the path.

Since 0.2

Signal Details

The "knot-reached" signal

void                user_function                      (ClutterBehaviourPath *pathb,
                                                        ClutterKnot          *knot,
                                                        gpointer              user_data)      : Run Last

This signal is emitted each time a node defined inside the path is reached.

pathb : the object which received the signal
knot : the ClutterKnot reached
user_data : user data set when the signal handler was connected.

Since 0.2