/* This callback serves to keep the markers ordered by their latitude. * Markers that are up north on the map should be lowered in the list so that * they are drawn the first. This is to make the illusion of a semi-3d plane * where the most north you are, the farther you are. */ static void reorder_marker (ClutterGroup *layer, ChamplainBaseMarker *marker) { guint i; gdouble y, tmp_y, low_y; ChamplainBaseMarker *lowest = NULL; g_object_get (G_OBJECT (marker), "latitude", &y, NULL); y = 90 - y; low_y = G_MAXDOUBLE; for (i = 0; i < clutter_group_get_n_children (layer); i++) { ChamplainBaseMarker *prev_marker = CHAMPLAIN_BASE_MARKER (clutter_group_get_nth_child (layer, i)); if (prev_marker == (ChamplainBaseMarker*) marker) continue; g_object_get(G_OBJECT(prev_marker), "latitude", &tmp_y, NULL); tmp_y = 90 - tmp_y; if (y < tmp_y && tmp_y < low_y) { lowest = prev_marker; low_y = tmp_y; } } if (lowest) clutter_container_lower_child (CLUTTER_CONTAINER(layer), CLUTTER_ACTOR (marker), CLUTTER_ACTOR (lowest)); }
void gnibbles_board_rescale (GnibblesBoard *board, gint tilesize) { gint i, count; gfloat x_pos, y_pos; ClutterActor *tmp; if (!board->level) return; if (!board->surface) return; board->width = BOARDWIDTH * tilesize; board->height = BOARDHEIGHT * tilesize; clutter_actor_set_size (CLUTTER_ACTOR (board->surface), board->width, board->height); count = clutter_group_get_n_children (CLUTTER_GROUP (board->level)); for (i = 0; i < count; i++) { tmp = clutter_group_get_nth_child (CLUTTER_GROUP (board->level), i); clutter_actor_get_position (CLUTTER_ACTOR (tmp), &x_pos, &y_pos); clutter_actor_set_position (CLUTTER_ACTOR (tmp), (x_pos / properties->tilesize) * tilesize, (y_pos / properties->tilesize) * tilesize); clutter_actor_set_size (CLUTTER_ACTOR (tmp), tilesize, tilesize); } }
void gnibbles_worm_rescale (GnibblesWorm *worm, gint tilesize) { int i; gfloat x_pos, y_pos; gint count; ClutterActor *tmp; GError *err = NULL; if (!worm) return; if (!worm->actors) return; count = clutter_group_get_n_children (CLUTTER_GROUP (worm->actors)); for (i = 0; i < count; i++) { tmp = clutter_group_get_nth_child (CLUTTER_GROUP (worm->actors), i); clutter_actor_get_position (tmp, &x_pos, &y_pos); clutter_actor_set_position (tmp, (x_pos / properties->tilesize) * tilesize, (y_pos / properties->tilesize) * tilesize); gtk_clutter_texture_set_from_pixbuf ( CLUTTER_TEXTURE (tmp), worm_pixmaps[properties->wormprops[worm->number]->color - 12], &err); if (err) gnibbles_error (err->message); } }
static void rc_free(void *renderer) { RendererClutter *rc = (RendererClutter *)renderer; GtkWidget *widget = gtk_bin_get_child(GTK_BIN(rc->pr)); rc_remove_pending_updates(rc); rc_overlay_free_all(rc); if (widget) { /* widget still exists */ clutter_actor_destroy(rc->group); if (clutter_group_get_n_children(CLUTTER_GROUP(rc->stage)) == 0) { DEBUG_1("destroy %p", rc->widget); /* this was the last user */ gtk_widget_destroy(rc->widget); } else { DEBUG_1("keep %p", rc->widget); g_object_unref(G_OBJECT(rc->widget)); } } g_free(rc); }
void gnibbles_board_resize (GnibblesBoard *board, gint newtile) { int i; int x_pos; int y_pos; int count; ClutterActor *tmp; ClutterActor *stage = gnibbles_board_get_stage (board); clutter_actor_set_size (stage, BOARDWIDTH * newtile, BOARDHEIGHT * newtile); clutter_actor_set_size (board->surface, BOARDWIDTH * newtile, BOARDHEIGHT * newtile); if (!board->level) return; count = clutter_group_get_n_children (CLUTTER_GROUP (board->level)); for (i = 0; i < count; i++) { tmp = clutter_group_get_nth_child (CLUTTER_GROUP (board->level), i); clutter_actor_get_position (tmp, &x_pos, &y_pos); clutter_actor_set_position (tmp, (x_pos / properties->tilesize) * newtile, (y_pos / properties->tilesize) * newtile); clutter_actor_set_size (tmp ,newtile, newtile); } }
static void fluttr_viewer_paint (ClutterActor *actor) { FluttrViewer *viewer; FluttrViewerPrivate *priv; viewer = FLUTTR_VIEWER(actor); priv = FLUTTR_VIEWER_GET_PRIVATE(viewer); glPushMatrix(); gint i; gint len = clutter_group_get_n_children (CLUTTER_GROUP (actor)); for (i = 0; i < len; i++) { ClutterActor* child; child = clutter_group_get_nth_child (CLUTTER_GROUP(actor), i); if (child) { clutter_actor_paint (child); } } glPopMatrix(); }
static void fade_in_completed (G_GNUC_UNUSED ClutterAnimation *animation, ChamplainTile *self) { ChamplainTilePrivate *priv = self->priv; if (!priv->content_group) return; if (clutter_group_get_n_children (CLUTTER_GROUP (priv->content_group)) > 1) clutter_actor_destroy (clutter_group_get_nth_child (CLUTTER_GROUP (priv->content_group), 0)); }
/** * champlain_layer_hide_all_markers: * @layer: a #ChamplainLayer * * Calls clutter_actor_hide on all markers * * Since: 0.4 */ void champlain_layer_hide_all_markers (ChamplainLayer *layer) { guint i; g_return_if_fail (CHAMPLAIN_IS_LAYER (layer)); for (i = 0; i < clutter_group_get_n_children (CLUTTER_GROUP (layer)); i++) { ClutterActor *marker = CLUTTER_ACTOR (clutter_group_get_nth_child (CLUTTER_GROUP (layer), i)); clutter_actor_hide (marker); } }
/** * champlain_layer_animate_out_all_markers: * @layer: a #ChamplainLayer * * Fade out all markers with an animation * * Since: 0.4 */ void champlain_layer_animate_out_all_markers (ChamplainLayer *layer) { guint i; guint delay = 0; g_return_if_fail (CHAMPLAIN_IS_LAYER (layer)); for (i = 0; i < clutter_group_get_n_children (CLUTTER_GROUP (layer)); i++) { ChamplainBaseMarker *marker = CHAMPLAIN_BASE_MARKER (clutter_group_get_nth_child (CLUTTER_GROUP (layer), i)); champlain_base_marker_animate_out_with_delay (marker, delay); delay += 50; } }
static gboolean key_group_action_move_right (KeyGroup *self, const gchar *action_name, guint key_val, ClutterModifierType modifiers) { gint n_children; g_debug ("%s: activated '%s' (k:%d, m:%d)", G_STRLOC, action_name, key_val, modifiers); n_children = clutter_group_get_n_children (CLUTTER_GROUP (self)); self->selected_index += 1; if (self->selected_index >= n_children) self->selected_index = 0; return TRUE; }
static VALUE rbclt_group_n_children (VALUE self) { ClutterGroup *group = CLUTTER_GROUP (RVAL2GOBJ (self)); return INT2NUM (clutter_group_get_n_children (group)); }