Esempio n. 1
0
int
main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *screen;
  CheeseCamera *camera;
  ClutterActor *stage;
  ClutterActor *texture;

  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return EXIT_FAILURE;

  if (!cheese_init (&argc, &argv))
    return EXIT_FAILURE;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
  g_signal_connect (G_OBJECT (window), "delete-event",
                    G_CALLBACK (delete_callback), NULL);

  screen = gtk_clutter_embed_new ();
  stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (screen));
  texture = clutter_texture_new ();

  clutter_actor_set_size (texture, 400, 300);
  clutter_actor_add_child (stage, texture);

  gtk_widget_show (screen);
  clutter_actor_show (texture);

  camera = cheese_camera_new (CLUTTER_TEXTURE (texture), NULL, 640, 480);

  cheese_camera_setup (camera, NULL, NULL);

  gtk_container_add (GTK_CONTAINER (window), screen);

  gtk_widget_show_all (window);

  cheese_camera_play (camera);

  g_timeout_add_seconds (5, (GSourceFunc) (time_cb), camera);

  gtk_main ();

  return EXIT_SUCCESS;
}
Esempio n. 2
0
/**
 * cheese_gtk_init:
 * @argc: pointer to the argument list count
 * @argv: pointer to the argument list vector
 *
 * Initialize libcheese-gtk, by initializing Clutter, GStreamer and GTK+. This
 * automatically calls cheese_init(), initializing libcheese.
 *
 * Returns: %TRUE if the initialization was successful, %FALSE otherwise
 */
gboolean
cheese_gtk_init (int *argc, char ***argv)
{
    ClutterInitError error;

#ifdef GDK_WINDOWING_X11
    XInitThreads ();
#endif

    error = gtk_clutter_init (argc, argv);

    if (error != CLUTTER_INIT_SUCCESS)
        return FALSE;

    if (!cheese_init (argc, argv))
        return FALSE;

    return TRUE;
}