diff nodejs/paints.cc @ 699:0b98bdc53215

Add binding for color changing of paint_color_t in JS
author Thinker K.F. Li <thinker@branda.to>
date Wed, 11 Aug 2010 17:38:44 +0800
parents da12923a789a
children 163f0d9e6382
line wrap: on
line diff
--- a/nodejs/paints.cc	Wed Aug 11 17:37:39 2010 +0800
+++ b/nodejs/paints.cc	Wed Aug 11 17:38:44 2010 +0800
@@ -50,6 +50,22 @@
 	rdman_shape_changed(rdman, sh);
 }
 
+static void
+xnjsmb_paint_color_set_color(paint_t *paint, Handle<Object> self,
+			     float r, float g, float b, float a) {
+    Handle<Value> rt_v;
+    Handle<Object> rt_o;
+    redraw_man_t *rdman;
+
+    rt_v = GET(self, "mbrt");
+    rt_o = rt_v->ToObject();
+    rdman = xnjsmb_rt_rdman(rt_o);
+
+    paint_color_set(paint, r, g, b, a);
+
+    rdman_paint_changed(rdman, paint);
+}
+
 #include "paints-inc.h"
 
 /*! \defgroup xnjsmb_paints_cons Constructor of paints
@@ -131,14 +147,8 @@
 	xnjsmb_auto_paint_color_init();
 	xnjsmb_auto_paint_image_init();
 	
-	/* xnjsmb_init_paints(); */
 	init_flag = 1;
     }
-    /*
-    rt_proto_temp = rt_temp->PrototypeTemplate();
-    SET(rt_proto_temp, "paint_color_new", xnjsmb_paint_color_new_temp);
-    SET(rt_proto_temp, "paint_image_new", xnjsmb_paint_image_new_temp);
-    */
 }
 
 /* @} */