G_MODULE_EXPORT int test_fbo_main (int argc, char *argv[]) { ClutterColor blue = {0x33, 0x44, 0x55, 0xff}; ClutterActor *fbo; ClutterActor *onscreen_source; ClutterActor *stage; ClutterAnimation *animation; int x_pos = 200; int y_pos = 100; clutter_init (&argc, &argv); if (clutter_feature_available (CLUTTER_FEATURE_OFFSCREEN) == FALSE) g_error("This test requires CLUTTER_FEATURE_OFFSCREEN"); stage = clutter_stage_get_default (); clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT); clutter_stage_set_color (CLUTTER_STAGE (stage), &blue); /* Create the first source */ onscreen_source = make_source(); clutter_actor_show_all (onscreen_source); clutter_group_add (stage, onscreen_source); y_pos = (STAGE_HEIGHT/2.0) - (clutter_actor_get_height (onscreen_source)/2.0); clutter_actor_set_position (onscreen_source, x_pos, y_pos); x_pos += clutter_actor_get_width (onscreen_source); animation = clutter_actor_animate (onscreen_source, CLUTTER_LINEAR, 5000, /* 1 second duration */ "rotation-angle-y", 360.0f, NULL); clutter_animation_set_loop (animation, TRUE); /* Second hand = actor from onscreen_source */ if ((fbo = clutter_texture_new_from_actor (onscreen_source)) == NULL) g_error("onscreen fbo creation failed"); clutter_actor_set_position (fbo, x_pos, y_pos); x_pos += clutter_actor_get_width (fbo); clutter_group_add (stage, fbo); /* Third hand = actor from Second hand */ if ((fbo = clutter_texture_new_from_actor (fbo)) == NULL) g_error("fbo from fbo creation failed"); clutter_actor_set_position (fbo, x_pos, y_pos); x_pos += clutter_actor_get_width (fbo); clutter_group_add (stage, fbo); clutter_actor_show_all (stage); clutter_main (); return 0; }
static void make_ui (ClutterActor *stage) { ClutterActor *editable = NULL; ClutterActor *rectangle = NULL; ClutterActor *label = NULL; ClutterColor color_stage = { 0x00, 0x00, 0x00, 0xff }; ClutterColor color_text = { 0xff, 0x00, 0x00, 0xff }; ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 }; ClutterColor color_label = { 0x00, 0xff, 0x55, 0xff }; ClutterColor color_rect = { 0x00, 0xff, 0xff, 0x55 }; ClutterGeometry editable_geom = {150, 50, 100, 75}; ClutterActor *full_entry = NULL; ClutterActor *cloned_entry = NULL; clutter_stage_set_color (CLUTTER_STAGE (stage), &color_stage); clutter_actor_set_size (stage, WIDTH, HEIGHT); label = clutter_text_new_full ("Sans Bold 32px", "Entry", &color_label); clutter_actor_set_position (label, 0, 50); /* editable */ editable = clutter_text_new_full ("Sans Bold 32px", "ddd", &color_text); clutter_actor_set_position (editable, 150, 50); clutter_text_set_editable (CLUTTER_TEXT (editable), TRUE); clutter_text_set_selectable (CLUTTER_TEXT (editable), TRUE); clutter_text_set_selection_color (CLUTTER_TEXT (editable), &color_sel); clutter_actor_grab_key_focus (editable); clutter_actor_set_reactive (editable, TRUE); /* rectangle: to create a entry "feeling" */ rectangle = clutter_rectangle_new_with_color (&color_rect); clutter_actor_set_geometry (rectangle, &editable_geom); full_entry = clutter_group_new (); clutter_actor_set_position (full_entry, 0, 50); clutter_actor_set_size (full_entry, 100, 75); clutter_group_add (CLUTTER_GROUP (full_entry), label); clutter_group_add (CLUTTER_GROUP (full_entry), editable); clutter_group_add (CLUTTER_GROUP (full_entry), rectangle); clutter_actor_show_all (full_entry); clutter_actor_set_scale (full_entry, 2, 1); clutter_group_add (CLUTTER_GROUP (stage), full_entry); /* Cloning! */ cloned_entry = clutter_clone_new (full_entry); clutter_actor_set_position (cloned_entry, 50, 200); clutter_actor_set_scale (cloned_entry, 1, 2); clutter_actor_show_all (cloned_entry); clutter_actor_set_reactive (cloned_entry, TRUE); clutter_group_add (CLUTTER_GROUP (stage), cloned_entry); }
int main (int argc, char *argv[]) { ClutterActor *stage = NULL; Data data1, data2,data3; guint id_2 = 0; g_set_application_name ("AtkText"); if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; if (cally_util_a11y_init (&argc, &argv) == FALSE) { g_error ("This example requires the accessibility support, " "especifically AtkUtil implementation loaded, " "as it tries to register and remove event listeners"); } data1.value = 10; data2.value = 20; data3.value = 30; /* key event listeners */ atk_add_key_event_listener ((AtkKeySnoopFunc)atk_key_listener, &data1); id_2 = atk_add_key_event_listener ((AtkKeySnoopFunc)atk_key_listener, &data2); atk_add_key_event_listener ((AtkKeySnoopFunc)atk_key_listener, &data3); atk_remove_key_event_listener (id_2); /* event listeners */ atk_add_global_event_listener (window_event_listener, "window:create"); atk_add_global_event_listener (window_event_listener, "window:destroy"); atk_add_global_event_listener (window_event_listener, "window:activate"); atk_add_global_event_listener (window_event_listener, "window:deactivate"); stage = clutter_stage_get_default (); make_ui (stage); clutter_actor_show_all (stage); if (clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE)) { stage = clutter_stage_new (); make_ui (stage); clutter_actor_show_all (stage); } clutter_main (); return 0; }
void test_cogl_multitexture (TestConformSimpleFixture *fixture, gconstpointer data) { TestState state; ClutterActor *stage; ClutterActor *group; guint idle_source; stage = clutter_stage_new (); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); group = clutter_group_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); /* We force continuous redrawing incase someone comments out the * clutter_main_quit and wants visual feedback for the test since we * wont be doing anything else that will trigger redrawing. */ idle_source = clutter_threads_add_idle (queue_redraw, stage); g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state); clutter_actor_show_all (stage); clutter_main (); g_source_remove (idle_source); clutter_actor_destroy (stage); if (g_test_verbose ()) g_print ("OK\n"); }
int main (int argc, char **argv) { ClutterActor *stage; ClutterActor *button; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) { g_critical ("Could not initialize Clutter"); return EXIT_FAILURE; } /* For the icon-theme only. */ gtk_init (&argc, &argv); stage = clutter_stage_new (); button = g_object_new (MPD_TYPE_FOLDER_BUTTON, "label", "Documents", "uri", "file:///home/robsta/Documents", NULL); g_signal_connect (button, "clicked", G_CALLBACK (_folder_clicked_cb), NULL); clutter_container_add_actor (CLUTTER_CONTAINER (stage), button); clutter_actor_show_all (stage); clutter_main (); clutter_actor_destroy (stage); return EXIT_SUCCESS; }
int main (int argc, char *argv[]) { ClutterActor *stage; ClutterActor *coglbox; clutter_init(&argc, &argv); stage = clutter_stage_get_default (); clutter_actor_set_size (stage, 400, 400); clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); coglbox = test_coglbox_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox); clutter_actor_set_rotation (coglbox, CLUTTER_Y_AXIS, -30, 200, 0, 0); clutter_actor_set_position (coglbox, 0, 100); clutter_actor_show_all (stage); while (1) { clutter_actor_hide (coglbox); clutter_actor_show (coglbox); SPIN(); } return 0; }
int main (int argc, char **argv) { ClutterActor *stage; ClutterActor *pane; ClutterActor *button; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) { g_warning ("Unable to initialise Clutter"); return EXIT_FAILURE; } mx_style_load_from_file (mx_style_get_default (), THEMEDIR "/theme.css", NULL); stage = clutter_stage_get_default (); pane = mpl_content_pane_new ("Foo"); clutter_actor_set_size (pane, 480, 320); clutter_container_add_actor (CLUTTER_CONTAINER (stage), pane); button = mx_button_new_with_label ("Bar"); mpl_content_pane_set_header_actor (MPL_CONTENT_PANE (pane), button); button = mx_button_new_with_label ("Baz"); clutter_container_add_actor (CLUTTER_CONTAINER (pane), button); clutter_actor_show_all (stage); clutter_main (); return EXIT_SUCCESS; }
int main (int argc, char *argv[]) { ClutterActor *stage = NULL; g_set_application_name ("AtkEditableText"); if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; cally_util_a11y_init (&argc, &argv); stage = clutter_stage_new (); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); make_ui (stage); clutter_actor_show_all (stage); test_atk_text (text_actor); test_atk_text (text_editable_actor); clutter_main (); return 0; }
static void art_cb (RBExtDBKey *key, const char *filename, GValue *data, MxFrame *frame) { ClutterActor *image; GdkPixbuf *pixbuf; if (data == NULL || G_VALUE_HOLDS (data, GDK_TYPE_PIXBUF) == FALSE) { return; } clutter_threads_enter (); image = gtk_clutter_texture_new (); pixbuf = GDK_PIXBUF (g_value_get_object (data)); gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE (image), pixbuf, NULL); if (clutter_actor_get_height (image) > MAX_IMAGE_HEIGHT) { clutter_actor_set_height (image, MAX_IMAGE_HEIGHT); clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (image), TRUE); } if (clutter_actor_get_width (image) > MAX_IMAGE_HEIGHT) { clutter_actor_set_width (image, MAX_IMAGE_HEIGHT); } mx_bin_set_child (MX_BIN (frame), image); clutter_actor_show_all (CLUTTER_ACTOR (frame)); clutter_threads_leave (); }
G_MODULE_EXPORT int test_offscreen_main (int argc, char *argv[]) { ClutterActor *stage; gboolean offscreen; clutter_init (&argc, &argv); stage = clutter_stage_get_default (); /* Attempt to set up rendering offscreen */ g_object_set (stage, "offscreen", TRUE, NULL); /* See if it worked */ g_object_get (stage, "offscreen", &offscreen, NULL); if (offscreen == FALSE) printf ("FAIL: Unable to setup offscreen rendering\n."); else printf ("SUCCESS: Able to setup offscreen rendering\n."); clutter_actor_show_all (CLUTTER_ACTOR (stage)); clutter_main(); return 0; }
void test_cogl_multitexture (TestConformSimpleFixture *fixture, gconstpointer data) { TestState state; ClutterActor *stage; ClutterActor *group; guint idle_source; state.frame = 0; stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); group = clutter_group_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); /* We force continuous redrawing of the stage, since we need to skip * the first few frames, and we wont be doing anything else that * will trigger redrawing. */ idle_source = g_idle_add (queue_redraw, stage); g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state); clutter_actor_show_all (stage); clutter_main (); g_source_remove (idle_source); if (g_test_verbose ()) g_print ("OK\n"); }
void AcceleratedCompositingContext::attachRootGraphicsLayer(GraphicsLayer* graphicsLayer) { if (!graphicsLayer) { gtk_container_remove(GTK_CONTAINER(m_webView), m_rootLayerEmbedder); m_rootLayerEmbedder = 0; m_rootGraphicsLayer = 0; return; } // Create an instance of GtkClutterEmbed to host actors as web layers. if (!m_rootLayerEmbedder) { m_rootLayerEmbedder = gtk_clutter_embed_new(); gtk_container_add(GTK_CONTAINER(m_webView), m_rootLayerEmbedder); gtk_widget_show(m_rootLayerEmbedder); } // Add a root layer to the stage. if (graphicsLayer) { m_rootGraphicsLayer = graphicsLayer; ClutterColor stageColor = { 0xFF, 0xFF, 0xFF, 0xFF }; ClutterActor* stage = gtk_clutter_embed_get_stage(GTK_CLUTTER_EMBED(m_rootLayerEmbedder)); clutter_stage_set_color(CLUTTER_STAGE(stage), &stageColor); clutter_container_add_actor(CLUTTER_CONTAINER(stage), m_rootGraphicsLayer->platformLayer()); clutter_actor_show_all(stage); } }
static void am_ready_cb (GObject *source_object, GAsyncResult *result, gpointer userdata) { TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object); AnerleyFeed *feed; ClutterActor *stage; ClutterActor *scroll_view; ClutterActor *icon_view; ClutterModel *model; GError *error = NULL; if (!tp_account_manager_prepare_finish (account_manager, result, &error)) { g_warning ("Failed to make account manager ready: %s", error->message); g_error_free (error); return; } feed = ANERLEY_FEED (anerley_aggregate_tp_feed_new ()); model = CLUTTER_MODEL (anerley_feed_model_new (feed)); stage = clutter_stage_get_default (); icon_view = anerley_tile_view_new (ANERLEY_FEED_MODEL (model)); scroll_view = mx_scroll_view_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (scroll_view)); clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view), CLUTTER_ACTOR (icon_view)); clutter_actor_set_size (CLUTTER_ACTOR (scroll_view), 640, 480); clutter_actor_show_all (stage); }
static void fade_transition_frame_cb (OptTransition *trans, gint frame_num, gpointer data) { OptSlide *from, *to; OptTransitionPrivate *priv; gint opacity; priv = trans->priv; from = opt_transition_get_from (trans); to = opt_transition_get_to (trans); if (frame_num == 1) { clutter_actor_show_all (CLUTTER_ACTOR(to)); clutter_actor_raise_top (CLUTTER_ACTOR(to)); } opacity = (frame_num * 255 ) / clutter_timeline_get_n_frames (CLUTTER_TIMELINE(trans)); clutter_actor_set_opacity (CLUTTER_ACTOR(to), opacity); /* clutter_actor_set_depth (CLUTTER_ACTOR(from), - opacity/10 ); */ }
int main (int argc, char *argv[]) { ClutterActor *stage = NULL; Data data1, data2,data3; guint id_2 = 0; g_set_application_name ("AtkText"); if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; cally_util_a11y_init (&argc, &argv); data1.value = 10; data2.value = 20; data3.value = 30; /* key event listeners */ atk_add_key_event_listener ((AtkKeySnoopFunc)atk_key_listener, &data1); id_2 = atk_add_key_event_listener ((AtkKeySnoopFunc)atk_key_listener, &data2); atk_add_key_event_listener ((AtkKeySnoopFunc)atk_key_listener, &data3); atk_remove_key_event_listener (id_2); /* event listeners */ atk_add_global_event_listener (window_event_listener, "window:create"); atk_add_global_event_listener (window_event_listener, "window:destroy"); atk_add_global_event_listener (window_event_listener, "window:activate"); atk_add_global_event_listener (window_event_listener, "window:deactivate"); stage = clutter_stage_get_default (); make_ui (stage); clutter_actor_show_all (stage); if (clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE)) { stage = clutter_stage_new (); make_ui (stage); clutter_actor_show_all (stage); } clutter_main (); return 0; }
G_MODULE_EXPORT int test_viewport_main (int argc, char *argv[]) { ClutterTimeline *timeline; ClutterAlpha *alpha; ClutterBehaviour *r_behave; ClutterActor *stage; ClutterActor *hand; ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff }; gchar *file; clutter_init (&argc, &argv); stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); /* Make a hand */ file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); hand = clutter_texture_new_from_file (file, NULL); if (!hand) g_error("Unable to load image '%s'", file); g_free (file); clutter_actor_set_position (hand, 300, 200); clutter_actor_set_clip (hand, 20, 21, 132, 170); clutter_actor_set_anchor_point (hand, 86, 125); clutter_actor_show (hand); clutter_container_add_actor (CLUTTER_CONTAINER (stage), hand); /* Make a timeline */ timeline = clutter_timeline_new (7692); clutter_timeline_set_loop (timeline, TRUE); /* Set an alpha func to power behaviour */ alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR); /* Create a behaviour for that alpha */ r_behave = clutter_behaviour_rotate_new (alpha, CLUTTER_Z_AXIS, CLUTTER_ROTATE_CW, 0.0, 360.0); /* Apply it to our actor */ clutter_behaviour_apply (r_behave, hand); /* start the timeline and thus the animations */ clutter_timeline_start (timeline); clutter_actor_show_all (stage); clutter_main(); g_object_unref (r_behave); return 0; }
int main (int argc, char **argv) { ClutterActor *stage, *image, *sub_image; CoglHandle texture, sub_texture; gfloat image_width, image_height; /* Initialize Clutter */ if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS) return 1; /* Get the default stage */ stage = clutter_stage_get_default (); clutter_stage_set_title (CLUTTER_STAGE (stage), "Sub-texture"); /* Create a new ClutterTexture that shows smiley.png */ image = clutter_texture_new_from_file ("smiley.png", NULL); clutter_actor_get_size (image, &image_width, &image_height); clutter_actor_set_size (stage, image_width * 3 / 2 + 30, image_height + 20); /* Grab the CoglHandle of the underlying Cogl texture */ texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (image)); /* Create a new Cogl texture from the handle above. That new texture is a * rectangular region from image, more precisely the north ouest corner * of the image */ sub_texture = cogl_texture_new_from_sub_texture (texture, 0, 0, image_width / 2, image_height / 2); /* Finally, use the newly created Cogl texture to feed a new ClutterTexture * and thus create a new actor that displays sub_texture */ sub_image = clutter_texture_new (); clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (sub_image), sub_texture); /* * You could have used the more straightforward g_object_new() function that * can create an object and set some properties on it at the same time: * sub_image = g_object_new (CLUTTER_TYPE_TEXTURE, * "cogl-texture", sub_texture, * NULL); */ /* Put the original image at (10,10) and the new sub image next to it */ clutter_actor_set_position (image, 10, 10); clutter_actor_set_position (sub_image, 20 + image_width, 10); /* Add both ClutterTexture to the stage */ clutter_container_add (CLUTTER_CONTAINER (stage), image, sub_image, NULL); clutter_actor_show_all (stage); clutter_main (); return 0; }
int main(int argc, char *argv[]) { GstElement *pipeline, *sink; ClutterTimeline *timeline; ClutterActor *stage, *texture; /* clutter-gst takes care of initializing Clutter and GStreamer */ if (clutter_gst_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) { g_error ("Failed to initialize clutter\n"); return -1; } stage = clutter_stage_get_default (); /* Make a timeline */ timeline = clutter_timeline_new (1000); g_object_set(timeline, "loop", TRUE, NULL); /* Create new texture and disable slicing so the video is properly mapped onto it */ texture = CLUTTER_ACTOR (g_object_new (CLUTTER_TYPE_TEXTURE, "disable-slicing", TRUE, NULL)); g_signal_connect (texture, "size-change", G_CALLBACK (size_change), NULL); /* Build the GStreamer pipeline */ pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL); /* Instantiate the Clutter sink */ sink = gst_element_factory_make ("autocluttersink", NULL); if (sink == NULL) { /* Revert to the older cluttersink, in case autocluttersink was not found */ sink = gst_element_factory_make ("cluttersink", NULL); } if (sink == NULL) { g_printerr ("Unable to find a Clutter sink.\n"); return -1; } /* Link GStreamer with Clutter by passing the Clutter texture to the Clutter sink*/ g_object_set (sink, "texture", texture, NULL); /* Add the Clutter sink to the pipeline */ g_object_set (pipeline, "video-sink", sink, NULL); /* Start playing */ gst_element_set_state (pipeline, GST_STATE_PLAYING); /* start the timeline */ clutter_timeline_start (timeline); /* Add texture to the stage, and show it */ clutter_group_add (CLUTTER_GROUP (stage), texture); clutter_actor_show_all (stage); clutter_main(); /* Free resources */ gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); return 0; }
static void cover_art_entry_changed_cb (RBShellPlayer *player, RhythmDBEntry *entry, MxFrame *frame) { clutter_threads_enter (); set_blank_image (frame); clutter_actor_show_all (CLUTTER_ACTOR (frame)); clutter_threads_leave (); request_cover_art (frame, entry); }
static void astro_images_window_init (AstroImagesWindow *window) { AstroImagesWindowPrivate *priv; priv = window->priv = ASTRO_IMAGES_WINDOW_GET_PRIVATE (window); clutter_actor_set_position (CLUTTER_ACTOR (window), 0, 0); clutter_actor_show_all (CLUTTER_ACTOR (window)); }
static void mpl_application_view_init (MplApplicationView *self) { MplApplicationViewPrivate *priv; ClutterActor *actor = CLUTTER_ACTOR (self); priv = self->priv = APPLICATION_VIEW_PRIVATE (self); /* tile */ clutter_actor_set_reactive (actor, TRUE); mx_stylable_set_style_class (MX_STYLABLE (actor), "switcherTile"); clutter_actor_set_size (actor, TILE_WIDTH, TILE_HEIGHT); g_signal_connect (self, "button-release-event", G_CALLBACK (activate_clicked), NULL); priv->title_box = mx_box_layout_new_with_orientation (MX_ORIENTATION_VERTICAL); clutter_actor_set_parent (priv->title_box, actor); /* title */ priv->title = mx_label_new (); mx_label_set_y_align (MX_LABEL (priv->title), MX_ALIGN_MIDDLE); mx_stylable_set_style_class (MX_STYLABLE (priv->title), "appTitle"); mx_box_layout_add_actor (MX_BOX_LAYOUT (priv->title_box), priv->title, 0); mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->title_box), priv->title, TRUE); /* subtitle */ priv->subtitle = mx_label_new (); mx_label_set_y_align (MX_LABEL (priv->subtitle), MX_ALIGN_MIDDLE); mx_stylable_set_style_class (MX_STYLABLE (priv->subtitle), "appSubTitle"); mx_box_layout_add_actor (MX_BOX_LAYOUT (priv->title_box), priv->subtitle, 1); mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->title_box), priv->subtitle, FALSE); /* close button */ priv->close_button = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->close_button), "appCloseButton"); clutter_actor_set_parent (priv->close_button, actor); g_signal_connect (priv->close_button, "clicked", G_CALLBACK (close_btn_clicked), self); /* frame */ priv->app_frame = mx_frame_new (); clutter_actor_set_size (priv->app_frame, 250, 100); mx_stylable_set_style_class (MX_STYLABLE (priv->app_frame), "appBackground"); clutter_actor_set_parent (priv->app_frame, actor); /* shadow */ priv->shadow = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->shadow), "appShadow"); mx_bin_set_child (MX_BIN (priv->app_frame), priv->shadow); mx_bin_set_fill (MX_BIN (priv->app_frame), FALSE, FALSE); clutter_actor_show_all (actor); }
static void st_table_show_all (ClutterActor *table) { GList *l, *children; children = st_container_get_children_list (ST_CONTAINER (table)); for (l = children; l; l = l->next) clutter_actor_show_all (CLUTTER_ACTOR (l->data)); clutter_actor_show (table); }
int main (int argc, char *argv[]) { ClutterActor *stage; g_type_init (); g_thread_init (NULL); if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; clutter_threads_init (); GMainLoop *loop; loop = g_main_loop_new (NULL, FALSE); stage = clutter_stage_new (); clutter_stage_set_title (CLUTTER_STAGE (stage), "message test"); clutter_actor_set_size (stage, 400, 600); clutter_actor_show_all (stage); #if 1 ClutterActor *message; GnomeAppStore *store; store = gnome_app_store_get_default (); gnome_app_store_set_lock_function (store, clutter_threads_enter); gnome_app_store_set_unlock_function (store, clutter_threads_leave); message = CLUTTER_ACTOR (gnome_app_message_new ()); clutter_container_add (CLUTTER_CONTAINER (stage), message, NULL); #else ClutterActor *page, *actor; ClutterScript *script; GError *error; script = clutter_script_new (); error = NULL; clutter_script_load_from_file (script, "/home/dliang/gnome-app-store/ui/message-info-page.json", &error); // clutter_script_load_from_file (script, "/home/dliang/gnome-app-store/ui/test.json", &error); if (error) printf ("error in load %s\n", error->message); clutter_script_get_objects (script, "message-info-page", &page, "sender_label", &actor, NULL); ClutterLayoutManager *layout; layout = clutter_box_get_layout_manager (page); gint col, row; clutter_layout_manager_child_get (layout, page, actor, "column", &col, "row", &row, NULL); printf ("col %d %d\n", col, row); clutter_layout_manager_child_set (layout, page, actor, "column", 2, "row", 1, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), page, NULL); #endif g_main_loop_run (loop); g_main_loop_unref (loop); return EXIT_SUCCESS; }
static void astro_systray_init (AstroSystray *systray) { AstroSystrayPrivate *priv; GdkPixbuf *pixbuf; ClutterColor white = { 0xff, 0xff, 0xff, 0xff }; gint width; gchar *font; priv = systray->priv = ASTRO_SYSTRAY_GET_PRIVATE (systray); pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR"/icons/bt.png", NULL); if (pixbuf) { priv->bt = clutter_texture_new_from_pixbuf (pixbuf); clutter_container_add_actor (CLUTTER_CONTAINER (systray), priv->bt); clutter_actor_set_anchor_point_from_gravity (priv->bt, CLUTTER_GRAVITY_CENTER); clutter_actor_set_position (priv->bt, 0, ASTRO_PANEL_HEIGHT ()/2); } pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR"/icons/nm.png", NULL); if (pixbuf) { priv->nm = clutter_texture_new_from_pixbuf (pixbuf); clutter_container_add_actor (CLUTTER_CONTAINER (systray), priv->nm); clutter_actor_set_anchor_point_from_gravity (priv->nm, CLUTTER_GRAVITY_WEST); clutter_actor_set_position (priv->nm, clutter_actor_get_width (priv->bt) + PADDING, ASTRO_PANEL_HEIGHT () /2); } width = clutter_actor_get_width (CLUTTER_ACTOR (systray)); /* Time date */ font = g_strdup_printf ("Sans %d", (int)(ASTRO_PANEL_HEIGHT () * 0.2)); priv->time = clutter_label_new_full (font, " ", &white); clutter_label_set_line_wrap (CLUTTER_LABEL (priv->time), FALSE); clutter_container_add_actor (CLUTTER_CONTAINER (systray), priv->time); clutter_actor_set_anchor_point_from_gravity (priv->time,CLUTTER_GRAVITY_WEST); set_time (systray); clutter_actor_set_position (priv->time, width + PADDING, ASTRO_PANEL_HEIGHT ()/2); g_timeout_add (1000, (GSourceFunc)set_time, systray); g_free (font); clutter_actor_show_all (CLUTTER_ACTOR (systray)); }
G_MODULE_EXPORT int test_cogl_vertex_buffer_main (int argc, char *argv[]) { TestState state; ClutterActor *stage; gfloat stage_w, stage_h; gint dummy_width, dummy_height; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; stage = clutter_stage_new (); clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Vertex Buffers"); clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black); g_signal_connect (stage, "destroy", G_CALLBACK (stop_and_quit), &state); clutter_actor_get_size (stage, &stage_w, &stage_h); dummy_width = MESH_WIDTH * QUAD_WIDTH; dummy_height = MESH_HEIGHT * QUAD_HEIGHT; state.dummy = create_dummy_actor (dummy_width, dummy_height); clutter_container_add_actor (CLUTTER_CONTAINER (stage), state.dummy); clutter_actor_set_position (state.dummy, (stage_w / 2.0) - (dummy_width / 2.0), (stage_h / 2.0) - (dummy_height / 2.0)); state.timeline = clutter_timeline_new (1000); clutter_timeline_set_loop (state.timeline, TRUE); state.frame_id = g_signal_connect (state.timeline, "new-frame", G_CALLBACK (frame_cb), &state); g_signal_connect (state.dummy, "paint", G_CALLBACK (on_paint), &state); init_quad_mesh (&state); clutter_actor_show_all (stage); clutter_timeline_start (state.timeline); clutter_main (); cogl_handle_unref (state.buffer); cogl_handle_unref (state.indices); return 0; }
static void zoom_transition_frame_cb (OptTransition *trans, gint frame_num, gpointer data) { OptSlide *from, *to; OptTransitionPrivate *priv; ClutterActor *stage; gint n_frames = 0; priv = trans->priv; from = opt_transition_get_from (trans); to = opt_transition_get_to (trans); stage = clutter_stage_get_default(); n_frames = clutter_timeline_get_n_frames (CLUTTER_TIMELINE(trans)); if (frame_num > n_frames/2) { clutter_actor_hide (CLUTTER_ACTOR(from)); clutter_actor_show_all (CLUTTER_ACTOR(to)); clutter_actor_set_depth (CLUTTER_ACTOR(to), -1 * ((n_frames * 2000) - (frame_num * 2000))); clutter_actor_set_rotation (CLUTTER_ACTOR(to), CLUTTER_Z_AXIS, frame_num * ((360*2)/n_frames), CLUTTER_STAGE_WIDTH()/2, CLUTTER_STAGE_HEIGHT()/2, 0); } else { clutter_actor_hide (CLUTTER_ACTOR(to)); clutter_actor_set_depth (CLUTTER_ACTOR(from), -2000 * frame_num); clutter_actor_set_rotation (CLUTTER_ACTOR(from), CLUTTER_Z_AXIS, frame_num * ((360*2)/n_frames), CLUTTER_STAGE_WIDTH()/2, CLUTTER_STAGE_HEIGHT()/2, 0); } }
static void page_transition_frame_cb (OptTransition *trans, gint frame_num, gpointer data) { OptSlide *from, *to; ClutterActor *stage; ClutterColor color = { 0x22, 0x22, 0x22, 0xff }; OptTransitionPrivate *priv; gint mult, n_frames; priv = trans->priv; from = opt_transition_get_from (trans); to = opt_transition_get_to (trans); stage = clutter_stage_get_default(); clutter_actor_show_all (CLUTTER_ACTOR(to)); mult = priv->direction ? -1 : 1; n_frames = clutter_timeline_get_n_frames (CLUTTER_TIMELINE(trans)); if (frame_num > n_frames/2) { /* Fix Z ordering */ clutter_actor_lower_bottom (CLUTTER_ACTOR(from)); } clutter_stage_set_color (CLUTTER_STAGE(stage), &color); clutter_actor_set_rotation (CLUTTER_ACTOR(from), CLUTTER_Y_AXIS, - (float)frame_num * 2 * mult, CLUTTER_STAGE_WIDTH()*3/2, 0, -1 * (CLUTTER_STAGE_WIDTH()/2)); clutter_actor_set_rotation (CLUTTER_ACTOR(to), CLUTTER_Y_AXIS, (mult * 60) - (frame_num * 2 * mult), CLUTTER_STAGE_WIDTH()*3/2, 0, -1 * (CLUTTER_STAGE_WIDTH()/2)); }
void opt_show_run (OptShow *self) { OptSlide *slide; OptShowPrivate *priv; ClutterActor *stage; ClutterColor col = { 0x22, 0x22, 0x22, 0xff }; priv = self->priv; priv->current_slide_num = 0; slide = g_list_nth_data (priv->slides, 0); stage = clutter_stage_get_default(); clutter_stage_set_color (CLUTTER_STAGE(stage), &col); clutter_group_add (CLUTTER_GROUP(stage), CLUTTER_ACTOR(slide)); clutter_actor_show_all (stage); }
int main (int argc, char **argv) { ClutterActor *stage; ClutterActor *tile; clutter_init (&argc, &argv); stage = clutter_stage_get_default (); tile = mpd_disk_tile_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), tile); clutter_actor_show_all (stage); clutter_main (); return EXIT_SUCCESS; }
int main (int argc, char *argv[]) { ClutterActor *stage = NULL; g_set_application_name ("Clone Example"); clutter_init (&argc, &argv); cally_util_a11y_init (&argc, &argv); stage = clutter_stage_get_default (); make_ui (stage); clutter_actor_show_all (stage); clutter_main (); return 0; }