Mercurial > MadButterfly
annotate nodejs/mbapp.js @ 874:ec8d7e9c9642 abs_n_rel_center
Decorate mb_rt created by mb_rt_with_win()
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 24 Sep 2010 23:47:01 +0800 |
parents | 881efcd8a18f |
children | 6c8e4e1f3a39 |
rev | line source |
---|---|
822
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
820
diff
changeset
|
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- |
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
820
diff
changeset
|
2 // vim: sw=4:ts=8:sts=4 |
716 | 3 var mbfly = require("mbfly"); |
4 var svg = require("./svg"); | |
730 | 5 var sys = require("sys"); |
716 | 6 var ldr = mbfly.img_ldr_new("."); |
784
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
7 |
854
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
8 function _reverse(m1) { |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
9 var rev = new Array(1, 0, 0, 0, 1, 0); |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
10 var m = new Array(m1[0], m1[1], m1[2], m1[3], m1[4], m1[5]); |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
11 |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
12 rev[3] = -m[3] / m[0]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
13 m[3] = 0; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
14 m[4] += rev[3] * m[1]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
15 m[5] += rev[3] * m[2]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
16 |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
17 rev[1] = -m[1] / m[4]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
18 rev[0] += rev[1] * rev[3]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
19 m[1] = 0; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
20 m[2] += rev[1] * m[5]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
21 |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
22 rev[2] = -m[2]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
23 rev[5] = -m[5]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
24 |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
25 rev[0] = rev[0] / m[0]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
26 rev[1] = rev[1] / m[0]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
27 rev[2] = rev[2] / m[0]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
28 |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
29 rev[3] = rev[3] / m[4]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
30 rev[4] = rev[4] / m[4]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
31 rev[5] = rev[5] / m[4]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
32 |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
33 return rev; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
34 } |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
35 |
853
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
36 function _decorate_mb_rt(mb_rt) { |
854
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
37 var coord; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
38 |
853
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
39 mb_rt._mbapp_saved_coord_new = mb_rt.coord_new; |
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
40 mb_rt.coord_new = function(parent) { |
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
41 var coord; |
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
42 |
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
43 coord = this._mbapp_saved_coord_new(parent); |
854
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
44 coord.type = "coord"; |
853
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
45 coord._mbapp_saved_mtx = [coord[0], coord[1], coord[2], |
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
46 coord[3], coord[4], coord[5]]; |
854
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
47 coord._mbapp_saved_rev_mtx = _reverse(coord._mbapp_saved_mtx); |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
48 coord.parent = parent; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
49 coord._mbapp_saved_add_shape = coord.add_shape; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
50 coord.add_shape = function(shape) { |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
51 var coord; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
52 |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
53 this._mbapp_saved_add_shape(shape); |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
54 shape.parent = this; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
55 } |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
56 |
853
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
57 return coord; |
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
58 }; |
854
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
59 |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
60 /* |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
61 * Decorate root coord |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
62 */ |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
63 coord = mb_rt.root; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
64 coord.type = "coord"; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
65 coord._mbapp_saved_mtx = [coord[0], coord[1], coord[2], |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
66 coord[3], coord[4], coord[5]]; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
67 coord._mbapp_saved_rev_mtx = _reverse(coord._mbapp_saved_mtx); |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
68 coord._mbapp_saved_add_shape = coord.add_shape; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
69 coord.add_shape = function(shape) { |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
70 var coord; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
71 |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
72 this._mbapp_saved_add_shape(shape); |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
73 shape.parent = this; |
eff2f580b536
Use accessor to return bbox values
Thinker K.F. Li <thinker@codemud.net>
parents:
853
diff
changeset
|
74 } |
853
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
75 } |
784
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
76 |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
77 app=function(display, w, h) { |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
78 var self = this; |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
79 var mb_rt; |
716 | 80 |
784
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
81 if(typeof display == "undefined") |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
82 display = ":0.0"; |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
83 if(typeof w == "undefined") |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
84 w = 720; |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
85 if(typeof h == "undefined") |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
86 h = 480; |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
87 |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
88 mb_rt = this.mb_rt = new mbfly.mb_rt(display, w, h); |
853
13e0953c3fb3
backup transform matrix when create a new coord
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
89 _decorate_mb_rt(mb_rt); |
784
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
90 var background = mb_rt.rect_new(0, 0, 720, 480, 0, 0); |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
91 var paint = mb_rt.paint_color_new(1, 1, 1, 1); |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
92 paint.fill(background); |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
93 mb_rt.root.add_shape(background); |
37a1bd3e3ce1
mbapp accept arguments for display, width and height
Thinker K.F. Li <thinker@codemud.net>
parents:
762
diff
changeset
|
94 |
730 | 95 this.mb_rt.kbevents.add_event_observer(exports.EVT_KB_PRESS, function(evt) { self.KeyPress(evt);}); |
96 this.keymap={}; | |
97 this.onKeyPress = null; | |
716 | 98 } |
99 app.prototype.loadSVG=function(fname) { | |
721
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
100 svg.loadSVG(this.mb_rt,this.mb_rt.root,fname); |
716 | 101 } |
102 | |
730 | 103 app.prototype.KeyPress = function(evt) { |
820 | 104 sys.puts(evt.sym); |
730 | 105 if (this.onKeyPress) this.onKeyPress(evt.sym); |
106 if (evt.sym in this.keymap) this.keymap[evt.sym](); | |
107 } | |
108 | |
716 | 109 app.prototype.loop=function() { |
721
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
110 this.mb_rt.redraw_all(); |
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
111 this.mb_rt.flush(); |
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
112 } |
762 | 113 app.prototype.update=function() { |
114 this.mb_rt.redraw_all(); | |
115 this.mb_rt.flush(); | |
116 } | |
721
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
117 app.prototype.get=function(name) { |
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
118 return this.mb_rt.mbnames[name]; |
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
119 } |
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
120 app.prototype.addKeyboardListener=function(type,f) { |
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
121 return this.mb_rt.kbevents.add_event_observer(type,f); |
716 | 122 } |
724 | 123 app.prototype.refresh=function() { |
124 this.mb_rt.redraw_all(); | |
125 this.mb_rt.flush(); | |
126 } | |
730 | 127 app.prototype.dump=function() { |
128 sys.puts(this.onKeyPress); | |
129 } | |
130 | |
131 app.prototype.addKeyListener=function(key,f) { | |
731
1719484ed15d
Make the argument key can be an array to register multiple keys.
wycc
parents:
730
diff
changeset
|
132 if (typeof(key) == 'number') |
1719484ed15d
Make the argument key can be an array to register multiple keys.
wycc
parents:
730
diff
changeset
|
133 this.keymap[key] = f; |
1719484ed15d
Make the argument key can be an array to register multiple keys.
wycc
parents:
730
diff
changeset
|
134 else { |
1719484ed15d
Make the argument key can be an array to register multiple keys.
wycc
parents:
730
diff
changeset
|
135 for(k in key) { |
1719484ed15d
Make the argument key can be an array to register multiple keys.
wycc
parents:
730
diff
changeset
|
136 this.keymap[k] = f; |
1719484ed15d
Make the argument key can be an array to register multiple keys.
wycc
parents:
730
diff
changeset
|
137 } |
1719484ed15d
Make the argument key can be an array to register multiple keys.
wycc
parents:
730
diff
changeset
|
138 } |
730 | 139 } |
716 | 140 |
872
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
141 var app_with_win = function(display, win) { |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
142 var self = this; |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
143 var mb_rt; |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
144 var background; |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
145 var paint; |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
146 |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
147 if(typeof display == "undefined" || typeof win == "undefined") |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
148 throw "Invalid argument"; |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
149 |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
150 mb_rt = this.mb_rt = new mbfly.mb_rt_with_win(display, win); |
874
ec8d7e9c9642
Decorate mb_rt created by mb_rt_with_win()
Thinker K.F. Li <thinker@codemud.net>
parents:
873
diff
changeset
|
151 _decorate_mb_rt(mb_rt); |
872
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
152 background = mb_rt.rect_new(0, 0, 720, 480, 0, 0); |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
153 paint = mb_rt.paint_color_new(1, 1, 1, 1); |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
154 paint.fill(background); |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
155 mb_rt.root.add_shape(background); |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
156 |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
157 this.mb_rt.kbevents. |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
158 add_event_observer(exports.EVT_KB_PRESS, |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
159 function(evt) { self.KeyPress(evt); }); |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
160 this.keymap = {}; |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
161 this.onKeyPress = null; |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
162 } |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
163 |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
164 app_with_win.prototype = app.prototype; |
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
165 |
716 | 166 exports.app=app; |
872
bcc63b20d5c6
mbapp.js support to create an application with existed window
Thinker K.F. Li <thinker@codemud.net>
parents:
827
diff
changeset
|
167 exports.app_with_win = app_with_win; |
721
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
168 |
01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
wycc
parents:
716
diff
changeset
|
169 // Put all key definition here |
820 | 170 exports.KEY_LEFT = 0xff51; |
729
299ed9319dc6
Use key symbols instead of keycodes.
Thinker K.F. Li <thinker@branda.to>
parents:
724
diff
changeset
|
171 exports.KEY_UP = 0xff52; |
820 | 172 exports.KEY_RIGHT = 0xff53; |
729
299ed9319dc6
Use key symbols instead of keycodes.
Thinker K.F. Li <thinker@branda.to>
parents:
724
diff
changeset
|
173 exports.KEY_DOWN = 0xff54; |
820 | 174 exports.KEY_ENTER = 0xff0d; |
724 | 175 exports.EVT_ANY=0; |
176 exports.EVT_MOUSE_OVER=1; | |
177 exports.EVT_MOUSE_OUT=2; | |
178 exports.EVT_MOUSE_MOVE=3; | |
179 exports.EVT_MOUSE_BUT_PRESS4; | |
180 exports.EVT_MOUSE_BUT_RELEASE=5 | |
181 exports.EVT_KB_PRESS=6; | |
182 exports.EVT_KB_RELEASE=7; | |
183 exports.EVT_PROGM_COMPLETE=8; | |
184 exports.EVT_RDMAN_REDRAW=9; | |
185 exports.EVT_MONITOR_ADD=10; | |
186 exports.EVT_MONITOR_REMOVE=11; | |
187 exports.EVT_MONITOR_FREE=12; | |
188 exports.EVT_MOUSE_MOVE_RAW=13; | |
827 | 189 exports.ldr = ldr; |