changeset 716:72abb4154936

Add mbapp module
author wycc
date Sat, 14 Aug 2010 00:06:00 +0800
parents 752263ca0ed2
children b822b1912d67
files nodejs/mbapp.js nodejs/testsvg.js
diffstat 2 files changed, 27 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nodejs/mbapp.js	Sat Aug 14 00:06:00 2010 +0800
@@ -0,0 +1,23 @@
+var mbfly = require("mbfly");
+var svg = require("./svg");
+var mb_rt = new mbfly.mb_rt(":0.0", 720,480);
+var ldr = mbfly.img_ldr_new(".");
+var background = mb_rt.rect_new(0, 0, 720, 480, 0, 0);
+var paint = mb_rt.paint_color_new(1, 1, 1, 1);
+paint.fill(background);
+mb_rt.root.add_shape(background);
+
+app=function() {
+    this.mb_rt = mb_rt;
+
+}
+app.prototype.loadSVG=function(fname) {
+    svg.loadSVG(mb_rt,mb_rt.root,fname);
+}
+
+app.prototype.loop=function() {
+    mb_rt.redraw_all();
+    mb_rt.flush();
+}
+
+exports.app=app;
--- a/nodejs/testsvg.js	Fri Aug 13 23:39:12 2010 +0800
+++ b/nodejs/testsvg.js	Sat Aug 14 00:06:00 2010 +0800
@@ -1,12 +1,6 @@
 var svg = require("./svg");
-var mbfly = require("mbfly");
-var mb_rt = new mbfly.mb_rt(":0.0", 720,480);
-var ldr = mbfly.img_ldr_new(".");
-var background = mb_rt.rect_new(0, 0, 720, 480, 0, 0);
-var paint = mb_rt.paint_color_new(1, 1, 1, 1);
-paint.fill(background);
-mb_rt.root.add_shape(background);
+var mbapp = require("./mbapp");
 
-svg.loadSVG(mb_rt,mb_rt.root,"test.svg");
-mb_rt.redraw_all();
-mb_rt.flush();
+app = new mbapp.app();
+app.loadSVG("test.svg");
+app.loop();