Ejemplo n.º 1
0
void
gnibbles_worm_set_start (GnibblesWorm *worm, guint t_xhead,
                         guint t_yhead, gint t_direction)
{
  int i;
  worm->length = g_list_length (worm->list);
  for (i = 0; i < worm->length ; i++)
    worm->list = g_list_remove (worm->list, g_list_nth_data (worm->list, i));
  g_list_free (worm->list);
  worm->list = NULL;

  clutter_group_remove_all (CLUTTER_GROUP (worm->actors));

  worm->xhead = t_xhead;
  worm->yhead = t_yhead;
  worm->xtail = t_xhead;
  worm->ytail = t_yhead;
  worm->xstart = t_xhead;
  worm->ystart = t_yhead;

  worm->direction = t_direction;
  worm->direction_start = t_direction;
  worm->length = SLENGTH;
  worm->change = 0;
  worm->stop = FALSE;

  gnibbles_worm_queue_empty (worm);
}
Ejemplo n.º 2
0
static VALUE
rbclt_group_remove_all (VALUE self)
{
  ClutterGroup *group = CLUTTER_GROUP (RVAL2GOBJ (self));
  clutter_group_remove_all (group);
  return self;
}
Ejemplo n.º 3
0
void
gnibbles_worm_destroy (GnibblesWorm *worm)
{
  while (worm->list)
    gnibbles_worm_remove_actor (worm);

  clutter_group_remove_all (CLUTTER_GROUP (worm->actors));

  g_free (worm);
}
Ejemplo n.º 4
0
static void
glide_window_close_document (GlideWindow *w)
{
  if (w->priv->document)
    g_object_unref (w->priv->document);
  if (w->priv->manager)
    g_object_unref (w->priv->manager);
  if (w->priv->undo_manager)
    g_object_unref (w->priv->undo_manager); 

  clutter_group_remove_all (CLUTTER_GROUP (w->priv->stage));
}
Ejemplo n.º 5
0
static void
gnibbles_worm_animate_death (GnibblesWorm *worm)
{
  ClutterActor *group = clutter_group_new ();
  ClutterActor *tmp = NULL;

  int i;
  gfloat x,y;

  for (i = 0; i < g_list_length (worm->list); i++) {
    tmp = gtk_clutter_texture_new_from_pixbuf (
            worm_pixmaps [properties->wormprops[worm->number]->color - 12]);

    clutter_actor_get_position (CLUTTER_ACTOR (g_list_nth_data (worm->list, i)),
                                &x, &y);

    clutter_actor_set_position (CLUTTER_ACTOR (tmp), x, y);
    clutter_actor_set_size (CLUTTER_ACTOR (tmp),
                            properties->tilesize,
                            properties->tilesize);
    clutter_container_add_actor (CLUTTER_CONTAINER (group), tmp);
  }

  worm->length = g_list_length (worm->list);
  for (i = 0; i < worm->length ; i++)
    worm->list = g_list_remove (worm->list, g_list_nth_data (worm->list, i));

  clutter_actor_set_opacity (CLUTTER_ACTOR (worm->actors), 0x00);

  clutter_group_remove_all (CLUTTER_GROUP (worm->actors));
  g_list_free (worm->list);
  worm->list = NULL;

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);

  clutter_actor_animate (group, CLUTTER_EASE_OUT_QUAD, 310,
                         "opacity", 0,
                         "scale-x", 2.0,
                         "scale-y", 2.0,
                         "fixed::scale-center-x",
                         (gfloat) worm->xhead * properties->tilesize,
                         "fixed::scale-center-y",
                         (gfloat) worm->yhead * properties->tilesize,
                         NULL);
}
Ejemplo n.º 6
0
static void
gnibbles_board_load_level (GnibblesBoard *board)
{
  gint i,j;
  gint x_pos, y_pos;
  ClutterActor *tmp;
  gboolean is_wall = TRUE;

  if (board->level) {
    clutter_group_remove_all (CLUTTER_GROUP (board->level));
    clutter_container_remove_actor (CLUTTER_CONTAINER (stage), board->level);
  }

  board->level = clutter_group_new ();

  /* Load wall_pixmaps onto the surface*/
  for (i = 0; i < BOARDHEIGHT; i++) {
    y_pos = i * properties->tilesize;
    for (j = 0; j < BOARDWIDTH; j++) {
      is_wall = TRUE;
      switch (board->walls[j][i]) {
        case 'a': // empty space
          is_wall = FALSE;
          break; // break right away
        case 'b': // straight up
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[0]);
          break;
        case 'c': // straight side
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[1]);
          break;
        case 'd': // corner bottom left
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[2]);
          break;
        case 'e': // corner bottom right
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[3]);
          break;
          case 'f': // corner up left
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[4]);
          break;
        case 'g': // corner up right
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[5]);
          break;
        case 'h': // tee up
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[6]);
          break;
        case 'i': // tee right
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[7]);
          break;
        case 'j': // tee left
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[8]);
          break;
        case 'k': // tee down
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[9]);
          break;
        case 'l': // cross
          tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[10]);
          break;
        default:
          is_wall = FALSE;
          break;
      }

      if (is_wall) {
        x_pos = j * properties->tilesize;

        clutter_actor_set_size (CLUTTER_ACTOR(tmp),
                                properties->tilesize,
                                properties->tilesize);

        clutter_actor_set_position (CLUTTER_ACTOR (tmp), x_pos, y_pos);
        clutter_actor_show (CLUTTER_ACTOR (tmp));
        clutter_container_add_actor (CLUTTER_CONTAINER (board->level),
                                     CLUTTER_ACTOR (tmp));
      }
    }
  }

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), board->level);
  clutter_actor_raise (board->level, board->surface);

  clutter_actor_set_opacity (board->level, 0);
  clutter_actor_set_scale (CLUTTER_ACTOR (board->level), 0.2, 0.2);
  clutter_actor_animate (board->level, CLUTTER_EASE_OUT_BOUNCE, 1210,
                         "opacity", 0xff,
                         "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
                         "scale-x", 1.0,
                         "scale-y", 1.0,
                         NULL);
}
Ejemplo n.º 7
0
static void
on_hide_logo_completed (ClutterAnimation *animation, ClutterActor *actor)
{
  clutter_actor_hide (actor);
  clutter_group_remove_all (CLUTTER_GROUP (actor));
}