Commits

Reid van Melle committed 6325da7

c-versions to be converted into new examples

Comments (0)

Files changed (3)

examples/behave.ml

+(*
+  #include <clutter/clutter.h>
+
+int
+main (int argc, char *argv[])
+{
+  ClutterTimeline  *timeline;
+  ClutterBehaviour *behave;
+  ClutterAlpha     *alpha;
+  ClutterActor     *stage, *actor;
+  GdkPixbuf        *pixbuf;
+
+  clutter_init (&argc, &argv);
+
+  stage = clutter_stage_get_default ();
+
+  pixbuf = gdk_pixbuf_new_from_file ("ohpowers.png", NULL);
+
+  actor  = clutter_texture_new_from_pixbuf (pixbuf);
+
+  clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
+
+  timeline = clutter_timeline_new (100, 26);    /* num frames, fps */
+  g_object_set(timeline, "loop", TRUE, NULL);   /* have it loop */
+
+  /* Set an alpha func to power behaviour */
+  alpha = clutter_alpha_new_full (timeline,
+                                  CLUTTER_ALPHA_SINE,
+                                  NULL, NULL);
+
+  behave = clutter_behaviour_ellipse_new (alpha, 
+					  200,   /* center x */
+					  200,   /* center y */
+					  400,   /* width */
+					  300,   /* height */
+					  0.0,   /* angle begin */
+					  360.0, /* angle end */
+					  0.0    /* tilt */ );
+
+  clutter_behaviour_apply (behave, actor);
+
+  behave = clutter_behaviour_opacity_new (alpha, 0, 0xff);
+
+  clutter_behaviour_apply (behave, actor);
+
+
+  clutter_actor_show_all (stage);
+
+  clutter_timeline_start (timeline);
+
+  clutter_main();
+
+  return 0;
+}
+
+#if 0
+
+
+#endif
+*)

examples/effects.ml

+(*
+  #include <clutter/clutter.h>
+
+int
+main (int argc, char *argv[])
+{
+  ClutterEffectTemplate *effect_template;
+  ClutterActor          *stage, *actor;
+  GdkPixbuf             *pixbuf;
+
+  clutter_init (&argc, &argv);
+  stage = clutter_stage_get_default ();
+  pixbuf = gdk_pixbuf_new_from_file ("ohpowers.png", NULL);
+  actor  = clutter_texture_new_from_pixbuf (pixbuf);
+  clutter_actor_set_position (actor, 200, 100);
+  clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
+  effect_template 
+    = clutter_effect_template_new (clutter_timeline_new (60, 60), 
+				   CLUTTER_ALPHA_RAMP_INC);
+  clutter_effect_scale (effect_template,
+			actor,
+			1.0,
+			4.0,
+			CLUTTER_GRAVITY_CENTER,
+			NULL,
+			NULL);
+  clutter_actor_show_all (stage);
+  clutter_main();
+  return 0;
+}
+*)

examples/timeline.ml

+(*
+#include <clutter/clutter.h>
+
+void
+on_new_frame (ClutterTimeline *timeline, 
+	      gint             frame_num, 
+	      gpointer         data)
+{
+  ClutterActor *actor = CLUTTER_ACTOR(data);
+
+  clutter_actor_rotate_z (actor, (gdouble)frame_num, 
+			  clutter_actor_get_width (actor)/2,
+			  clutter_actor_get_height (actor)/2);
+}
+
+int
+main (int argc, char *argv[])
+{
+  ClutterTimeline *timeline;
+  ClutterActor    *stage, *actor;
+  GdkPixbuf       *pixbuf;
+  clutter_init (&argc, &argv);
+  stage = clutter_stage_get_default ();
+  pixbuf = gdk_pixbuf_new_from_file ("ohpowers.png", NULL);
+  actor  = clutter_texture_new_from_pixbuf (pixbuf);
+  clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
+  clutter_actor_set_position (actor, 100, 100);
+  timeline = clutter_timeline_new (360, 60);    /* num frames, fps */
+  g_object_set(timeline, "loop", TRUE, NULL);   /* have it loop */
+  g_signal_connect (timeline, "new-frame", G_CALLBACK (on_new_frame), actor);
+  clutter_actor_show_all (stage);
+  clutter_timeline_start (timeline);
+  clutter_main();
+  return 0;
+}
+*)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.