summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMatthew Allum <mallum@openedhand.com>2008-04-01 16:35:36 +0000
committerMatthew Allum <mallum@openedhand.com>2008-04-01 16:35:36 +0000
commitc13b2e4a3e15176a7e76ec4e80ed918aa7bc8a73 (patch)
tree69af3cd394f0e7c2076b9f380176df3a3c25221c /examples
parent29900a94dd4d903107ef630010d8580901d47cd9 (diff)
downloadclutter-gtk-c13b2e4a3e15176a7e76ec4e80ed918aa7bc8a73.tar.gz
2008-04-01 Matthew Allum <mallum@openedhand.com>
* examples/Makefile.am: * examples/gtk-clutter-multistage.c: Add a *very* simple multiple stage example.
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am10
-rw-r--r--examples/gtk-clutter-multistage.c60
2 files changed, 69 insertions, 1 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 79fa135..8e4855e 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -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
index 0000000..3288990
--- /dev/null
+++ b/examples/gtk-clutter-multistage.c
@@ -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;
+}