diff nodejs/testcase.js @ 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 6ddc8b42188f
children d950487bd9f9
line wrap: on
line diff
--- a/nodejs/testcase.js	Wed Aug 11 17:37:39 2010 +0800
+++ b/nodejs/testcase.js	Wed Aug 11 17:38:44 2010 +0800
@@ -10,7 +10,6 @@
 var coord = mb_rt.coord_new(root);
 sys.puts("coord matrix: " + 
 	 [coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]]);
-sys.puts('coord='+coord);
 
 /* Testcase for image shapes */
 var img = mb_rt.image_new(10, 10, 50, 50);
@@ -55,7 +54,7 @@
 var i = 0;
 setInterval(function() {
 	var deg = (i++) * 0.1;
-	coord[2] = (i % 20) * 10;
+	coord[2] = (i % 40) * 5;
 	mb_rt.redraw_changed();
 	mb_rt.flush();
     }, 20);
@@ -65,7 +64,15 @@
 var observer;
 /* Mouse button pressed */
 observer = root.mouse_event.add_event_observer(4, function(evt) {
+	var c = 1 - (i % 40) / 40;
+	sys.puts(c);
+
 	sys.puts("mouse " + evt.x + " " + evt.y);
+	sys.puts(c);
+	sys.puts(paint.set_color);
+	paint.set_color(c, 1, 1, 1);
+	mb_rt.redraw_changed();
+	mb_rt.flush();
     });
 
 var kbobserver;