static VALUE rbclt_stage_fullscreen (VALUE self) { ClutterStage *stage = CLUTTER_STAGE (RVAL2GOBJ (self)); clutter_stage_fullscreen (stage); return self; }
int main (int argc, char **argv) { AainaLibrary *library; AainaSource *source; ClutterActor *stage; ClutterAlpha *alpha; ClutterBehaviour *behave; ClutterColor black = { 0x00, 0x00, 0x00, 0xff }; GError *error = NULL; g_thread_init (NULL); g_set_application_name ("Aaina Image Slideshow"); clutter_init_with_args (&argc, &argv, " - Aaina Image Slideshow", entries, NULL, &error); if (error) { g_print ("Unable to run Aaina: %s", error->message); g_error_free (error); return EXIT_FAILURE; } stage = clutter_stage_get_default (); clutter_actor_set_size (stage, 720, 480); clutter_stage_hide_cursor (CLUTTER_STAGE (stage)); if (fullscreen) clutter_stage_fullscreen (CLUTTER_STAGE (stage)); clutter_stage_set_color (CLUTTER_STAGE (stage), &black); /* Load the test source */ library = aaina_library_new (); if (directories && directories[0]) { gint n_directories, i; n_directories = g_strv_length (directories); for (i = 0; i < n_directories; i++) source = aaina_source_directory_new (library, directories[i]); } else if (flickr_tags) source = aaina_source_flickr_new (library, flickr_tags); else { g_print ("Usage: aaina -d <path>\n" " aaina -t <tag>[,<tag>,....]\n"); return EXIT_FAILURE; } show = aaina_slide_show_get_default (); clutter_group_add (CLUTTER_GROUP (stage), CLUTTER_ACTOR (show)); clutter_actor_set_position (CLUTTER_ACTOR (show), 0, 0); clutter_actor_set_size (CLUTTER_ACTOR (show), CLUTTER_STAGE_WIDTH (), CLUTTER_STAGE_HEIGHT ()) ; clutter_actor_show_all (CLUTTER_ACTOR (show)); g_object_set (G_OBJECT (show), "library", library, NULL); clutter_actor_show_all (stage); /*clutter_actor_set_scale (stage, 0.25, 0.25);*/ g_signal_connect (G_OBJECT (stage), "key-release-event", G_CALLBACK (on_key_release_event), (gpointer)stage); timeline = clutter_timeline_new (60, 30); alpha = clutter_alpha_new_full (timeline, alpha_sine_inc_func, NULL, NULL); behave = aaina_behave_new (alpha, (AainaBehaveAlphaFunc)spin_me, (gpointer)stage); clutter_actor_set_rotation (stage, CLUTTER_Y_AXIS, 0, CLUTTER_STAGE_WIDTH ()/2, 0, CLUTTER_STAGE_HEIGHT ()); g_timeout_add (120000, (GSourceFunc)im_spinning_around, timeline); clutter_main (); return EXIT_SUCCESS; }
int main (int argc, char *argv[]) { ClutterTimeline *timeline; ClutterAlpha *alpha; ClutterBehaviour *scaler_1, *scaler_2; ClutterActor *stage; ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff }; SuperOH *oh; gint i; GError *error; #ifdef REQ_NON_COMPOSITION Window xwin; Atom non_comp_atom; Display *dpy; int one = 1; #endif error = NULL; clutter_init_with_args (&argc, &argv, NULL, super_oh_entries, NULL, &error); if (error) { g_warning ("Unable to initialise Clutter:\n%s", error->message); g_error_free (error); exit (1); } stage = clutter_stage_get_default (); clutter_actor_set_size (stage, 800, 600); clutter_stage_set_title (CLUTTER_STAGE (stage), "Actors Test"); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); #ifdef REQ_NON_COMPOSITION /* request non-composited mode */ clutter_stage_fullscreen (stage); xwin = clutter_x11_get_stage_window (stage); dpy = XOpenDisplay(NULL); non_comp_atom = XInternAtom(dpy, "_HILDON_NON_COMPOSITED_WINDOW", False); XChangeProperty (dpy, xwin, non_comp_atom, XA_INTEGER, 32, PropModeReplace, (unsigned char *) &one, 1); printf ("stage win is %lx\n", xwin); XSync (dpy, False); #endif oh = g_new(SuperOH, 1); /* Create a timeline to manage animation */ timeline = clutter_timeline_new (360, 60); /* num frames, fps */ g_object_set (timeline, "loop", TRUE, NULL); /* have it loop */ /* fire a callback for frame change */ g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), oh); /* Set up some behaviours to handle scaling */ alpha = clutter_alpha_new_full (timeline, CLUTTER_ALPHA_SINE, NULL, NULL); scaler_1 = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 1.0, 1.0); scaler_2 = clutter_behaviour_scale_new (alpha, 1.0, 1.0, 0.5, 0.5); /* create a new group to hold multiple actors in a group */ oh->group = clutter_group_new(); oh->hand = g_new (ClutterActor*, n_hands); for (i = 0; i < n_hands; i++) { gint x, y, w, h; gint radius = get_radius (); /* Create a texture from file, then clone in to same resources */ if (i == 0) { if ((oh->hand[i] = clutter_texture_new_from_file ("redhand.png", &error)) == NULL) { g_error ("image load failed: %s", error->message); exit (1); } } else oh->hand[i] = clutter_clone_texture_new (CLUTTER_TEXTURE(oh->hand[0])); /* Place around a circle */ w = clutter_actor_get_width (oh->hand[0]); h = clutter_actor_get_height (oh->hand[0]); x = CLUTTER_STAGE_WIDTH () / 2 + radius * cos (i * M_PI / (n_hands / 2)) - w / 2; y = CLUTTER_STAGE_HEIGHT () / 2 + radius * sin (i * M_PI / (n_hands / 2)) - h / 2; clutter_actor_set_position (oh->hand[i], x, y); clutter_actor_move_anchor_point_from_gravity (oh->hand[i], CLUTTER_GRAVITY_CENTER); /* Add to our group group */ clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]); #if 1 /* FIXME: disabled as causes drift? - see comment above */ if (i % 2) clutter_behaviour_apply (scaler_1, oh->hand[i]); else clutter_behaviour_apply (scaler_2, oh->hand[i]); #endif } /* Add the group to the stage */ clutter_container_add_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (oh->group)); /* Show everying ( and map window ) */ clutter_actor_show (stage); g_signal_connect (stage, "button-press-event", G_CALLBACK (input_cb), oh); g_signal_connect (stage, "key-release-event", G_CALLBACK (input_cb), oh); /* and start it */ clutter_timeline_start (timeline); clutter_main (); g_free (oh->hand); g_free (oh); return 0; }