2007-08-03 09:52:52 +00:00
|
|
|
|
2007-04-30 08:39:11 +00:00
|
|
|
/* -*- mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Authored By Tomas Frydrych <tf@openedhand.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 OpenedHand
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:clutter-behaviour-ellipse
|
2007-11-19 16:35:46 +00:00
|
|
|
* @short_description: A behaviour interpolating position along an ellipse
|
2007-04-30 08:39:11 +00:00
|
|
|
*
|
|
|
|
* #ClutterBehaviourEllipse interpolates actors along a path defined by
|
2007-06-01 10:00:35 +00:00
|
|
|
* an ellipse.
|
2007-04-30 08:39:11 +00:00
|
|
|
*
|
2007-08-07 12:17:15 +00:00
|
|
|
* Note, on applying an ellipse behaviour to an actor its position will
|
|
|
|
* be set to what is dictated by the ellipses initial position.
|
|
|
|
*
|
2007-04-30 08:39:11 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "clutter-fixed.h"
|
|
|
|
#include "clutter-marshal.h"
|
|
|
|
#include "clutter-behaviour-ellipse.h"
|
2007-07-22 22:35:45 +00:00
|
|
|
#include "clutter-debug.h"
|
2007-04-30 08:39:11 +00:00
|
|
|
#include "clutter-enum-types.h"
|
|
|
|
#include "clutter-private.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <memory.h>
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* ClutterBehaviourEllipse *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
|
2007-07-27 08:18:41 +00:00
|
|
|
G_DEFINE_TYPE (ClutterBehaviourEllipse,
|
2007-04-30 08:39:11 +00:00
|
|
|
clutter_behaviour_ellipse,
|
|
|
|
CLUTTER_TYPE_BEHAVIOUR);
|
|
|
|
|
|
|
|
#define CLUTTER_BEHAVIOUR_ELLIPSE_GET_PRIVATE(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
|
|
|
|
CLUTTER_TYPE_BEHAVIOUR_ELLIPSE, \
|
|
|
|
ClutterBehaviourEllipsePrivate))
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
|
|
|
|
PROP_CENTER,
|
|
|
|
PROP_WIDTH,
|
|
|
|
PROP_HEIGHT,
|
2007-11-13 13:21:56 +00:00
|
|
|
PROP_ANGLE_START,
|
2007-04-30 08:39:11 +00:00
|
|
|
PROP_ANGLE_END,
|
2007-07-27 08:18:41 +00:00
|
|
|
PROP_ANGLE_TILT_X,
|
|
|
|
PROP_ANGLE_TILT_Y,
|
|
|
|
PROP_ANGLE_TILT_Z,
|
2007-07-26 13:48:44 +00:00
|
|
|
PROP_DIRECTION,
|
2007-04-30 08:39:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _ClutterBehaviourEllipsePrivate
|
|
|
|
{
|
|
|
|
ClutterKnot center;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-04-30 08:39:11 +00:00
|
|
|
gint a;
|
|
|
|
gint b;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-11-13 13:21:56 +00:00
|
|
|
ClutterAngle angle_start;
|
2007-04-30 08:39:11 +00:00
|
|
|
ClutterAngle angle_end;
|
2007-07-27 08:18:41 +00:00
|
|
|
ClutterAngle angle_tilt_x;
|
|
|
|
ClutterAngle angle_tilt_y;
|
|
|
|
ClutterAngle angle_tilt_z;
|
2007-07-26 13:48:50 +00:00
|
|
|
|
2007-07-26 13:48:44 +00:00
|
|
|
ClutterRotateDirection direction;
|
2007-04-30 08:39:11 +00:00
|
|
|
};
|
|
|
|
|
2007-07-27 08:18:41 +00:00
|
|
|
typedef struct _knot3d
|
|
|
|
{
|
|
|
|
gint x;
|
|
|
|
gint y;
|
|
|
|
gint z;
|
|
|
|
} knot3d;
|
|
|
|
|
2007-04-30 08:39:11 +00:00
|
|
|
static void
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_advance (ClutterBehaviourEllipse *e,
|
|
|
|
ClutterAngle angle,
|
2007-07-27 08:18:41 +00:00
|
|
|
knot3d *knot)
|
2007-04-30 08:39:11 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipsePrivate *priv = e->priv;
|
2007-07-27 08:18:41 +00:00
|
|
|
gint x, y, z;
|
|
|
|
|
2007-10-02 14:53:32 +00:00
|
|
|
x = CLUTTER_FIXED_TO_INT (priv->a * clutter_cosi (angle));
|
|
|
|
y = CLUTTER_FIXED_TO_INT (priv->b * clutter_sini (angle));
|
2007-07-27 08:18:41 +00:00
|
|
|
z = 0;
|
2007-04-30 08:39:11 +00:00
|
|
|
|
2007-07-29 08:54:24 +00:00
|
|
|
if (priv->angle_tilt_z)
|
2007-05-15 11:51:14 +00:00
|
|
|
{
|
2007-05-29 09:21:18 +00:00
|
|
|
/*
|
2007-07-27 08:18:41 +00:00
|
|
|
* x2 = r * cos (angle + tilt_z)
|
|
|
|
* y2 = r * sin (angle + tilt_z)
|
2007-05-29 09:21:18 +00:00
|
|
|
*
|
|
|
|
* These can be trasformed to the formulas below using properties of
|
|
|
|
* sin (a + b) and cos (a + b)
|
2007-05-15 11:51:14 +00:00
|
|
|
*
|
|
|
|
*/
|
2007-05-29 09:21:18 +00:00
|
|
|
ClutterFixed x2, y2;
|
2007-05-15 11:51:14 +00:00
|
|
|
|
2007-07-27 08:18:41 +00:00
|
|
|
x2 = x * clutter_cosi (priv->angle_tilt_z)
|
|
|
|
- y * clutter_sini (priv->angle_tilt_z);
|
2007-05-15 11:51:14 +00:00
|
|
|
|
2007-07-27 08:18:41 +00:00
|
|
|
y2 = y * clutter_cosi (priv->angle_tilt_z)
|
|
|
|
+ x * clutter_sini (priv->angle_tilt_z);
|
|
|
|
|
2007-10-02 14:53:32 +00:00
|
|
|
x = CLUTTER_FIXED_TO_INT (x2);
|
|
|
|
y = CLUTTER_FIXED_TO_INT (y2);
|
2007-05-29 09:21:18 +00:00
|
|
|
}
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-07-29 08:54:24 +00:00
|
|
|
if (priv->angle_tilt_x)
|
2007-07-27 08:18:41 +00:00
|
|
|
{
|
|
|
|
ClutterFixed z2, y2;
|
|
|
|
|
|
|
|
z2 = - y * clutter_sini (priv->angle_tilt_x);
|
|
|
|
|
|
|
|
y2 = y * clutter_cosi (priv->angle_tilt_x);
|
|
|
|
|
2007-10-02 14:53:32 +00:00
|
|
|
z = CLUTTER_FIXED_TO_INT (z2);
|
|
|
|
y = CLUTTER_FIXED_TO_INT (y2);
|
2007-07-27 08:18:41 +00:00
|
|
|
}
|
|
|
|
|
2007-07-29 08:54:24 +00:00
|
|
|
if (priv->angle_tilt_y)
|
2007-05-29 09:21:18 +00:00
|
|
|
{
|
2007-07-27 08:18:41 +00:00
|
|
|
ClutterFixed x2, z2;
|
|
|
|
|
2007-07-30 16:09:40 +00:00
|
|
|
x2 = x * clutter_cosi (priv->angle_tilt_y)
|
|
|
|
- z * clutter_sini (priv->angle_tilt_y);
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-07-30 16:09:40 +00:00
|
|
|
z2 = z * clutter_cosi (priv->angle_tilt_y)
|
|
|
|
+ x * clutter_sini (priv->angle_tilt_y);
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-10-02 14:53:32 +00:00
|
|
|
x = CLUTTER_FIXED_TO_INT (x2);
|
|
|
|
z = CLUTTER_FIXED_TO_INT (z2);
|
2007-05-15 11:51:14 +00:00
|
|
|
}
|
2007-07-27 08:18:41 +00:00
|
|
|
|
|
|
|
knot->x = x;
|
|
|
|
knot->y = y;
|
|
|
|
knot->z = z;
|
|
|
|
|
|
|
|
CLUTTER_NOTE (BEHAVIOUR, "advancing to angle %d [%d, %d] (a: %d, b: %d)",
|
2007-07-22 22:35:45 +00:00
|
|
|
angle,
|
|
|
|
knot->x, knot->y,
|
|
|
|
priv->a, priv->b);
|
2007-04-30 08:39:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
actor_apply_knot_foreach (ClutterBehaviour *behave,
|
|
|
|
ClutterActor *actor,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2007-07-27 08:18:41 +00:00
|
|
|
knot3d *knot = data;
|
2007-07-22 22:35:45 +00:00
|
|
|
|
2007-04-30 08:39:11 +00:00
|
|
|
clutter_actor_set_position (actor, knot->x, knot->y);
|
2007-07-27 08:18:41 +00:00
|
|
|
clutter_actor_set_depth (actor, knot->z);
|
2007-04-30 08:39:11 +00:00
|
|
|
}
|
|
|
|
|
2007-12-17 17:16:49 +00:00
|
|
|
static inline ClutterAngle
|
|
|
|
clamp_angle (ClutterAngle a)
|
|
|
|
{
|
|
|
|
ClutterAngle a1, a2;
|
|
|
|
gint rounds;
|
|
|
|
|
|
|
|
/* Need to add the 256 offset here, since the user space 0 maps to our
|
|
|
|
* -256
|
|
|
|
*/
|
|
|
|
rounds = (a+256) / 1024;
|
|
|
|
a1 = rounds * 1024;
|
|
|
|
a2 = a - a1;
|
|
|
|
|
|
|
|
return a2;
|
|
|
|
}
|
|
|
|
|
2007-04-30 08:39:11 +00:00
|
|
|
static void
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_alpha_notify (ClutterBehaviour *behave,
|
|
|
|
guint32 alpha)
|
2007-04-30 08:39:11 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipse *self = CLUTTER_BEHAVIOUR_ELLIPSE (behave);
|
|
|
|
ClutterBehaviourEllipsePrivate *priv = self->priv;
|
2007-12-17 17:16:49 +00:00
|
|
|
ClutterAngle start, end;
|
2007-07-27 08:18:41 +00:00
|
|
|
knot3d knot;
|
2007-08-03 15:40:11 +00:00
|
|
|
ClutterAngle angle = 0;
|
2007-04-30 08:39:11 +00:00
|
|
|
|
2007-12-17 17:16:49 +00:00
|
|
|
start = priv->angle_start;
|
|
|
|
end = priv->angle_end;
|
|
|
|
|
|
|
|
if (priv->direction == CLUTTER_ROTATE_CW && start >= end)
|
2007-04-30 08:39:11 +00:00
|
|
|
{
|
2007-12-17 17:16:49 +00:00
|
|
|
end += 1024;
|
2007-04-30 08:39:11 +00:00
|
|
|
}
|
2007-12-17 17:16:49 +00:00
|
|
|
else if (priv->direction == CLUTTER_ROTATE_CCW && start <= end)
|
2007-04-30 08:39:11 +00:00
|
|
|
{
|
2007-12-17 17:16:49 +00:00
|
|
|
end -= 1024;
|
2007-04-30 08:39:11 +00:00
|
|
|
}
|
2007-05-31 09:29:12 +00:00
|
|
|
|
2007-12-17 17:16:49 +00:00
|
|
|
angle = (end - start) * alpha / CLUTTER_ALPHA_MAX_ALPHA + start;
|
2007-11-27 12:34:28 +00:00
|
|
|
|
2007-04-30 08:39:11 +00:00
|
|
|
clutter_behaviour_ellipse_advance (self, angle, &knot);
|
|
|
|
|
2007-07-22 22:35:45 +00:00
|
|
|
knot.x += priv->center.x;
|
|
|
|
knot.y += priv->center.y;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_actors_foreach (behave, actor_apply_knot_foreach, &knot);
|
2007-04-30 08:39:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_behaviour_ellipse_set_property (GObject *gobject,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipse *el = CLUTTER_BEHAVIOUR_ELLIPSE (gobject);
|
|
|
|
ClutterBehaviourEllipsePrivate *priv = el->priv;
|
2007-04-30 08:39:11 +00:00
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2007-11-13 13:21:56 +00:00
|
|
|
case PROP_ANGLE_START:
|
|
|
|
priv->angle_start =
|
2007-07-26 13:48:44 +00:00
|
|
|
CLUTTER_ANGLE_FROM_DEG (g_value_get_double (value)) - 256;
|
2007-04-30 08:39:11 +00:00
|
|
|
break;
|
|
|
|
case PROP_ANGLE_END:
|
2007-07-26 13:48:44 +00:00
|
|
|
priv->angle_end =
|
|
|
|
CLUTTER_ANGLE_FROM_DEG (g_value_get_double (value)) - 256;
|
2007-04-30 08:39:11 +00:00
|
|
|
break;
|
2007-07-27 08:18:41 +00:00
|
|
|
case PROP_ANGLE_TILT_X:
|
|
|
|
priv->angle_tilt_x =
|
2007-12-07 07:48:57 +00:00
|
|
|
CLUTTER_ANGLE_FROM_DEG (g_value_get_double (value));
|
2007-07-27 08:18:41 +00:00
|
|
|
break;
|
|
|
|
case PROP_ANGLE_TILT_Y:
|
|
|
|
priv->angle_tilt_y =
|
2007-12-07 07:48:57 +00:00
|
|
|
CLUTTER_ANGLE_FROM_DEG (g_value_get_double (value));
|
2007-07-27 08:18:41 +00:00
|
|
|
break;
|
|
|
|
case PROP_ANGLE_TILT_Z:
|
|
|
|
priv->angle_tilt_z =
|
2007-12-07 07:48:57 +00:00
|
|
|
CLUTTER_ANGLE_FROM_DEG (g_value_get_double (value));
|
2007-05-15 11:51:14 +00:00
|
|
|
break;
|
2007-04-30 08:39:11 +00:00
|
|
|
case PROP_WIDTH:
|
2007-04-30 08:39:20 +00:00
|
|
|
priv->a = g_value_get_int (value) >> 1;
|
2007-04-30 08:39:11 +00:00
|
|
|
break;
|
|
|
|
case PROP_HEIGHT:
|
2007-04-30 08:39:20 +00:00
|
|
|
priv->b = g_value_get_int (value) >> 1;
|
2007-04-30 08:39:11 +00:00
|
|
|
break;
|
|
|
|
case PROP_CENTER:
|
2007-05-25 12:07:24 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterKnot *knot = g_value_get_boxed (value);
|
|
|
|
if (knot)
|
|
|
|
clutter_behaviour_ellipse_set_center (el, knot->x, knot->y);
|
2007-05-25 12:07:24 +00:00
|
|
|
}
|
2007-04-30 08:39:11 +00:00
|
|
|
break;
|
2007-07-26 13:48:44 +00:00
|
|
|
case PROP_DIRECTION:
|
|
|
|
priv->direction = g_value_get_enum (value);
|
|
|
|
break;
|
2007-04-30 08:39:11 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_behaviour_ellipse_get_property (GObject *gobject,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
|
|
|
|
priv = CLUTTER_BEHAVIOUR_ELLIPSE (gobject)->priv;
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2007-11-13 13:21:56 +00:00
|
|
|
case PROP_ANGLE_START:
|
2007-08-03 15:18:43 +00:00
|
|
|
g_value_set_double (value,
|
2007-11-13 13:21:56 +00:00
|
|
|
CLUTTER_ANGLE_TO_DEG (priv->angle_start + 256));
|
2007-04-30 08:39:11 +00:00
|
|
|
break;
|
|
|
|
case PROP_ANGLE_END:
|
2007-08-03 15:18:43 +00:00
|
|
|
g_value_set_double (value,
|
|
|
|
CLUTTER_ANGLE_TO_DEG (priv->angle_end + 256));
|
2007-04-30 08:39:11 +00:00
|
|
|
break;
|
2007-07-27 08:18:41 +00:00
|
|
|
case PROP_ANGLE_TILT_X:
|
2007-08-03 15:18:43 +00:00
|
|
|
g_value_set_double (value,
|
2007-12-07 07:48:57 +00:00
|
|
|
CLUTTER_ANGLE_TO_DEG (priv->angle_tilt_x));
|
2007-07-27 08:18:41 +00:00
|
|
|
break;
|
|
|
|
case PROP_ANGLE_TILT_Y:
|
2007-08-03 15:18:43 +00:00
|
|
|
g_value_set_double (value,
|
2007-12-07 07:48:57 +00:00
|
|
|
CLUTTER_ANGLE_TO_DEG (priv->angle_tilt_y));
|
2007-07-27 08:18:41 +00:00
|
|
|
break;
|
|
|
|
case PROP_ANGLE_TILT_Z:
|
2007-08-03 15:18:43 +00:00
|
|
|
g_value_set_double (value,
|
2007-12-07 07:48:57 +00:00
|
|
|
CLUTTER_ANGLE_TO_DEG (priv->angle_tilt_z));
|
2007-05-15 11:51:14 +00:00
|
|
|
break;
|
2007-04-30 08:39:11 +00:00
|
|
|
case PROP_WIDTH:
|
2007-07-22 22:35:45 +00:00
|
|
|
g_value_set_int (value, (priv->a << 1));
|
2007-04-30 08:39:11 +00:00
|
|
|
break;
|
|
|
|
case PROP_HEIGHT:
|
2007-07-22 22:35:45 +00:00
|
|
|
g_value_set_int (value, (priv->b << 1));
|
2007-04-30 08:39:11 +00:00
|
|
|
break;
|
|
|
|
case PROP_CENTER:
|
|
|
|
g_value_set_boxed (value, &priv->center);
|
|
|
|
break;
|
2007-07-26 13:48:44 +00:00
|
|
|
case PROP_DIRECTION:
|
|
|
|
g_value_set_enum (value, priv->direction);
|
|
|
|
break;
|
2007-04-30 08:39:11 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-11 07:16:21 +00:00
|
|
|
static void
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_applied (ClutterBehaviour *behave,
|
|
|
|
ClutterActor *actor)
|
2007-07-11 07:16:21 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipse *e = CLUTTER_BEHAVIOUR_ELLIPSE (behave);
|
2007-07-27 08:18:41 +00:00
|
|
|
knot3d knot;
|
|
|
|
|
2007-11-13 13:21:56 +00:00
|
|
|
clutter_behaviour_ellipse_advance (e, e->priv->angle_start, &knot);
|
2007-07-11 07:16:21 +00:00
|
|
|
|
|
|
|
clutter_actor_set_position (actor, knot.x, knot.y);
|
2007-07-27 08:18:41 +00:00
|
|
|
clutter_actor_set_depth (actor, knot.z);
|
2007-07-22 22:35:45 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* no need to chain up: ClutterBehaviourEllipse's parent class does
|
|
|
|
* not have a class closure for ::apply
|
|
|
|
*/
|
2007-07-11 07:16:21 +00:00
|
|
|
if (CLUTTER_BEHAVIOUR_CLASS (clutter_behaviour_ellipse_parent_class)->apply)
|
|
|
|
CLUTTER_BEHAVIOUR_CLASS (clutter_behaviour_ellipse_parent_class)->apply (behave, actor);
|
2007-07-22 22:35:45 +00:00
|
|
|
#endif
|
2007-07-11 07:16:21 +00:00
|
|
|
}
|
|
|
|
|
2007-04-30 08:39:11 +00:00
|
|
|
static void
|
|
|
|
clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass)
|
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
|
2007-04-30 08:39:11 +00:00
|
|
|
|
|
|
|
object_class->set_property = clutter_behaviour_ellipse_set_property;
|
|
|
|
object_class->get_property = clutter_behaviour_ellipse_get_property;
|
|
|
|
|
|
|
|
behave_class->alpha_notify = clutter_behaviour_ellipse_alpha_notify;
|
2007-07-22 22:35:45 +00:00
|
|
|
behave_class->applied = clutter_behaviour_ellipse_applied;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-04-30 08:39:11 +00:00
|
|
|
/**
|
2007-11-13 13:21:56 +00:00
|
|
|
* ClutterBehaviourEllipse:angle-start:
|
2007-04-30 08:39:11 +00:00
|
|
|
*
|
2007-11-13 13:21:56 +00:00
|
|
|
* The initial angle from where the rotation should start.
|
2007-04-30 08:39:11 +00:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
2007-11-13 13:21:56 +00:00
|
|
|
PROP_ANGLE_START,
|
|
|
|
g_param_spec_double ("angle-start",
|
|
|
|
"Start Angle",
|
2007-07-22 22:35:45 +00:00
|
|
|
"Initial angle",
|
2007-08-03 09:52:52 +00:00
|
|
|
0.0,
|
2007-12-17 17:16:49 +00:00
|
|
|
360.0,
|
2007-08-03 09:52:52 +00:00
|
|
|
0.0,
|
2007-07-22 22:35:45 +00:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2007-04-30 08:39:11 +00:00
|
|
|
/**
|
|
|
|
* ClutterBehaviourEllipse:angle-end:
|
|
|
|
*
|
|
|
|
* The final angle to where the rotation should end.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:11 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_ANGLE_END,
|
2007-07-22 22:35:45 +00:00
|
|
|
g_param_spec_double ("angle-end",
|
2007-11-13 13:21:56 +00:00
|
|
|
"End Angle",
|
2007-07-22 22:35:45 +00:00
|
|
|
"Final angle",
|
2007-08-03 09:52:52 +00:00
|
|
|
0.0,
|
|
|
|
360.0,
|
2007-12-17 17:16:49 +00:00
|
|
|
0.0,
|
2007-07-22 22:35:45 +00:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2007-05-15 11:51:14 +00:00
|
|
|
/**
|
2007-07-27 08:18:41 +00:00
|
|
|
* ClutterBehaviourEllipse:angle-tilt-x:
|
|
|
|
*
|
|
|
|
* The tilt angle for the rotation around center in x axis
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_ANGLE_TILT_X,
|
|
|
|
g_param_spec_double ("angle-tilt-x",
|
|
|
|
"Angle x tilt",
|
|
|
|
"Tilt of the ellipse around x axis",
|
|
|
|
0.0, 360.0, 360.0,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
|
|
|
/**
|
|
|
|
* ClutterBehaviourEllipse:angle-tilt-y:
|
|
|
|
*
|
|
|
|
* The tilt angle for the rotation around center in y axis
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_ANGLE_TILT_Y,
|
|
|
|
g_param_spec_double ("angle-tilt-y",
|
|
|
|
"Angle y tilt",
|
|
|
|
"Tilt of the ellipse around y axis",
|
|
|
|
0.0, 360.0, 360.0,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
|
|
|
/**
|
|
|
|
* ClutterBehaviourEllipse:angle-tilt-z:
|
|
|
|
*
|
|
|
|
* The tilt_z angle for the rotation
|
2007-05-15 11:51:14 +00:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
2007-07-27 08:18:41 +00:00
|
|
|
PROP_ANGLE_TILT_Z,
|
|
|
|
g_param_spec_double ("angle-tilt-z",
|
|
|
|
"Angle z tilt",
|
|
|
|
"Tilt of the ellipse around z axis",
|
2007-07-22 22:35:45 +00:00
|
|
|
0.0, 360.0, 360.0,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
2007-04-30 08:39:11 +00:00
|
|
|
/**
|
|
|
|
* ClutterBehaviourEllipse:width:
|
|
|
|
*
|
|
|
|
* Width of the ellipse.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:11 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_WIDTH,
|
|
|
|
g_param_spec_int ("width",
|
|
|
|
"Width",
|
|
|
|
"Width of ellipse",
|
|
|
|
0, G_MAXINT, 100,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
|
|
|
/**
|
|
|
|
* ClutterBehaviourEllipse:height:
|
|
|
|
*
|
|
|
|
* Height of the ellipse.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:11 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_HEIGHT,
|
|
|
|
g_param_spec_int ("height",
|
|
|
|
"Height",
|
|
|
|
"Height of ellipse",
|
|
|
|
0, G_MAXINT, 50,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
|
|
|
/**
|
|
|
|
* ClutterBehaviourEllipse:center:
|
|
|
|
*
|
|
|
|
* The center of the ellipse.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_CENTER,
|
|
|
|
g_param_spec_boxed ("center",
|
|
|
|
"Center",
|
|
|
|
"Center of ellipse",
|
|
|
|
CLUTTER_TYPE_KNOT,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-07-26 13:48:44 +00:00
|
|
|
/**
|
|
|
|
* ClutterBehaviourEllipse:direction:
|
|
|
|
*
|
|
|
|
* The direction of the rotation.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_DIRECTION,
|
|
|
|
g_param_spec_enum ("direction",
|
|
|
|
"Direction",
|
|
|
|
"Direction of rotation",
|
|
|
|
CLUTTER_TYPE_ROTATE_DIRECTION,
|
|
|
|
CLUTTER_ROTATE_CW,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
2007-04-30 08:39:11 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (ClutterBehaviourEllipsePrivate));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_behaviour_ellipse_init (ClutterBehaviourEllipse * self)
|
|
|
|
{
|
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
|
|
|
|
self->priv = priv = CLUTTER_BEHAVIOUR_ELLIPSE_GET_PRIVATE (self);
|
2007-07-26 13:48:44 +00:00
|
|
|
|
|
|
|
priv->direction = CLUTTER_ROTATE_CW;
|
2007-12-17 17:16:49 +00:00
|
|
|
|
|
|
|
/* The inital values have to reflect the 90 degree offset between the normal
|
|
|
|
* mathematical space and the clutter clock-based space; the default end
|
|
|
|
* value of 360 is clamped to 0.
|
|
|
|
*/
|
|
|
|
priv->angle_start = -256;
|
|
|
|
priv->angle_end = -256;
|
2007-04-30 08:39:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_new:
|
|
|
|
* @alpha: a #ClutterAlpha, or %NULL
|
2007-05-25 12:07:24 +00:00
|
|
|
* @x: x coordinace of the center
|
|
|
|
* @y: y coordiance of the center
|
2007-04-30 08:39:11 +00:00
|
|
|
* @width: width of the ellipse
|
2007-04-30 08:39:20 +00:00
|
|
|
* @height: height of the ellipse
|
2007-08-03 09:52:52 +00:00
|
|
|
* @direction: #ClutterRotateDirection of rotation
|
2007-12-17 17:16:49 +00:00
|
|
|
* @start: angle in degrees at which movement starts, between 0 and 360
|
|
|
|
* @end: angle in degrees at which movement ends, between 0 and 360
|
2007-04-30 08:39:11 +00:00
|
|
|
*
|
2007-04-30 08:39:20 +00:00
|
|
|
* Creates a behaviour that drives actors along an elliptical path with
|
2007-11-13 13:21:56 +00:00
|
|
|
* given center, width and height; the movement starts at @angle_start
|
2007-12-17 17:16:49 +00:00
|
|
|
* degrees (with 0 corresponding to 12 o'clock) and ends at @angle_end
|
|
|
|
* degrees. Angles >= 360 degrees get clamped to the canonical interval
|
|
|
|
* <0, 360), if start == end, the behaviour will rotate by exacly 360 degrees.
|
|
|
|
*
|
2007-07-29 08:54:24 +00:00
|
|
|
* Return value: the newly created #ClutterBehaviourEllipse
|
2007-04-30 08:39:11 +00:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
ClutterBehaviour *
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_new (ClutterAlpha *alpha,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
2007-08-03 09:52:52 +00:00
|
|
|
ClutterRotateDirection direction,
|
2007-11-13 13:21:56 +00:00
|
|
|
gdouble start,
|
2007-07-26 13:48:44 +00:00
|
|
|
gdouble end)
|
2007-04-30 08:39:11 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterKnot center;
|
2007-04-30 08:39:11 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
2007-05-25 12:07:24 +00:00
|
|
|
|
|
|
|
center.x = x;
|
|
|
|
center.y = y;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
|
|
|
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_ELLIPSE,
|
2007-07-22 22:35:45 +00:00
|
|
|
"alpha", alpha,
|
|
|
|
"center", ¢er,
|
|
|
|
"width", width,
|
|
|
|
"height", height,
|
2007-08-03 09:52:52 +00:00
|
|
|
"direction", direction,
|
2007-11-13 13:21:56 +00:00
|
|
|
"angle-start", start,
|
2007-07-22 22:35:45 +00:00
|
|
|
"angle-end", end,
|
|
|
|
NULL);
|
2007-04-30 08:39:11 +00:00
|
|
|
}
|
|
|
|
|
2007-05-25 12:07:24 +00:00
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_newx:
|
|
|
|
* @alpha: a #ClutterAlpha, or %NULL
|
|
|
|
* @x: x coordinace of the center
|
|
|
|
* @y: y coordiance of the center
|
|
|
|
* @width: width of the ellipse
|
|
|
|
* @height: height of the ellipse
|
2007-08-03 09:52:52 +00:00
|
|
|
* @direction: #ClutterRotateDirection of rotation
|
2007-11-13 13:21:56 +00:00
|
|
|
* @start: #ClutterFixed angle in degrees at which movement starts
|
2007-05-25 12:07:24 +00:00
|
|
|
* @end: #ClutterFixed angle in degrees at which movement ends
|
|
|
|
*
|
2007-07-29 08:54:24 +00:00
|
|
|
* Creates a behaviour that drives actors along an elliptical path. This
|
|
|
|
* is the fixed point variant of clutter_behaviour_ellipse_new().
|
2007-05-25 12:07:24 +00:00
|
|
|
*
|
2007-07-29 08:54:24 +00:00
|
|
|
* Return value: the newly created #ClutterBehaviourEllipse
|
2007-05-25 12:07:24 +00:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
ClutterBehaviour *
|
|
|
|
clutter_behaviour_ellipse_newx (ClutterAlpha * alpha,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
2007-08-03 09:52:52 +00:00
|
|
|
ClutterRotateDirection direction,
|
2007-11-13 13:21:56 +00:00
|
|
|
ClutterFixed start,
|
2007-07-26 13:48:44 +00:00
|
|
|
ClutterFixed end)
|
2007-05-25 12:07:24 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterKnot center;
|
2007-05-25 12:07:24 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
|
|
|
|
|
|
|
center.x = x;
|
|
|
|
center.y = y;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
|
|
|
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_ELLIPSE,
|
2007-07-22 22:35:45 +00:00
|
|
|
"alpha", alpha,
|
|
|
|
"center", ¢er,
|
|
|
|
"width", width,
|
|
|
|
"height", height,
|
2007-08-03 09:52:52 +00:00
|
|
|
"direction", direction,
|
2007-11-13 13:21:56 +00:00
|
|
|
"angle-start", CLUTTER_ANGLE_FROM_DEGX (start),
|
2007-07-22 22:35:45 +00:00
|
|
|
"angle-end", CLUTTER_ANGLE_FROM_DEGX (end),
|
|
|
|
NULL);
|
2007-05-25 12:07:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-30 08:39:11 +00:00
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_set_center
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-05-25 12:07:24 +00:00
|
|
|
* @x: x coordinace of centre
|
|
|
|
* @y: y coordinace of centre
|
2007-04-30 08:39:11 +00:00
|
|
|
*
|
2007-04-30 08:39:20 +00:00
|
|
|
* Sets the center of the elliptical path to the point represented by knot.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:11 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_set_center (ClutterBehaviourEllipse *self,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
2007-04-30 08:39:11 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (priv->center.x != x || priv->center.y != y)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
priv->center.x = x;
|
|
|
|
priv->center.y = y;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-04-30 08:39:20 +00:00
|
|
|
g_object_notify (G_OBJECT (self), "center");
|
|
|
|
}
|
2007-04-30 08:39:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_get_center
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-05-25 12:07:24 +00:00
|
|
|
* @x: location to store the x coordinace of the center, or NULL
|
|
|
|
* @y: location to store the y coordinace of the center, or NULL
|
2007-04-30 08:39:11 +00:00
|
|
|
*
|
2007-04-30 08:39:20 +00:00
|
|
|
* Gets the center of the elliptical path path.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:11 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_get_center (ClutterBehaviourEllipse *self,
|
|
|
|
gint *x,
|
|
|
|
gint *y)
|
2007-04-30 08:39:11 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
2007-05-25 12:07:24 +00:00
|
|
|
if (x)
|
2007-07-22 22:35:45 +00:00
|
|
|
*x = priv->center.x;
|
2007-05-25 12:07:24 +00:00
|
|
|
|
|
|
|
if (y)
|
2007-07-22 22:35:45 +00:00
|
|
|
*y = priv->center.y;
|
2007-04-30 08:39:11 +00:00
|
|
|
}
|
|
|
|
|
2007-04-30 08:39:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_set_width
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
|
|
|
* @width: width of the ellipse
|
|
|
|
*
|
|
|
|
* Sets the width of the elliptical path.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:20 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_behaviour_ellipse_set_width (ClutterBehaviourEllipse * self,
|
|
|
|
gint width)
|
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (priv->a != width >> 1)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
priv->a = width >> 1;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-04-30 08:39:20 +00:00
|
|
|
g_object_notify (G_OBJECT (self), "width");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_get_width
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
|
|
|
*
|
|
|
|
* Gets the width of the elliptical path.
|
2007-05-17 12:03:43 +00:00
|
|
|
*
|
2007-06-01 10:00:35 +00:00
|
|
|
* Return value: the width of the path
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:20 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
gint
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_get_width (ClutterBehaviourEllipse *self)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
|
|
|
|
|
2007-04-30 08:39:20 +00:00
|
|
|
return self->priv->a << 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_set_height
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
|
|
|
* @height: height of the ellipse
|
|
|
|
*
|
|
|
|
* Sets the height of the elliptical path.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:20 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_set_height (ClutterBehaviourEllipse *self,
|
|
|
|
gint height)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (priv->b != height >> 1)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
priv->b = height >> 1;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-04-30 08:39:20 +00:00
|
|
|
g_object_notify (G_OBJECT (self), "height");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_get_height
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
|
|
|
*
|
|
|
|
* Gets the height of the elliptical path.
|
2007-05-17 12:03:43 +00:00
|
|
|
*
|
|
|
|
* Return value: the height of the path
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:20 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
gint
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_get_height (ClutterBehaviourEllipse *self)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
|
|
|
|
|
2007-04-30 08:39:20 +00:00
|
|
|
return self->priv->b << 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-11-13 13:21:56 +00:00
|
|
|
* clutter_behaviour_ellipse_set_angle_start
|
2007-04-30 08:39:20 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-12-17 17:16:49 +00:00
|
|
|
* @angle_start: angle at which movement starts in degrees, between 0 and 360.
|
2007-04-30 08:39:20 +00:00
|
|
|
*
|
2007-12-17 17:16:49 +00:00
|
|
|
* Sets the angle at which movement starts; angles >= 360 degress get clamped
|
|
|
|
* to the canonical interval <0, 360).
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-11-13 13:21:56 +00:00
|
|
|
* Since: 0.6
|
2007-04-30 08:39:20 +00:00
|
|
|
*/
|
|
|
|
void
|
2007-11-13 13:21:56 +00:00
|
|
|
clutter_behaviour_ellipse_set_angle_start (ClutterBehaviourEllipse *self,
|
|
|
|
gdouble angle_start)
|
2007-07-11 07:16:21 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
2007-11-13 13:21:56 +00:00
|
|
|
clutter_behaviour_ellipse_set_angle_startx (self,
|
2007-12-07 11:00:01 +00:00
|
|
|
CLUTTER_FLOAT_TO_FIXED (angle_start));
|
2007-07-11 07:16:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-11-13 13:21:56 +00:00
|
|
|
* clutter_behaviour_ellipse_set_angle_startx
|
2007-07-11 07:16:21 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-12-17 17:16:49 +00:00
|
|
|
* @angle_start: An angle, as #ClutterFixed, at which movement starts, in
|
|
|
|
* degrees, between 0 and 360.
|
2007-07-11 07:16:21 +00:00
|
|
|
*
|
2007-12-17 17:16:49 +00:00
|
|
|
* Sets the angle at which movement starts; angles >= 360 degress get clamped
|
|
|
|
* to the canonical interval <0, 360).
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-11-13 13:21:56 +00:00
|
|
|
* Since: 0.6
|
2007-07-11 07:16:21 +00:00
|
|
|
*/
|
|
|
|
void
|
2007-11-13 13:21:56 +00:00
|
|
|
clutter_behaviour_ellipse_set_angle_startx (ClutterBehaviourEllipse *self,
|
2007-11-27 12:34:28 +00:00
|
|
|
ClutterFixed angle_start)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
2007-07-26 13:48:50 +00:00
|
|
|
ClutterAngle new_angle;
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
2007-12-17 17:16:49 +00:00
|
|
|
new_angle = clamp_angle (CLUTTER_ANGLE_FROM_DEGX (angle_start) - 256);
|
2007-07-26 13:48:58 +00:00
|
|
|
|
2007-07-22 22:35:45 +00:00
|
|
|
priv = self->priv;
|
2007-11-13 13:21:56 +00:00
|
|
|
if (priv->angle_start != new_angle)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-11-13 13:21:56 +00:00
|
|
|
priv->angle_start = new_angle;
|
|
|
|
g_object_notify (G_OBJECT (self), "angle-start");
|
2007-04-30 08:39:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-11-13 13:21:56 +00:00
|
|
|
* clutter_behaviour_ellipse_get_angle_start
|
2007-04-30 08:39:20 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
|
|
|
*
|
2007-11-13 13:21:56 +00:00
|
|
|
* Gets the angle at which movements starts.
|
2007-05-17 12:03:43 +00:00
|
|
|
*
|
2007-07-11 07:16:21 +00:00
|
|
|
* Return value: angle in degrees
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-11-13 13:21:56 +00:00
|
|
|
* Since: 0.6
|
2007-07-11 07:16:21 +00:00
|
|
|
*/
|
|
|
|
gdouble
|
2007-11-13 13:21:56 +00:00
|
|
|
clutter_behaviour_ellipse_get_angle_start (ClutterBehaviourEllipse *self)
|
2007-07-11 07:16:21 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0.0);
|
|
|
|
|
2007-11-13 13:21:56 +00:00
|
|
|
return CLUTTER_ANGLE_TO_DEG (self->priv->angle_start + 256);
|
2007-07-11 07:16:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-11-13 13:21:56 +00:00
|
|
|
* clutter_behaviour_ellipse_get_angle_startx
|
2007-07-11 07:16:21 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
|
|
|
*
|
2007-11-13 13:21:56 +00:00
|
|
|
* Gets the angle at which movements starts.
|
2007-07-11 07:16:21 +00:00
|
|
|
*
|
2007-11-27 12:34:28 +00:00
|
|
|
* Return value: angle, as #ClutterFixed, in degrees.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-11-13 13:21:56 +00:00
|
|
|
* Since: 0.6
|
2007-04-30 08:39:20 +00:00
|
|
|
*/
|
2007-11-27 12:34:28 +00:00
|
|
|
ClutterFixed
|
2007-11-13 13:21:56 +00:00
|
|
|
clutter_behaviour_ellipse_get_angle_startx (ClutterBehaviourEllipse *self)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
|
|
|
|
|
2007-11-27 12:34:28 +00:00
|
|
|
return CLUTTER_ANGLE_TO_DEGX (self->priv->angle_start);
|
2007-04-30 08:39:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_set_angle_end
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-12-17 17:16:49 +00:00
|
|
|
* @angle_end: angle at which movement ends in degrees, between 0 and 360.
|
2007-04-30 08:39:20 +00:00
|
|
|
*
|
2007-12-17 17:16:49 +00:00
|
|
|
* Sets the angle at which movement ends; angles >= 360 degress get clamped
|
|
|
|
* to the canonical interval <0, 360).
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:20 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_set_angle_end (ClutterBehaviourEllipse *self,
|
|
|
|
gdouble angle_end)
|
2007-07-11 07:16:21 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
2007-07-11 07:16:21 +00:00
|
|
|
clutter_behaviour_ellipse_set_angle_endx (self,
|
2007-12-07 11:00:01 +00:00
|
|
|
CLUTTER_FLOAT_TO_FIXED (angle_end));
|
2007-07-11 07:16:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_set_angle_endx
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-12-17 17:16:49 +00:00
|
|
|
* @angle_end: angle, as #ClutterFixed, at which movement ends, in degrees,
|
|
|
|
* between 0 and 360.
|
2007-07-11 07:16:21 +00:00
|
|
|
*
|
2007-12-17 17:16:49 +00:00
|
|
|
* Sets the angle at which movement ends; angles >= 360 degress get clamped
|
|
|
|
* to the canonical interval <0, 360).
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-07-11 07:16:21 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_set_angle_endx (ClutterBehaviourEllipse *self,
|
2007-11-27 12:34:28 +00:00
|
|
|
ClutterFixed angle_end)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
2007-07-26 13:48:50 +00:00
|
|
|
ClutterAngle new_angle;
|
2007-07-22 22:35:45 +00:00
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
2007-12-17 17:16:49 +00:00
|
|
|
new_angle = clamp_angle (CLUTTER_ANGLE_FROM_DEGX (angle_end) - 256);
|
2007-07-26 13:48:58 +00:00
|
|
|
|
2007-07-22 22:35:45 +00:00
|
|
|
priv = self->priv;
|
|
|
|
|
2007-07-26 13:48:50 +00:00
|
|
|
if (priv->angle_end != new_angle)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-26 13:48:50 +00:00
|
|
|
priv->angle_end = new_angle;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-04-30 08:39:20 +00:00
|
|
|
g_object_notify (G_OBJECT (self), "angle-end");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_get_angle_end
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
|
|
|
*
|
|
|
|
* Gets the at which movements ends.
|
2007-05-17 12:03:43 +00:00
|
|
|
*
|
2007-07-11 07:16:21 +00:00
|
|
|
* Return value: angle in degrees
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-07-11 07:16:21 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
gdouble
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_get_angle_end (ClutterBehaviourEllipse *self)
|
2007-07-11 07:16:21 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0.0);
|
|
|
|
|
2007-08-03 15:40:11 +00:00
|
|
|
return CLUTTER_ANGLE_TO_DEG (self->priv->angle_end + 256);
|
2007-07-11 07:16:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_get_angle_endx
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
|
|
|
*
|
|
|
|
* Gets the angle at which movements ends.
|
|
|
|
*
|
2007-11-27 12:34:28 +00:00
|
|
|
* Return value: angle, as #ClutterFixed, in degrees
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-04-30 08:39:20 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
2007-11-27 12:34:28 +00:00
|
|
|
ClutterFixed
|
2007-07-22 22:35:45 +00:00
|
|
|
clutter_behaviour_ellipse_get_angle_endx (ClutterBehaviourEllipse *self)
|
2007-04-30 08:39:20 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
|
|
|
|
|
2007-11-27 12:34:28 +00:00
|
|
|
return CLUTTER_ANGLE_TO_DEGX (self->priv->angle_end);
|
2007-04-30 08:39:20 +00:00
|
|
|
}
|
|
|
|
|
2007-05-15 11:51:14 +00:00
|
|
|
/**
|
2007-07-27 13:44:42 +00:00
|
|
|
* clutter_behaviour_ellipse_set_angle_tilt
|
2007-07-27 08:18:41 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-07-27 13:44:42 +00:00
|
|
|
* @axis: a #ClutterRotateAxis
|
|
|
|
* @angle_tilt: tilt of the elipse around the center in the given axis in
|
|
|
|
* degrees.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
|
|
|
* Sets the angle at which the ellipse should be tilted around it's center.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
2007-07-27 13:44:42 +00:00
|
|
|
clutter_behaviour_ellipse_set_angle_tilt (ClutterBehaviourEllipse *self,
|
|
|
|
ClutterRotateAxis axis,
|
|
|
|
gdouble angle_tilt)
|
2007-07-27 08:18:41 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
2007-07-27 13:44:42 +00:00
|
|
|
clutter_behaviour_ellipse_set_angle_tiltx (self,
|
2007-12-07 11:00:01 +00:00
|
|
|
axis,
|
|
|
|
CLUTTER_FLOAT_TO_FIXED (angle_tilt));
|
2007-07-27 08:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-07-27 13:44:42 +00:00
|
|
|
* clutter_behaviour_ellipse_set_angle_tiltx
|
2007-07-27 08:18:41 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-07-27 13:44:42 +00:00
|
|
|
* @axis: a #ClutterRoateAxis
|
2007-11-27 12:34:28 +00:00
|
|
|
* @angle_tilt: tilt, as #ClutterFixed, of the elipse around the center in the given
|
|
|
|
* axis in degrees.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
|
|
|
* Sets the angle at which the ellipse should be tilted around it's center.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
2007-07-27 13:44:42 +00:00
|
|
|
clutter_behaviour_ellipse_set_angle_tiltx (ClutterBehaviourEllipse *self,
|
|
|
|
ClutterRotateAxis axis,
|
2007-11-27 12:34:28 +00:00
|
|
|
ClutterFixed angle_tilt)
|
2007-07-27 08:18:41 +00:00
|
|
|
{
|
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
ClutterAngle new_angle;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
2007-12-07 07:48:57 +00:00
|
|
|
new_angle = CLUTTER_ANGLE_FROM_DEGX (angle_tilt);
|
|
|
|
|
2007-07-27 08:18:41 +00:00
|
|
|
priv = self->priv;
|
|
|
|
|
2007-07-27 13:44:42 +00:00
|
|
|
switch (axis)
|
2007-07-27 08:18:41 +00:00
|
|
|
{
|
2007-07-27 13:44:42 +00:00
|
|
|
case CLUTTER_X_AXIS:
|
|
|
|
if (priv->angle_tilt_x != new_angle)
|
|
|
|
{
|
|
|
|
priv->angle_tilt_x = new_angle;
|
2007-07-11 07:16:21 +00:00
|
|
|
|
2007-07-27 13:44:42 +00:00
|
|
|
g_object_notify (G_OBJECT (self), "angle-tilt-x");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CLUTTER_Y_AXIS:
|
|
|
|
if (priv->angle_tilt_y != new_angle)
|
|
|
|
{
|
|
|
|
priv->angle_tilt_y = new_angle;
|
2007-07-22 22:35:45 +00:00
|
|
|
|
2007-07-27 13:44:42 +00:00
|
|
|
g_object_notify (G_OBJECT (self), "angle-tilt-y");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CLUTTER_Z_AXIS:
|
|
|
|
if (priv->angle_tilt_z != new_angle)
|
|
|
|
{
|
|
|
|
priv->angle_tilt_z = new_angle;
|
2007-07-27 08:18:41 +00:00
|
|
|
|
2007-07-27 13:44:42 +00:00
|
|
|
g_object_notify (G_OBJECT (self), "angle-tilt-z");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2007-05-15 11:51:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-07-27 13:44:42 +00:00
|
|
|
* clutter_behaviour_ellipse_get_angle_tilt
|
2007-05-15 11:51:14 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-07-27 13:44:42 +00:00
|
|
|
* @axis: a #ClutterRotateAxis
|
2007-05-15 11:51:14 +00:00
|
|
|
*
|
2007-07-27 13:44:42 +00:00
|
|
|
* Gets the tilt of the ellipse around the center in the given axis.
|
2007-05-17 12:03:43 +00:00
|
|
|
*
|
2007-07-11 07:16:21 +00:00
|
|
|
* Return value: angle in degrees.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-07-11 07:16:21 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
gdouble
|
2007-07-27 13:44:42 +00:00
|
|
|
clutter_behaviour_ellipse_get_angle_tilt (ClutterBehaviourEllipse *self,
|
|
|
|
ClutterRotateAxis axis)
|
2007-07-11 07:16:21 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0.0);
|
|
|
|
|
2007-12-10 12:00:08 +00:00
|
|
|
switch (axis)
|
|
|
|
{
|
|
|
|
case CLUTTER_X_AXIS:
|
|
|
|
return CLUTTER_ANGLE_TO_DEG (self->priv->angle_tilt_x);
|
|
|
|
case CLUTTER_Y_AXIS:
|
|
|
|
return CLUTTER_ANGLE_TO_DEG (self->priv->angle_tilt_y);
|
|
|
|
case CLUTTER_Z_AXIS:
|
|
|
|
return CLUTTER_ANGLE_TO_DEG (self->priv->angle_tilt_z);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2007-07-11 07:16:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-07-27 13:44:42 +00:00
|
|
|
* clutter_behaviour_ellipse_get_angle_tiltx
|
2007-07-11 07:16:21 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-07-28 17:11:39 +00:00
|
|
|
* @axis: a #ClutterRotateAxis
|
2007-07-11 07:16:21 +00:00
|
|
|
*
|
2007-07-27 13:44:42 +00:00
|
|
|
* Gets the tilt of the ellipse around the center in the given axis.
|
2007-07-11 07:16:21 +00:00
|
|
|
*
|
2007-11-27 12:34:28 +00:00
|
|
|
* Return value: angle, as #ClutterFixed, in degrees
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
2007-05-15 11:51:14 +00:00
|
|
|
* Since: 0.4
|
|
|
|
*/
|
2007-11-27 12:34:28 +00:00
|
|
|
ClutterFixed
|
2007-07-27 13:44:42 +00:00
|
|
|
clutter_behaviour_ellipse_get_angle_tiltx (ClutterBehaviourEllipse *self,
|
|
|
|
ClutterRotateAxis axis)
|
2007-05-15 11:51:14 +00:00
|
|
|
{
|
2007-07-22 22:35:45 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
|
|
|
|
|
2007-07-27 13:44:42 +00:00
|
|
|
switch (axis)
|
2007-07-27 08:18:41 +00:00
|
|
|
{
|
2007-07-27 13:44:42 +00:00
|
|
|
case CLUTTER_X_AXIS:
|
2007-12-07 07:48:57 +00:00
|
|
|
return CLUTTER_ANGLE_TO_DEGX (self->priv->angle_tilt_x);
|
2007-07-27 13:44:42 +00:00
|
|
|
case CLUTTER_Y_AXIS:
|
2007-12-07 07:48:57 +00:00
|
|
|
return CLUTTER_ANGLE_TO_DEGX (self->priv->angle_tilt_y);
|
2007-07-27 13:44:42 +00:00
|
|
|
case CLUTTER_Z_AXIS:
|
2007-12-07 07:48:57 +00:00
|
|
|
return CLUTTER_ANGLE_TO_DEGX (self->priv->angle_tilt_z);
|
2007-07-27 08:18:41 +00:00
|
|
|
}
|
|
|
|
|
2007-07-27 13:44:42 +00:00
|
|
|
return 0;
|
2007-07-27 08:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_set_tilt
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
|
|
|
* @angle_tilt_x: tilt of the elipse around the center in X axis in degrees.
|
|
|
|
* @angle_tilt_y: tilt of the elipse around the center in Y axis in degrees.
|
|
|
|
* @angle_tilt_z: tilt of the elipse around the center in Z axis in degrees.
|
|
|
|
*
|
|
|
|
* Sets the angles at which the ellipse should be tilted around it's center.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_behaviour_ellipse_set_tilt (ClutterBehaviourEllipse *self,
|
|
|
|
gdouble angle_tilt_x,
|
|
|
|
gdouble angle_tilt_y,
|
|
|
|
gdouble angle_tilt_z)
|
|
|
|
{
|
2007-12-10 12:00:08 +00:00
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
ClutterAngle new_angle_x, new_angle_y, new_angle_z;
|
|
|
|
|
2007-07-27 08:18:41 +00:00
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
2007-12-10 12:00:08 +00:00
|
|
|
new_angle_x = CLUTTER_ANGLE_FROM_DEG (angle_tilt_x);
|
|
|
|
new_angle_y = CLUTTER_ANGLE_FROM_DEG (angle_tilt_y);
|
|
|
|
new_angle_z = CLUTTER_ANGLE_FROM_DEG (angle_tilt_z);
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
g_object_freeze_notify (G_OBJECT (self));
|
|
|
|
|
|
|
|
if (priv->angle_tilt_x != new_angle_x)
|
|
|
|
{
|
|
|
|
priv->angle_tilt_x = new_angle_x;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "angle-tilt-x");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->angle_tilt_y != new_angle_y)
|
|
|
|
{
|
|
|
|
priv->angle_tilt_y = new_angle_y;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "angle-tilt-y");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->angle_tilt_z != new_angle_z)
|
|
|
|
{
|
|
|
|
priv->angle_tilt_z = new_angle_z;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "angle-tilt-z");
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (self));
|
2007-07-27 08:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_set_tiltx
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-11-27 12:34:28 +00:00
|
|
|
* @angle_tilt_x: tilt of the elipse in degrees, as #ClutterFixed, around the center in X axis
|
|
|
|
* @angle_tilt_y: tilt of the elipse in degrees, as #ClutterFixed, around the center in Y axis
|
|
|
|
* @angle_tilt_z: tilt of the elipse in degrees, as #ClutterFixed, around the center in Z axis
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
|
|
|
* Sets the angle at which the ellipse should be tilted around it's center.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_behaviour_ellipse_set_tiltx (ClutterBehaviourEllipse *self,
|
2007-11-27 12:34:28 +00:00
|
|
|
ClutterFixed angle_tilt_x,
|
|
|
|
ClutterFixed angle_tilt_y,
|
|
|
|
ClutterFixed angle_tilt_z)
|
2007-07-27 08:18:41 +00:00
|
|
|
{
|
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
ClutterAngle new_angle_x, new_angle_y, new_angle_z;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
2007-12-07 07:48:57 +00:00
|
|
|
new_angle_x = CLUTTER_ANGLE_FROM_DEGX (angle_tilt_x);
|
|
|
|
new_angle_y = CLUTTER_ANGLE_FROM_DEGX (angle_tilt_y);
|
|
|
|
new_angle_z = CLUTTER_ANGLE_FROM_DEGX (angle_tilt_z);
|
2007-07-27 08:18:41 +00:00
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
2007-07-29 08:54:24 +00:00
|
|
|
g_object_freeze_notify (G_OBJECT (self));
|
|
|
|
|
2007-07-27 08:18:41 +00:00
|
|
|
if (priv->angle_tilt_x != new_angle_x)
|
|
|
|
{
|
|
|
|
priv->angle_tilt_x = new_angle_x;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "angle-tilt-x");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->angle_tilt_y != new_angle_y)
|
|
|
|
{
|
|
|
|
priv->angle_tilt_y = new_angle_y;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "angle-tilt-y");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->angle_tilt_z != new_angle_z)
|
|
|
|
{
|
|
|
|
priv->angle_tilt_z = new_angle_z;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "angle-tilt-z");
|
|
|
|
}
|
2007-11-27 12:34:28 +00:00
|
|
|
|
2007-07-29 08:54:24 +00:00
|
|
|
g_object_thaw_notify (G_OBJECT (self));
|
2007-07-27 08:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_get_tilt
|
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-12-09 08:47:11 +00:00
|
|
|
* @angle_tilt_x: return location for tilt angle on the X axis, or %NULL.
|
|
|
|
* @angle_tilt_y: return location for tilt angle on the Y axis, or %NULL.
|
|
|
|
* @angle_tilt_z: return location for tilt angle on the Z axis, or %NULL.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
|
|
|
* Gets the tilt of the ellipse around the center in Y axis.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_behaviour_ellipse_get_tilt (ClutterBehaviourEllipse *self,
|
|
|
|
gdouble *angle_tilt_x,
|
|
|
|
gdouble *angle_tilt_y,
|
|
|
|
gdouble *angle_tilt_z)
|
|
|
|
{
|
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (angle_tilt_x)
|
2007-12-07 07:48:57 +00:00
|
|
|
*angle_tilt_x = CLUTTER_ANGLE_TO_DEG (priv->angle_tilt_x);
|
2007-07-27 08:18:41 +00:00
|
|
|
|
|
|
|
if (angle_tilt_y)
|
2007-12-07 07:48:57 +00:00
|
|
|
*angle_tilt_y = CLUTTER_ANGLE_TO_DEG (priv->angle_tilt_y);
|
2007-07-27 08:18:41 +00:00
|
|
|
|
|
|
|
if (angle_tilt_z)
|
2007-12-07 07:48:57 +00:00
|
|
|
*angle_tilt_z = CLUTTER_ANGLE_TO_DEG (priv->angle_tilt_z);
|
2007-07-27 08:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-08-07 14:03:58 +00:00
|
|
|
* clutter_behaviour_ellipse_get_tiltx
|
2007-07-27 08:18:41 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-11-27 12:34:28 +00:00
|
|
|
* @angle_tilt_x: location for tilt of the elipse, as #ClutterFixed, around the
|
|
|
|
* center in X axis in degrees, or NULL.
|
|
|
|
* @angle_tilt_y: location for tilt of the elipse, as #ClutterFixed, around the
|
|
|
|
* center in Y axis in degress, or NULL.
|
|
|
|
* @angle_tilt_z: location for tilt of the elipse, as #ClutterFixed, around the
|
|
|
|
* center in Z axis in degrees, or NULL.
|
2007-07-27 08:18:41 +00:00
|
|
|
*
|
|
|
|
* Gets the tilt of the ellipse around the center in Y axis.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_behaviour_ellipse_get_tiltx (ClutterBehaviourEllipse *self,
|
2007-11-27 12:34:28 +00:00
|
|
|
ClutterFixed *angle_tilt_x,
|
|
|
|
ClutterFixed *angle_tilt_y,
|
|
|
|
ClutterFixed *angle_tilt_z)
|
2007-07-27 08:18:41 +00:00
|
|
|
{
|
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (angle_tilt_x)
|
2007-12-07 07:48:57 +00:00
|
|
|
*angle_tilt_x = CLUTTER_ANGLE_TO_DEGX (priv->angle_tilt_x);
|
2007-07-27 08:18:41 +00:00
|
|
|
|
|
|
|
if (angle_tilt_y)
|
2007-12-07 07:48:57 +00:00
|
|
|
*angle_tilt_y = CLUTTER_ANGLE_TO_DEGX (priv->angle_tilt_y);
|
2007-07-27 08:18:41 +00:00
|
|
|
|
|
|
|
if (angle_tilt_z)
|
2007-12-07 07:48:57 +00:00
|
|
|
*angle_tilt_z = CLUTTER_ANGLE_TO_DEGX (priv->angle_tilt_z);
|
2007-07-27 08:18:41 +00:00
|
|
|
}
|
2007-07-26 13:48:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_get_direction:
|
2007-07-26 15:14:45 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-07-26 13:48:44 +00:00
|
|
|
*
|
|
|
|
* Retrieves the #ClutterRotateDirection used by the ellipse behaviour.
|
|
|
|
*
|
|
|
|
* Return value: the rotation direction
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
ClutterRotateDirection
|
|
|
|
clutter_behaviour_ellipse_get_direction (ClutterBehaviourEllipse *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self),
|
|
|
|
CLUTTER_ROTATE_CW);
|
|
|
|
|
|
|
|
return self->priv->direction;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_behaviour_ellipse_set_direction:
|
2007-07-26 15:14:45 +00:00
|
|
|
* @self: a #ClutterBehaviourEllipse
|
2007-07-26 13:48:44 +00:00
|
|
|
* @direction: the rotation direction
|
|
|
|
*
|
|
|
|
* Sets the rotation direction used by the ellipse behaviour.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_behaviour_ellipse_set_direction (ClutterBehaviourEllipse *self,
|
2007-07-26 15:14:45 +00:00
|
|
|
ClutterRotateDirection direction)
|
2007-07-26 13:48:44 +00:00
|
|
|
{
|
|
|
|
ClutterBehaviourEllipsePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (priv->direction != direction)
|
|
|
|
{
|
|
|
|
priv->direction = direction;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "direction");
|
|
|
|
}
|
|
|
|
}
|