2008-02-07 Tomas Frydrych <tf@openedhand.com>

* clutter/clutter-actor.c:
	(clutter_actor_set_property):
	Fixed handling of PROP_ROTATE_CENTER_Y, ROTATE_CENTER_Z

	* tests/test-actors.c:
	Adjusted to use anchor point for both group and hands.
This commit is contained in:
Tomas Frydrych 2008-02-07 15:06:31 +00:00
parent 384c7048e3
commit 1f5e879e2f
3 changed files with 38 additions and 21 deletions

View File

@ -1,3 +1,12 @@
2008-02-07 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-actor.c:
(clutter_actor_set_property):
Fixed handling of PROP_ROTATE_CENTER_Y, ROTATE_CENTER_Z
* tests/test-actors.c:
Adjusted to use anchor point for both group and hands.
2008-02-07 Neil J. Patel <njp@o-hand.com> 2008-02-07 Neil J. Patel <njp@o-hand.com>
* tests/test-actors.c: (frame_cb), (main): * tests/test-actors.c: (frame_cb), (main):

View File

@ -1213,7 +1213,7 @@ clutter_actor_set_property (GObject *object,
center = g_value_get_boxed (value); center = g_value_get_boxed (value);
clutter_actor_set_rotationx (actor, clutter_actor_set_rotationx (actor,
CLUTTER_X_AXIS, CLUTTER_Y_AXIS,
priv->ryang, priv->ryang,
CLUTTER_UNITS_TO_DEVICE (center->x), CLUTTER_UNITS_TO_DEVICE (center->x),
0, 0,
@ -1226,7 +1226,7 @@ clutter_actor_set_property (GObject *object,
center = g_value_get_boxed (value); center = g_value_get_boxed (value);
clutter_actor_set_rotationx (actor, clutter_actor_set_rotationx (actor,
CLUTTER_X_AXIS, CLUTTER_Z_AXIS,
priv->rzang, priv->rzang,
CLUTTER_UNITS_TO_DEVICE (center->x), CLUTTER_UNITS_TO_DEVICE (center->x),
CLUTTER_UNITS_TO_DEVICE (center->y), CLUTTER_UNITS_TO_DEVICE (center->y),

View File

@ -93,12 +93,11 @@ frame_cb (ClutterTimeline *timeline,
gint i; gint i;
/* Rotate everything clockwise about stage center*/ /* Rotate everything clockwise about stage center*/
clutter_actor_set_rotation (CLUTTER_ACTOR (oh->group), clutter_actor_set_rotation (CLUTTER_ACTOR (oh->group),
CLUTTER_Z_AXIS, CLUTTER_Z_AXIS,
frame_num, frame_num,
CLUTTER_STAGE_WIDTH() / 2, 0, 0, 0);
CLUTTER_STAGE_HEIGHT() / 2,
0);
for (i = 0; i < n_hands; i++) for (i = 0; i < n_hands; i++)
{ {
@ -199,18 +198,15 @@ main (int argc, char *argv[])
x = CLUTTER_STAGE_WIDTH () / 2 x = CLUTTER_STAGE_WIDTH () / 2
+ radius + radius
* cos (i * M_PI / (n_hands / 2)) * cos (i * M_PI / (n_hands / 2));
- w / 2;
y = CLUTTER_STAGE_HEIGHT () / 2 y = CLUTTER_STAGE_HEIGHT () / 2
+ radius + radius
* sin (i * M_PI / (n_hands / 2)) * sin (i * M_PI / (n_hands / 2));
- h / 2;
clutter_actor_set_position (oh->hand[i], x, y);
clutter_actor_move_anchor_point_from_gravity (oh->hand[i], clutter_actor_move_anchor_point_from_gravity (oh->hand[i],
CLUTTER_GRAVITY_CENTER); CLUTTER_GRAVITY_CENTER);
clutter_actor_set_position (oh->hand[i], x, y);
/* Add to our group group */ /* Add to our group group */
clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]); clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]);
@ -225,6 +221,18 @@ main (int argc, char *argv[])
clutter_actor_show_all (oh->group); clutter_actor_show_all (oh->group);
clutter_actor_set_anchor_point_from_gravity (oh->group,
CLUTTER_GRAVITY_CENTER);
clutter_actor_set_position (oh->group,
CLUTTER_STAGE_WIDTH()/2,
CLUTTER_STAGE_HEIGHT()/2);
printf ("group %dx%d, stage %dx%d\n",
clutter_actor_get_width (oh->group),
clutter_actor_get_height (oh->group),
CLUTTER_STAGE_WIDTH(),
CLUTTER_STAGE_HEIGHT());
/* Add the group to the stage */ /* Add the group to the stage */
clutter_container_add_actor (CLUTTER_CONTAINER (stage), clutter_container_add_actor (CLUTTER_CONTAINER (stage),
CLUTTER_ACTOR (oh->group)); CLUTTER_ACTOR (oh->group));