From: Matthew Allum Date: Tue, 1 Apr 2008 16:35:36 +0000 (+0000) Subject: 2008-04-01 Matthew Allum X-Git-Url: http://git.maemo.org/git/?a=commitdiff_plain;h=c13b2e4a3e15176a7e76ec4e80ed918aa7bc8a73;p=clutter-gtk 2008-04-01 Matthew Allum * examples/Makefile.am: * examples/gtk-clutter-multistage.c: Add a *very* simple multiple stage example. --- diff --git a/ChangeLog b/ChangeLog index 19f3abd..8f75b5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-01 Matthew Allum + + * examples/Makefile.am: + * examples/gtk-clutter-multistage.c: + Add a *very* simple multiple stage example. + 2008-04-01 Neil Roberts * examples/gtk-clutter-test.c (main): Moved the 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 +#include +#include + +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; +}