2008-04-01 Matthew Allum <mallum@openedhand.com>
authorMatthew Allum <mallum@openedhand.com>
Tue, 1 Apr 2008 16:35:36 +0000 (16:35 +0000)
committerMatthew Allum <mallum@openedhand.com>
Tue, 1 Apr 2008 16:35:36 +0000 (16:35 +0000)
        * examples/Makefile.am:
        * examples/gtk-clutter-multistage.c:
        Add a *very* simple multiple stage example.

ChangeLog
examples/Makefile.am
examples/gtk-clutter-multistage.c [new file with mode: 0644]

index 19f3abd..8f75b5e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-01  Matthew Allum  <mallum@openedhand.com>
+
+       * examples/Makefile.am:
+       * examples/gtk-clutter-multistage.c:
+        Add a *very* simple multiple stage example.
+
 2008-04-01  Neil Roberts  <neil@o-hand.com>
 
        * examples/gtk-clutter-test.c (main): Moved the
index 79fa135..8e4855e 100644 (file)
@@ -1,4 +1,4 @@
-noinst_PROGRAMS = gtk-clutter-test gtk-clutter-events
+noinst_PROGRAMS = gtk-clutter-test gtk-clutter-events gtk-clutter-multistage
 
 INCLUDES = \
        -I$(srcdir) \
@@ -22,4 +22,12 @@ gtk_clutter_events_LDADD = \
        $(CLUTTER_LIBS) \
        $(GTK_LIBS)
 
+gtk_clutter_multistage_DEPENDENCIES = \
+       $(top_builddir)/clutter-gtk/libclutter-gtk-0.7.la
+gtk_clutter_multistage_SOURCES = gtk-clutter-multistage.c
+gtk_clutter_multistage_LDADD = \
+       $(top_builddir)/clutter-gtk/libclutter-gtk-0.7.la \
+       $(CLUTTER_LIBS) \
+       $(GTK_LIBS)
+
 EXTRA_DIST = redhand.png
diff --git a/examples/gtk-clutter-multistage.c b/examples/gtk-clutter-multistage.c
new file mode 100644 (file)
index 0000000..3288990
--- /dev/null
@@ -0,0 +1,60 @@
+#include <gtk/gtk.h>
+#include <clutter/clutter.h>
+#include <clutter-gtk/gtk-clutter-embed.h>
+
+int
+main (int argc, char *argv[])
+{
+  ClutterTimeline *timeline;
+  ClutterActor    *stage1, *stage2, *tex1, *tex2;
+  ClutterColor     stage_color = { 0x61, 0x64, 0x8c, 0xff };
+  GtkWidget       *window, *clutter1, *clutter2;
+  GtkWidget       *label, *button, *vbox;
+  GdkPixbuf       *pixbuf;
+  gint             i;
+  ClutterColor     col1 = { 0xff, 0xff, 0xff, 0xff };
+  ClutterColor     col2 = { 0, 0, 0, 0xff };
+
+  gtk_init (&argc, &argv);
+  gtk_clutter_init (&argc, &argv);
+
+  pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL);
+
+  if (!pixbuf)
+    g_error("pixbuf load failed");
+
+  tex1 = clutter_texture_new_from_pixbuf (pixbuf);
+  tex2 = clutter_clone_texture_new (tex1);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  g_signal_connect (window, "destroy",
+                    G_CALLBACK (gtk_main_quit), NULL);
+
+  vbox = gtk_vbox_new (FALSE, 6);
+  gtk_container_add (GTK_CONTAINER (window), vbox);
+
+  clutter1 = gtk_clutter_embed_new ();
+  gtk_widget_set_size_request (clutter1, 320, 240);
+  stage1 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter1));
+  clutter_stage_set_color (CLUTTER_STAGE(stage1), &col1);
+  clutter_stage_add (stage1, tex1); 
+
+  gtk_container_add (GTK_CONTAINER (vbox), clutter1);
+
+  clutter2 = gtk_clutter_embed_new ();
+  gtk_widget_set_size_request (clutter2, 320, 240);
+  stage2 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter2));
+
+  clutter_stage_set_color (CLUTTER_STAGE(stage2), &col2);
+  clutter_stage_add (stage2, tex2);
+
+  gtk_container_add (GTK_CONTAINER (vbox), clutter2);
+
+  gtk_widget_show_all (window);
+  clutter_actor_show_all (stage1); 
+  clutter_actor_show_all (stage2); 
+
+  gtk_main();
+
+  return 0;
+}