seed r101 - in trunk: examples libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r101 - in trunk: examples libseed
- Date: Tue, 4 Nov 2008 05:38:35 +0000 (UTC)
Author: racarr
Date: Tue Nov 4 05:38:35 2008
New Revision: 101
URL: http://svn.gnome.org/viewvc/seed?rev=101&view=rev
Log:
Convert functions passed as arguments with dlsym. I.e.
Clutter.alpha_sine_inc. Makes clutter effects work.
Modified:
trunk/examples/clutter.js
trunk/libseed/seed-types.c
Modified: trunk/examples/clutter.js
==============================================================================
--- trunk/examples/clutter.js (original)
+++ trunk/examples/clutter.js Tue Nov 4 05:38:35 2008
@@ -16,25 +16,27 @@
"LemonChiffon2",
"RosyBrown3"];
-stage = new Clutter.Stage();
-timeline = new Clutter.Timeline({fps:60, num_frames:600});
+var stage = new Clutter.Stage();
+var timeline = new Clutter.Timeline({fps:60, num_frames:300});
stage.show_all();
-rheight = stage.height/(colors.length);
-width = stage.width;
-rectangles = new Array(colors.length);
+var rheight = stage.height/(colors.length);
+var width = stage.width;
+var rectangles = new Array(colors.length);
-black = Clutter.Color._new();
+var black = Clutter.Color._new();
Clutter.color_parse("Black", black);
+var white = Clutter.Color._new();
+Clutter.color_parse("White", white);
stage.color = black;
for (var i = 0; i < colors.length; i++)
{
- c = Clutter.Color._new();
+ var c = Clutter.Color._new();
Clutter.color_parse(colors[i],c);
- r = new Clutter.Rectangle();
+ var r = new Clutter.Rectangle();
r.width = r.height = rheight;
r.color = c;
r.y = i * r.height+r.height/2;
@@ -47,7 +49,7 @@
}
timeline.signal_new_frame.connect(
- function(frame_num)
+ function(timeline, frame_num)
{
for (var i = 0; i < colors.length; i++)
{
@@ -55,6 +57,34 @@
rectangles[i].rotation_angle_z += 1;
}
});
+timeline.signal_completed.connect(
+ function(timeline)
+ {
+
+ var text = new Clutter.Label({text:"Congratulations!",
+ font_name:"Bitstream Vera Sans 40"});
+ var fadeline = new Clutter.Timeline({fps:60, num_frames:200});
+ var effect = Clutter.EffectTemplate._new(timeline,
+ Clutter.sine_inc_func);
+
+ text.show();
+ stage.add_actor(text);
+ text.color = white;
+
+ text.anchor_x = text.width/2;
+ text.anchor_y = text.height/2;
+
+ text.x = stage.width/2;
+ text.y = stage.height/2;
+
+ (Clutter.effect_fade(effect,text,0)).signal_completed.connect(
+ Clutter.main_quit);
+ for (i in rectangles)
+ {
+ Clutter.effect_fade(effect, rectangles[i], 0);
+ }
+ });
+
timeline.start();
Clutter.main();
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Tue Nov 4 05:38:35 2008
@@ -20,6 +20,7 @@
#include "seed-private.h"
#include <string.h>
+#include <dlfcn.h>
JSClassRef gobject_class;
JSClassRef gobject_method_class;
@@ -270,6 +271,27 @@
arg->v_pointer = seed_struct_get_pointer(value);
break;
}
+ else if (interface_type == GI_INFO_TYPE_CALLBACK)
+ {
+ GIFunctionInfo * info =
+ JSObjectGetPrivate((JSObjectRef)value);
+ const gchar * symbol = g_function_info_get_symbol(info);
+ gchar * error;
+ void * fp;
+
+ dlerror();
+ fp = (void *)dlsym(0, symbol);
+ if ((error = dlerror()) != NULL)
+ {
+ g_critical("dlerror: %s \n", error);
+ }
+ else
+ {
+ arg->v_pointer = fp;
+ break;
+ }
+
+ }
}
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]