Spencer, Matthew wrote:
> Hi Guys
>  
> Not sure if this should be posted here or to the clutter lists, but I'll
> try here first :)
>  
> I am trying to create a clutter app using vala and am having a few
> issues.  The biggest one seems to be with the clutter-json bindings.
> How mature are these supposed to be, because the simplest application is
> failing to compile, and looking at the vapi files I would have to agree.
>  
> I would like to modify the generated vapi files to make this work,
> however at the top is an 'autogenerated' warning, but I cannot find
> anywhere in the vala build that will allow me to recreate these bindings
> (there also seems to be nothing in the 1.0.8 source release of clutter).

Yes, it seems that 'clutter-1.0.vapi' was accidentally included without
the metadata information an in a very raw state without any tweaking.

Ali Sabil (asabil) has started a launchpad project as a new beginning for
Clutter bindings, this time with metadata:
http://bazaar.launchpad.net/~asabil/+junk/clutter-vala-1.0/files

At the same time I was assembling a patch with lots of fixes for the raw
'clutter-1.0.vapi' without knowing about his project:
https://bugzilla.gnome.org/show_bug.cgi?id=598778

What needs to be done now is to merge this patch into his project, but in
the form of metadata. I wanted to do that but I didn't find enough time
during the last weeks. Of course, any help is appreciated.

I have attached a Vala port of a little demo program that would work with
my patch.


Best regards,

Frederik
using Clutter;

class ClutterDemo {

	private Stage stage;
	private Rectangle[] rectangles;

	const string[] colors = {
		"blanched almond",
		"OldLace",
		"MistyRose",
		"White",
		"LavenderBlush",
		"CornflowerBlue",
		"chartreuse",
		"chocolate",
		"light coral",
		"medium violet red",
		"LemonChiffon2",
		"RosyBrown3"
	};

	public ClutterDemo () {
		stage = Stage.get_default ();

		rectangles = new Rectangle[colors.length];
		stage.hide.connect (Clutter.main_quit);

		create_rectangles ();

		stage.color = Color () { alpha = 255 };
		stage.show_all ();
	}

	private void create_rectangles () {
		for (int i = 0; i < colors.length; i++) {
			var r = new Rectangle ();

			r.width = r.height = stage.height / colors.length;
			r.color = Color.from_string (colors[i]);
			r.anchor_gravity = Gravity.CENTER;
			r.y = i * r.height + r.height / 2;

			stage.add_actor (r);

			rectangles[i] = r;
		}
	}

	public void start () {
		var animations = new Animation[rectangles.length];
		for (int i = 0; i < rectangles.length; i++) {
			animations[i] = rectangles[i].animate (
			                          AnimationMode.LINEAR, 5000,
			                          "x", stage.width / 2,
			                          "rotation-angle-z", 500.0);
			animations[i].timeline.start ();
		}
		animations[animations.length - 1].timeline.completed.connect (() => {
			var text = new Text.full ("Bitstream Vera Sans 40",
			                          "Congratulations!",
			                          Color.from_string ("white"));

			text.set_anchor_point_from_gravity (Gravity.CENTER);
			text.x = stage.width / 2;
			text.y = -text.height;	// Off-stage
			stage.add_actor (text);
			text.show ();
			var text_anim = text.animate (AnimationMode.EASE_OUT_BOUNCE, 3000,
			                              "y", stage.height / 2);
			text_anim.timeline.start ();

			for (int i = 0; i < rectangles.length; i++) {
				animations[i] = rectangles[i].animate (
				        AnimationMode.EASE_OUT_BOUNCE, 3000,
				        "x", Random.next_double () * stage.width,
				        "y", Random.next_double () * stage.height / 2
				                                   + stage.height / 2,
				        "rotation-angle-z", rectangles[i].rotation_angle_z,
				        "opacity", 0.0);

				animations[i].timeline.start ();
			}
		});
	}
}

void main (string[] args) {
	Clutter.init (ref args);
	var demo = new ClutterDemo ();
	demo.start ();
	Clutter.main ();
}

_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to