Mercurial > MadButterfly
comparison nodejs/mbapp.js @ 853:13e0953c3fb3 abs_n_rel_center
backup transform matrix when create a new coord
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 20 Sep 2010 22:43:43 +0800 |
parents | 7eb5421a9864 |
children | eff2f580b536 |
comparison
equal
deleted
inserted
replaced
852:0027379c962e | 853:13e0953c3fb3 |
---|---|
3 var mbfly = require("mbfly"); | 3 var mbfly = require("mbfly"); |
4 var svg = require("./svg"); | 4 var svg = require("./svg"); |
5 var sys = require("sys"); | 5 var sys = require("sys"); |
6 var ldr = mbfly.img_ldr_new("."); | 6 var ldr = mbfly.img_ldr_new("."); |
7 | 7 |
8 function _decorate_mb_rt(mb_rt) { | |
9 mb_rt._mbapp_saved_coord_new = mb_rt.coord_new; | |
10 mb_rt.coord_new = function(parent) { | |
11 var coord; | |
12 | |
13 coord = this._mbapp_saved_coord_new(parent); | |
14 coord._mbapp_saved_mtx = [coord[0], coord[1], coord[2], | |
15 coord[3], coord[4], coord[5]]; | |
16 return coord; | |
17 }; | |
18 } | |
8 | 19 |
9 app=function(display, w, h) { | 20 app=function(display, w, h) { |
10 var self = this; | 21 var self = this; |
11 var mb_rt; | 22 var mb_rt; |
12 | 23 |
16 w = 720; | 27 w = 720; |
17 if(typeof h == "undefined") | 28 if(typeof h == "undefined") |
18 h = 480; | 29 h = 480; |
19 | 30 |
20 mb_rt = this.mb_rt = new mbfly.mb_rt(display, w, h); | 31 mb_rt = this.mb_rt = new mbfly.mb_rt(display, w, h); |
32 _decorate_mb_rt(mb_rt); | |
21 var background = mb_rt.rect_new(0, 0, 720, 480, 0, 0); | 33 var background = mb_rt.rect_new(0, 0, 720, 480, 0, 0); |
22 var paint = mb_rt.paint_color_new(1, 1, 1, 1); | 34 var paint = mb_rt.paint_color_new(1, 1, 1, 1); |
23 paint.fill(background); | 35 paint.fill(background); |
24 mb_rt.root.add_shape(background); | 36 mb_rt.root.add_shape(background); |
25 | 37 |