Пример #1
0
gboolean
rotate_video (UserInterface * ui)
{
  gfloat *x = 0, *y = 0, *z = 0;
  gfloat vid_width, vid_height;
  gfloat x_center, y_center;
  gdouble angle;

  angle = clutter_actor_get_rotation (ui->texture, CLUTTER_Z_AXIS, x, y, z);
  angle += 90;
  if (angle == 360)
    angle = 0;
  clutter_actor_set_rotation (ui->texture, CLUTTER_Z_AXIS, angle, 0, 0, 0);

  if (angle == 90 || angle == 270) {
    ui->rotated = TRUE;

    if (!ui->fullscreen) {
      clutter_actor_set_width (ui->stage, ui->media_height);
      clutter_actor_set_height (ui->stage, ui->media_width);
    }
  } else {
    ui->rotated = FALSE;

    if (!ui->fullscreen) {
      clutter_actor_set_width (ui->stage, ui->media_width);
      clutter_actor_set_height (ui->stage, ui->media_height);
    }
  }

  size_change (CLUTTER_STAGE (ui->stage), ui);
}
Пример #2
0
void clarity_cover_set_rotation_behaviour(ClarityCover *self, ClutterAlpha *alpha, int final_angle, ClutterRotateDirection direction) {
    g_return_if_fail(CLARITY_IS_COVER(self));

    double current = clutter_actor_get_rotation(CLUTTER_ACTOR(self), CLUTTER_Y_AXIS, 0, 0, 0);

    if(current < 0)
        current += 360;
    else if(current > 360)
        current -= 360;

    if(current != final_angle) {
        self->priv->rotateBehaviour = clutter_behaviour_rotate_new (
                alpha,
                CLUTTER_Y_AXIS,
                direction ,
                current,
                final_angle);

        clutter_behaviour_rotate_set_center(
                CLUTTER_BEHAVIOUR_ROTATE(self->priv->rotateBehaviour),
                clutter_actor_get_width(CLUTTER_ACTOR(self)) / 2,
                0, 0);

        clutter_behaviour_apply (self->priv->rotateBehaviour, CLUTTER_ACTOR(self));
    }
}
Пример #3
0
IO_METHOD(IoClutterActor, getRotation) {
  ClutterRotateAxis axis = IoMessage_locals_intArgAt_(m, locals, 0);
  float x = 0,
        y = 0,
        z = 0;
  double angle = clutter_actor_get_rotation(IOCACTOR(self), axis, &x, &y, &z);

  IoObject *rotation = IoObject_new(IOSTATE);
  IoObject_setSlot_to_(rotation, IOSYMBOL("x"),     IONUMBER(x));
  IoObject_setSlot_to_(rotation, IOSYMBOL("y"),     IONUMBER(y));
  IoObject_setSlot_to_(rotation, IOSYMBOL("z"),     IONUMBER(z));
  IoObject_setSlot_to_(rotation, IOSYMBOL("angle"), IONUMBER(angle));

  return rotation;
}
Пример #4
0
static gboolean
actor_manipulator_press (ClutterActor *stage,
                         ClutterEvent *event,
                         gpointer      data)
{
  ClutterActor *actor;

  actor = clutter_stage_get_actor_at_pos (CLUTTER_STAGE (stage),
                                          CLUTTER_PICK_ALL,
                                          event->button.x,
                                          event->button.y);


  if (actor == stage ||
      CLUTTER_IS_GROUP (actor))
    {
      if (event->button.button == 3)
        {
          popup_nuke (stage, event->button.x, event->button.y);
          popup_add ("+rectangle", "bar", G_CALLBACK (
                       action_add_rectangle), scene_get_group ());
          popup_add ("+circle", "bar", G_CALLBACK (
                       action_add_circle), scene_get_group ());
          popup_add ("+triangle", "bar", G_CALLBACK (
                       action_add_triangle), scene_get_group ());
          popup_add ("+text", "bar", G_CALLBACK (
                       action_add_text), scene_get_group ());
          popup_add ("+image", "bar", G_CALLBACK (
                       action_add_image), scene_get_group ());
#if 0
          popup_add ("+block-tree", "bar", G_CALLBACK (
                       action_add_block_tree), scene_get_group ());
#endif
          popup_add ("zero gravity", "bar", G_CALLBACK (
                       action_zero_gravity), scene_get_group ());
        }
      return TRUE;
    }

  if (actor == NULL)
    {
      return FALSE;
    }

  if (event->button.button == 3)
    {
      popup_nuke (stage, event->button.x, event->button.y);
      popup_add ("remove", "bar", G_CALLBACK (action_remove), actor);
      popup_add ("set linear velocity", "bar", G_CALLBACK (action_set_linear_velocity), actor);
      popup_add ("set dynamic", "bar", G_CALLBACK (action_set_dynamic), actor);
      popup_add ("set static", "bar", G_CALLBACK (action_set_static), actor);
      popup_add_slider ("opacity", "hm", 0.0, 255.0,
                        clutter_actor_get_opacity (actor) * 1.0,
                        G_CALLBACK (set_opacity), actor);

      popup_add_slider ("rotation", "hm", 0.0, 360.0,
                        clutter_actor_get_rotation (actor, CLUTTER_Z_AXIS, NULL,
                                                    NULL, NULL),
                        G_CALLBACK (set_rotation), actor);

      popup_add ("ok", "bar", NULL, NULL);
      return TRUE;
    }

  if (!should_be_manipulated (actor))
    return FALSE;

  manipulated_actor = actor;

  clutter_actor_get_position (actor, &orig_x, &orig_y);
  orig_rotation = clutter_actor_get_rotation (actor, CLUTTER_Z_AXIS, NULL,
                                               NULL,
                                               NULL);

  start_x =  (event->button.x);
  start_y =  (event->button.y);

  clutter_actor_transform_stage_point (
    clutter_actor_get_parent (manipulated_actor),
    start_x, start_y,
    &start_x, &start_y);


  mode = Direct;


#ifdef BOX2D_MANIPULATION
  /* Use Box2D manipulation if the actor is dynamic, and the physics
   * engine is running
   */
  if (CLUTTER_IS_BOX2D (scene_get_group ()) &&
      clutter_box2d_get_simulating (CLUTTER_BOX2D (scene_get_group ())))
    {
      ClutterBox2D *box2d  = CLUTTER_BOX2D (scene_get_group ());
      /*ClutterVertex target = { start_x, start_y };*/
      gint type;
      
      clutter_container_child_get (CLUTTER_CONTAINER (box2d),
                                   manipulated_actor, "mode", &type, NULL);
      	  
      if (type == CLUTTER_BOX2D_DYNAMIC)
        {
#if 0
            mouse_joint = clutter_box2d_add_mouse_joint (CLUTTER_BOX2D (
                                                           scene_get_group ()),
                                                         manipulated_actor,
                                                         &target);
#endif
            mode = None; /*Box2D;*/
            manipulated_actor = NULL;
            return FALSE;
        }
    }
#endif
  clutter_set_motion_events_enabled (FALSE);

  return TRUE;
}