GtkWidget * gml_gtk_widget_new () { GtkWidget *obj; obj = g_object_new (GML_TYPE_GTK_WIDGET, NULL); GmlGtkWidget *gml = GML_GTK_WIDGET (obj); GtkGrid *grid = GTK_GRID (obj); gml->clutter_widget = gtk_clutter_embed_new (); gtk_widget_set_size_request (gml->clutter_widget, gml->width, gml->height); gml->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (gml->clutter_widget)); clutter_stage_set_color (CLUTTER_STAGE (gml->stage), &(gml->stage_color)); clutter_actor_show (gml->stage); gtk_widget_set_vexpand (gml->clutter_widget, TRUE); gtk_widget_set_valign (gml->clutter_widget, GTK_ALIGN_FILL); gtk_widget_set_hexpand (gml->clutter_widget, TRUE); gtk_widget_set_halign (gml->clutter_widget, GTK_ALIGN_FILL); gtk_grid_attach (grid, gml->clutter_widget, 0, 0, 1, 1); return obj; }
int main (int argc, char **argv) { const ClutterColor grey = { 0x40, 0x40, 0x40, 0xff }; ClutterActor *stage, *info_bar; ClutterConstraint *constraint; MxApplication *app; MxWindow *window; mex_init (&argc, &argv); app = mx_application_new (&argc, &argv, "mex-media-controls-test", 0); mex_style_load_default (); window = mx_application_create_window (app); stage = (ClutterActor *)mx_window_get_clutter_stage (window); clutter_stage_set_color (CLUTTER_STAGE (stage), &grey); clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE); info_bar = mex_info_bar_get_default (); constraint = clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, 0.0); clutter_actor_add_constraint (info_bar, constraint); clutter_container_add_actor (CLUTTER_CONTAINER (stage), info_bar); clutter_actor_set_size (stage, 1024, 768); clutter_actor_show (stage); clutter_main (); return 0; }
int main(int argc, char *argv[]) { clutter_init(&argc, &argv); ClutterActor *stage = NULL; ClutterColor black = { 0x00, 0x00, 0x00, 0xff }; stage = clutter_stage_get_default(); clutter_stage_set_title(CLUTTER_STAGE(stage), "Mx test"); clutter_stage_set_color(CLUTTER_STAGE(stage), &black); clutter_actor_set_size(stage, WIN_W, WIN_H); Assistant *assistant = g_new0(Assistant, 1); assistant->script = require_script(GUI_SCRIPT); assistant->stage = stage; ClutterActor *root = CLUTTER_ACTOR(require_object_from_script(assistant->script, "root")); assistant->slider = CLUTTER_ACTOR(require_object_from_script(assistant->script, "slider")); assistant->combo_box = CLUTTER_ACTOR(require_object_from_script(assistant->script, "combo_box")); clutter_container_add_actor(CLUTTER_CONTAINER(stage), root); // Combo box contents: MxComboBox *combo_box = MX_COMBO_BOX(assistant->combo_box); mx_combo_box_append_text(combo_box, "Foo"); mx_combo_box_append_text(combo_box, "Spam"); mx_combo_box_append_text(combo_box, "Lorem ipsum"); mx_combo_box_set_index(combo_box, 0); // DONE g_signal_connect(stage, "key-press-event", G_CALLBACK(key_event_cb), assistant); clutter_script_connect_signals(assistant->script, assistant); assistant->ready_ = TRUE; clutter_actor_show(stage); clutter_main(); return 0; }
G_MODULE_EXPORT int test_animation_main (int argc, char *argv[]) { ClutterActor *stage, *rect; ClutterColor stage_color = { 0x66, 0x66, 0xdd, 0xff }; ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff }; ClutterAction *action; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); rect = clutter_rectangle_new_with_color (&rect_color); clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); clutter_actor_set_size (rect, 50, 50); clutter_actor_set_anchor_point (rect, 25, 25); clutter_actor_set_position (rect, clutter_actor_get_width (stage) / 2, clutter_actor_get_height (stage) / 2); clutter_actor_set_opacity (rect, 0x88); clutter_actor_set_reactive (rect, TRUE); action = clutter_click_action_new (); g_signal_connect (action, "clicked", G_CALLBACK (on_clicked), NULL); clutter_actor_add_action_with_name (rect, "click", action); clutter_actor_show (stage); clutter_main (); return EXIT_SUCCESS; }
void show_message (void) { ClutterActor *stage, *label; ClutterColor black = { 0, 0, 0, 255 }; ClutterColor white = { 255, 255, 255, 255 }; clutter_init (NULL, NULL); stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (stage), &black); clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), TRUE); label = clutter_text_new_with_text ("Sans 20", "Cannot find suitable screen mode\n" "Media Explorer requires a 720p screen"); clutter_text_set_line_wrap (CLUTTER_TEXT (label), TRUE); clutter_text_set_color (CLUTTER_TEXT (label), &white); clutter_container_add_actor (CLUTTER_CONTAINER (stage), label); /* Put the label in the middle */ clutter_actor_add_constraint (label, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); clutter_actor_add_constraint (label, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5)); clutter_actor_show (stage); clutter_main (); }
// // redraw stack // void redraw_stack() { if (stage == NULL) { fprintf(stderr, "stage cannot be drawn upon\n"); return; } // clear stage ClutterColor stage_bg_color; clutter_color_parse("#fff", &stage_bg_color); clutter_stage_set_color(CLUTTER_STAGE(stage), &stage_bg_color); int width=256, /*height=256, */padding=5; // loop through all windows and draw an item on the grid WindowStack *sitem = stack; int i=0; while (sitem != NULL) { printf( "drawing stack item %d\n", (i+1) ); int x = (i*width) + ( (i+1)*padding ); int y = padding; ClutterActor *actor = clutter_texture_new_from_file("/home/Downloads/window.png", NULL); clutter_container_add(CLUTTER_CONTAINER(stage), actor, NULL); clutter_actor_set_position(actor, x, y); sitem = sitem->next; i++; } clutter_actor_show(CLUTTER_ACTOR(stage)); clutter_color_free(&stage_bg_color); }
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 ClutterActor* create_clutter_texture(EmpathyVideoWidget *object) { EmpathyVideoWidgetPriv *priv = GET_PRIV (object); ClutterActor *texture, *stage, *box; ClutterLayoutManager *layout; stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (object)); g_assert (stage != NULL); clutter_stage_set_color (CLUTTER_STAGE(stage), CLUTTER_COLOR_Black); layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER); g_assert (layout != NULL); box = clutter_box_new (layout); g_assert (box != NULL); clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); priv->notify_allocation_id = g_signal_connect (stage, "notify::allocation", G_CALLBACK(on_stage_allocation_changed), box); texture = clutter_texture_new (); g_assert (texture != NULL); clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE); g_object_ref (G_OBJECT (texture)); clutter_box_pack (CLUTTER_BOX (box), texture, NULL, NULL); return texture; }
int main(int argc, char *argv[]) { clutter_init(&argc, &argv); ClutterActor *stage = NULL; ClutterColor black = { 0x00, 0x00, 0x00, 0xff }; ClutterColor red = { 0xff, 0x00, 0x00, 0xff }; stage = clutter_stage_get_default(); clutter_stage_set_title(CLUTTER_STAGE(stage), "Key binder proto"); clutter_stage_set_color(CLUTTER_STAGE(stage), &black); clutter_actor_set_size(stage, WIN_W, WIN_H); App *self = g_new0(App, 1); create_stuff(); self->rectangle = clutter_rectangle_new_with_color(&red); clutter_actor_set_size(self->rectangle, 200, 200); clutter_container_add_actor(CLUTTER_CONTAINER(stage), self->rectangle); g_signal_connect(stage, "key-press-event", G_CALLBACK(key_event_cb), self); clutter_actor_show(stage); clutter_main(); g_free(self); 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) { const ClutterColor dark_gray = { 0x40, 0x40, 0x40, 0xff }; ClutterActor *box, *stage; MxApplication *app; MxWindow *window; mex_init (&argc, &argv); app = mx_application_new (&argc, &argv, "test-mex-expander-box", 0); clutter_init (&argc, &argv); mex_style_load_default (); window = mx_application_create_window (app); stage = (ClutterActor *)mx_window_get_clutter_stage (window); clutter_stage_set_color (CLUTTER_STAGE (stage), &dark_gray); box = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_VERTICAL); add_pictures (box); clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); mx_window_set_has_toolbar (window, FALSE); clutter_actor_set_size (stage, 640, 480); clutter_actor_show (stage); clutter_main (); return 0; }
void test_cogl_viewport (TestConformSimpleFixture *fixture, gconstpointer data) { guint idle_source; ClutterActor *stage; stage = clutter_stage_new (); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); /* 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_after (stage, "paint", G_CALLBACK (on_paint), NULL); clutter_actor_show (stage); clutter_main (); g_source_remove (idle_source); clutter_actor_destroy (stage); if (g_test_verbose ()) g_print ("OK\n"); }
static void glide_window_insert_stage (GlideWindow *w) { ClutterColor cblack = {0x00, 0x00, 0x00, 0xff}; GtkWidget *fixed = GTK_WIDGET (gtk_builder_get_object (w->priv->builder, "embed-fixed")); GtkWidget *embed = glide_window_make_embed (); GdkColor black; gtk_fixed_set_has_window (GTK_FIXED (fixed), TRUE); // Nasty hack. g_signal_connect (fixed, "key-press-event", G_CALLBACK (glide_window_fixed_key_press_event), NULL); gdk_color_parse ("black", &black); gtk_widget_modify_bg (fixed, GTK_STATE_NORMAL, &black); w->priv->embed = embed; w->priv->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (embed)); clutter_actor_set_size (w->priv->stage, DEFAULT_PRESENTATION_WIDTH, DEFAULT_PRESENTATION_HEIGHT); clutter_actor_show (w->priv->stage); clutter_stage_set_color (CLUTTER_STAGE (w->priv->stage), &cblack); gtk_fixed_put (GTK_FIXED (fixed), embed, 0, 0); gtk_widget_set_size_request (fixed, DEFAULT_PRESENTATION_WIDTH, DEFAULT_PRESENTATION_HEIGHT); gtk_widget_set_size_request (embed, DEFAULT_PRESENTATION_WIDTH, DEFAULT_PRESENTATION_HEIGHT); g_signal_connect_after (fixed, "size-allocate", G_CALLBACK (glide_window_fixed_embed_size_allocate), w); }
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"); }
G_MODULE_EXPORT gint test_texture_quality_main (int argc, char *argv[]) { ClutterTimeline *timeline; ClutterAlpha *alpha; ClutterBehaviour *depth_behavior; ClutterActor *stage; ClutterActor *image; ClutterColor stage_color = { 0x12, 0x34, 0x56, 0xff }; ClutterFog stage_fog = { 10.0, -50.0 }; GError *error; clutter_init (&argc, &argv); stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_use_fog (CLUTTER_STAGE (stage), TRUE); clutter_stage_set_fog (CLUTTER_STAGE (stage), &stage_fog); g_signal_connect (stage, "button-press-event", G_CALLBACK (clutter_main_quit), NULL); error = NULL; image = clutter_texture_new_from_file (argv[1]?argv[1]:"redhand.png", &error); if (error) g_error ("Unable to load image: %s", error->message); if (!argv[1]) g_print ("Hint: the redhand.png isn't a good test image for this test.\n" "This test can take any clutter loadable image as an argument\n"); /* center the image */ clutter_actor_set_position (image, (clutter_actor_get_width (stage) - clutter_actor_get_width (image))/2, (clutter_actor_get_height (stage) - clutter_actor_get_height (image))/2); clutter_container_add (CLUTTER_CONTAINER (stage), image, NULL); timeline = clutter_timeline_new (5000); g_signal_connect (timeline, "completed", G_CALLBACK (timeline_completed), NULL); alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR); depth_behavior = clutter_behaviour_depth_new (alpha, -2500, 400); clutter_behaviour_apply (depth_behavior, image); clutter_actor_show (stage); clutter_timeline_start (timeline); g_timeout_add (10000, change_filter, image); clutter_main (); g_object_unref (depth_behavior); g_object_unref (timeline); return EXIT_SUCCESS; }
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[]) { ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff }; ClutterColor actor_color = { 0xff,0xff,0xff,0x98}; /** 初始化clutter */ clutter_init(&argc, &argv); /** 获取默认的场景stage */ ClutterActor *stage = clutter_stage_get_default(); /** 设置场景大小,注意场景也actor的一种,所以可以使用actor的api设置*/ clutter_actor_set_size(stage,400,400); /** 设置场景背景*/ clutter_stage_set_color(CLUTTER_STAGE(stage), &stage_color); /** 载入一个图像的actor */ //ClutterActor * image = clutter_texture_new_from_file("demo.png",NULL); image = clutter_texture_new_from_file("demo.png",NULL); if(!image){ printf("load image error\n"); exit(-1); } /** 设置actor在场景中的位置*/ clutter_actor_set_position(image, 100,100); /** 缩放图像,这里设置长宽各放大了两倍*/ clutter_actor_set_scale(image,2.0,2.0); /** 设置图像旋转,以y轴旋转,角度20'c */ clutter_actor_set_rotation(image, CLUTTER_Y_AXIS, 120,0,0,0); /** 把actor加入场景中*/ clutter_container_add_actor(CLUTTER_CONTAINER(stage),image); clutter_actor_show(image); /** 打开actor的事件响应*/ clutter_actor_set_reactive(image,TRUE); /** 连接actor的某事件*/ g_signal_connect(image, "button-press-event", G_CALLBACK(on_image_button_press),NULL); /** 加入时间线*/ //ClutterTimeline* timeline = clutter_timeline_new(5000); timeline = clutter_timeline_new(5000); g_signal_connect(timeline, "new-frame",G_CALLBACK(on_timeline_new_frame),NULL); clutter_timeline_set_loop(timeline,TRUE); //clutter_timeline_start(timeline); clutter_actor_show(stage); clutter_main(); g_object_unref(timeline); printf("\n"); 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); }
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; }
void test_cogl_simple_rig (void) { ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff }; stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); }
int main (int argc, char **argv) { const ClutterColor grey = { 0x40, 0x40, 0x40, 0xff }; ClutterActor *stage, *info_panel, *align; MxApplication *app; MxWindow *window; MexFeed *feed; MexProgram *program; mex_init (&argc, &argv); app = mx_application_new (&argc, &argv, "mex-info-panel-test", 0); mex_style_load_default (); window = mx_application_create_window (app); stage = (ClutterActor *) mx_window_get_clutter_stage (window); clutter_stage_set_color ((ClutterStage *) stage, &grey); align = g_object_new (MX_TYPE_FRAME, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); mx_window_set_child (window, align); info_panel = mex_info_panel_new (MEX_INFO_PANEL_MODE_FULL); mx_bin_set_child (MX_BIN (align), info_panel); mx_window_set_has_toolbar (window, FALSE); clutter_actor_set_size (stage, 1024, 768); feed = mex_feed_new ("source", "title"); program = mex_program_new (feed); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_MIMETYPE, "video/mp4"); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_TITLE, "The cats on the moon"); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_SYNOPSIS, "An original title where cats are sent to the moon to catch all the mice which are naturally attracted there due to the large consistency of cheese, this results in a space race between NASA and CATSA, leading to war on the moon over territory claimed by cats"); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_STILL, "http://farm5.static.flickr.com/4013/4305303148_5cbc986a44_m.jpg"); mex_content_view_set_content (MEX_CONTENT_VIEW (info_panel), MEX_CONTENT (program)); clutter_actor_show (stage); clutter_main (); return 0; }
int main (int argc, char *argv[]) { ClutterActor *stage; ClutterPath *path; ClutterConstraint *constraint; ClutterActor *rectangle; ClutterTimeline *timeline; const ClutterColor *stage_color = clutter_color_new (51, 51, 85, 255); const ClutterColor *red_color = clutter_color_new (255, 0, 0, 255); clutter_init (&argc, &argv); stage = clutter_stage_new (); clutter_actor_set_size (stage, 360, 300); clutter_stage_set_color (CLUTTER_STAGE (stage), stage_color); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); /* create the path */ path = clutter_path_new (); clutter_path_add_move_to (path, 30, 60); /* add a curve round to the top-right of the stage */ clutter_path_add_rel_curve_to (path, 120, 180, 180, 120, 240, 0); /* create a constraint based on the path */ constraint = clutter_path_constraint_new (path, 0.0); /* put a rectangle at the start of the path */ rectangle = clutter_rectangle_new_with_color (red_color); clutter_actor_set_size (rectangle, 60, 60); /* add the constraint to the rectangle */ clutter_actor_add_constraint_with_name (rectangle, "path", constraint); /* add the rectangle to the stage */ clutter_container_add_actor (CLUTTER_CONTAINER (stage), rectangle); /* set up the timeline */ timeline = clutter_timeline_new (1000); clutter_timeline_set_loop (timeline, TRUE); clutter_timeline_set_auto_reverse (timeline, TRUE); clutter_actor_animate_with_timeline (rectangle, CLUTTER_LINEAR, timeline, "@constraints.path.offset", 1.0, NULL); clutter_actor_show (stage); clutter_main (); return EXIT_SUCCESS; }
ClutterActor * new_stage(void){ static const ClutterColor black = {0, 0, 0, 255}; ClutterActor *stage = clutter_stage_get_default(); clutter_stage_set_color(CLUTTER_STAGE(stage), &black); clutter_stage_set_fullscreen(CLUTTER_STAGE(stage), TRUE); clutter_stage_hide_cursor(CLUTTER_STAGE(stage)); return stage; }
int main (int argc, char *argv[]) { ClutterActor *stage; ClutterActor *red; ClutterActor *green; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; stage = clutter_stage_new (); clutter_actor_set_size (stage, 400, 400); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); red = clutter_rectangle_new_with_color (&red_color); clutter_actor_set_size (red, 100, 100); clutter_actor_set_position (red, 50, 150); clutter_actor_set_reactive (red, TRUE); green = clutter_rectangle_new_with_color (&green_color); clutter_actor_set_size (green, 100, 100); clutter_actor_set_position (green, 250, 150); clutter_actor_set_reactive (green, TRUE); g_signal_connect (red, "button-press-event", G_CALLBACK (button_event_cb), NULL); g_signal_connect (red, "button-release-event", G_CALLBACK (button_event_cb), NULL); g_signal_connect (green, "button-press-event", G_CALLBACK (button_event_cb), NULL); g_signal_connect (green, "button-release-event", G_CALLBACK (button_event_cb), NULL); clutter_container_add (CLUTTER_CONTAINER (stage), red, green, NULL); clutter_actor_show (stage); clutter_main (); return EXIT_SUCCESS; }
int main (int argc, char *argv[]) { ClutterActor *stage; ClutterAction *action1; ClutterAction *action2; ClutterActor *actor1; ClutterActor *actor2; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; stage = clutter_stage_new (); clutter_actor_set_size (stage, 400, 400); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); actor1 = clutter_actor_new (); clutter_actor_set_name (actor1, "Red Button"); clutter_actor_set_background_color (actor1, CLUTTER_COLOR_Red); clutter_actor_set_size (actor1, 100, 100); clutter_actor_set_reactive (actor1, TRUE); clutter_actor_set_position (actor1, 50, 150); clutter_actor_add_child (stage, actor1); actor2 = clutter_actor_new (); clutter_actor_set_name (actor2, "Blue Button"); clutter_actor_set_background_color (actor2, CLUTTER_COLOR_Blue); clutter_actor_set_size (actor2, 100, 100); clutter_actor_set_position (actor2, 250, 150); clutter_actor_set_reactive (actor2, TRUE); clutter_actor_add_child (stage, actor2); action1 = clutter_click_action_new (); clutter_actor_add_action (actor1, action1); action2 = clutter_click_action_new (); clutter_actor_add_action (actor2, action2); g_signal_connect (action1, "clicked", G_CALLBACK (clicked_cb), NULL); g_signal_connect (action2, "clicked", G_CALLBACK (clicked_cb), NULL); clutter_actor_show (stage); clutter_main (); return EXIT_SUCCESS; }
static void cheese_widget_init (CheeseWidget *widget) { CheeseWidgetPrivate *priv = CHEESE_WIDGET_GET_PRIVATE (widget); GtkWidget *box; ClutterActor *stage, *frame; ClutterConstraint *constraint; ClutterColor black = { 0x00, 0x00, 0x00, 0xff }; priv->state = CHEESE_WIDGET_STATE_NONE; priv->error = NULL; /* XXX * remove this line if you want to debug */ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE); /* Spinner page */ priv->spinner = gtk_spinner_new (); box = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (box), priv->spinner); cheese_widget_spinner_invert (priv->spinner, box); gtk_widget_show_all (box); gtk_notebook_append_page (GTK_NOTEBOOK (widget), box, gtk_label_new ("spinner")); /* Webcam page */ priv->screen = gtk_clutter_embed_new (); stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (priv->screen)); clutter_stage_set_color (CLUTTER_STAGE (stage), &black); frame = cheese_aspect_frame_new (); priv->texture = clutter_texture_new (); clutter_actor_set_size (priv->texture, 400, 300); mx_bin_set_child (MX_BIN (frame), priv->texture); clutter_container_add_actor (CLUTTER_CONTAINER (stage), frame); constraint = clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0); clutter_actor_add_constraint_with_name (frame, "size", constraint); gtk_widget_show (priv->screen); clutter_actor_show (priv->texture); gtk_notebook_append_page (GTK_NOTEBOOK (widget), priv->screen, gtk_label_new ("webcam")); /* Problem page */ priv->problem = gtk_drawing_area_new (); gtk_widget_show (priv->problem); gtk_notebook_append_page (GTK_NOTEBOOK (widget), priv->problem, gtk_label_new ("got problems")); priv->settings = g_settings_new ("org.gnome.Cheese"); }
int main (int argc, char *argv[]) { ClutterActor *stage; ClutterActor *button; ClutterConstraint *align_x_constraint; ClutterConstraint *align_y_constraint; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; stage = clutter_stage_new (); clutter_actor_set_size (stage, 400, 400); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); button = cb_button_new (); cb_button_set_text (CB_BUTTON (button), "hello"); /* the following is equivalent to the two lines above: * * button = g_object_new (CB_TYPE_BUTTON, * "text", "winkle", * NULL); * * because we defined a set_property function, which can accept * a PROP_TEXT parameter, GObject can create a button and set one * or more properties with a single call to g_object_new() */ /* note that the size of the button is left to Clutter's size requisition */ cb_button_set_text_color (CB_BUTTON (button), &white_color); cb_button_set_background_color (CB_BUTTON (button), &yellow_color); g_signal_connect (button, "clicked", G_CALLBACK (clicked), NULL); align_x_constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5); align_y_constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5); clutter_actor_add_constraint (button, align_x_constraint); clutter_actor_add_constraint (button, align_y_constraint); clutter_actor_add_child (stage, button); clutter_actor_show (stage); clutter_main (); return EXIT_SUCCESS; }
G_MODULE_EXPORT gint test_text_main (gint argc, gchar **argv) { ClutterActor *stage; ClutterActor *text; ClutterColor text_color = { 0x33, 0xff, 0x33, 0xff }; ClutterColor cursor_color = { 0xff, 0x33, 0x33, 0xff }; ClutterColor background_color = { 0x00, 0x00, 0x00, 0xff }; clutter_init (&argc, &argv); stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (stage), &background_color); text = clutter_text_new_full (FONT, "·", &text_color); clutter_container_add (CLUTTER_CONTAINER (stage), text, NULL); clutter_actor_set_position (text, 40, 30); clutter_actor_set_width (text, 1024); clutter_text_set_line_wrap (CLUTTER_TEXT (text), TRUE); clutter_actor_set_reactive (text, TRUE); clutter_stage_set_key_focus (CLUTTER_STAGE (stage), text); clutter_text_set_editable (CLUTTER_TEXT (text), TRUE); clutter_text_set_selectable (CLUTTER_TEXT (text), TRUE); clutter_text_set_cursor_color (CLUTTER_TEXT (text), &cursor_color); if (argv[1]) { GError *error = NULL; gchar *utf8; g_file_get_contents (argv[1], &utf8, NULL, &error); if (error) { utf8 = g_strconcat ("Unable to open '", argv[1], "':\n", error->message, NULL); g_error_free (error); } clutter_text_set_text (CLUTTER_TEXT (text), utf8); } else clutter_text_set_text (CLUTTER_TEXT (text), runes); clutter_actor_set_size (stage, 1024, 768); clutter_actor_show (stage); clutter_main (); return EXIT_SUCCESS; }
G_MODULE_EXPORT int test_easing_main (int argc, char *argv[]) { ClutterActor *stage, *rect, *label; ClutterColor stage_color = { 0x88, 0x88, 0xdd, 0xff }; ClutterColor rect_color = { 0xee, 0x33, 0, 0xff }; gchar *text; gfloat stage_width, stage_height; gfloat label_width, label_height; clutter_init_with_args (&argc, &argv, NULL, test_easing_entries, NULL, NULL); stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); main_stage = stage; clutter_actor_get_size (stage, &stage_width, &stage_height); rect = make_bouncer (&rect_color, 50, 50); clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); clutter_actor_set_position (rect, stage_width / 2, stage_height / 2); text = g_strdup_printf ("Easing mode: %s (%d of %d)\n" "Right click to change the easing mode", easing_modes[current_mode].name, current_mode + 1, n_easing_modes); label = clutter_text_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), label); clutter_text_set_font_name (CLUTTER_TEXT (label), "Sans 18px"); clutter_text_set_text (CLUTTER_TEXT (label), text); clutter_actor_get_size (label, &label_width, &label_height); clutter_actor_set_position (label, stage_width - label_width - 10, stage_height - label_height - 10); easing_mode_label = label; g_free (text); g_signal_connect (stage, "button-press-event", G_CALLBACK (on_button_press), rect); clutter_actor_show (stage); clutter_main (); return EXIT_SUCCESS; }
int main(int argc, char **argv) { ClutterActor *stage; ClutterColor stage_clr = { 0x00, 0x00, 0x00, 0xff }; const gchar *stage_title = { "potassium music player" }; struct sigaction action; g_set_application_name("potassium music player"); clutter_init(&argc, &argv); stage = clutter_stage_get_default(); clutter_actor_set_size(stage, 512, 128); clutter_stage_set_color(CLUTTER_STAGE(stage), &stage_clr); clutter_stage_set_title(CLUTTER_STAGE(stage), stage_title); clutter_actor_set_name(stage, "stage"); clutter_actor_show(stage); /* Setup signal handler for USR1 to dump player state */ memset(&action, 0, sizeof(&action)); sigemptyset(&action.sa_mask); action.sa_handler = dump_data; action.sa_flags = SA_RESTART; sigaction(SIGUSR1, &action, NULL); /* Handle keyboard/mouse events */ g_signal_connect(stage, "event", G_CALLBACK(input_events_cb), NULL); mozart_init(argc, argv); if (argc == 2) { /* * strdup() argv[1] here, as it seems to get mangled by * generate_playlist() */ generate_playlist(strdup(argv[1]), strdup(argv[1])); mozart_switch_playlist(argv[1]); } else { read_checkpoint_data(); } init_icons(stage); g_timeout_add(500, (GSourceFunc)update_display, stage); g_timeout_add_seconds(1, (GSourceFunc)write_checkpoint_data, NULL); g_signal_connect(mozart_bus, "message::state-changed", G_CALLBACK(set_status_icons), stage); clutter_main(); mozart_destroy(); exit(0); }