grumpytoad / Canvas/NME (http://flashsandy.org/haxe)

A re-implementation of NME for use with the HTML5 canvas element on the javascript target. Currently implemented against Neash. This project is no longer actively maintained against the current neash version.

Clone this repository (size: 107.4 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/grumpytoad/canvas-nme/
commit 4: eaa04f69420f
parent 2: 1ec5dc794dfc
branch: default
Solves having UInt for flash->javascript unsigned integer.
Niel Drummond / grumpytoad
15 months ago

Changed (Δ20.8 KB):

raw changeset »

UInt.hx (1 lines added, 0 lines removed)

canvas/Manager.hx (6 lines added, 1 lines removed)

canvas/display/.Graphics.hx.swp (binary file changed)

canvas/display/BitmapData.hx (26 lines added, 8 lines removed)

Up to file-list UInt.hx:

1
typedef UInt = Int;

Up to file-list canvas/Manager.hx:

@@ -156,7 +156,7 @@ class Manager
156
156
																									isWindowless:false
157
157
																									}, 
158
158
             events:{onError:null, 
159
                     onLoad:function () { cb(); } }, 
159
                     onLoad:function () { Manager.resolveQueue(); trace( Manager.getScreen().getHost().content ); cb(); } }, 
160
160
                     context:null});
161
161
162
162
		//js.Lib.window.alert("wait");
@@ -181,9 +181,14 @@ class Manager
181
181
			var loop = __queue.keys();
182
182
			for ( xaml in loop ) {
183
183
					var ctx = Manager.getScreen();
184
										try {
184
185
					var r = ctx.getHost().content.createFromXaml( xaml );
186
					trace( xaml );
185
187
					var func = __queue.get( xaml );
186
188
					func(r);
189
										} catch (e:Dynamic) {
190
												throw "Failed to parse Xaml node '" + xaml + "', upon initialization";
191
										}
187
192
			}
188
193
189
194
			queueResolved = true;

Up to file-list canvas/display/.Graphics.hx.swp:

-
Diff size exceeds threshold (20.0 KB)view raw?

Up to file-list canvas/display/BitmapData.hx:

@@ -8,6 +8,8 @@ import neash.events.Event;
8
8
import neash.geom.Matrix;
9
9
import neash.geom.ColorTransform;
10
10
11
import haxe.xml.Check;
12
11
13
class BitmapData implements IBitmapDrawable
12
14
{
13
15
   private var mTextureBuffer:Dynamic;
@@ -20,17 +22,33 @@ class BitmapData implements IBitmapDrawa
20
22
                       ?inFillColour:Int) {
21
23
						var el = js.Lib.document.getElementById( Type.getClassName( Type.getClass( this ) ) );
22
24
						if ( el != null ) {
25
								/*
23
26
#if silverlight
24
								var self = this;
25
								var cb = function (r:Dynamic) :Void {
26
										self.mTextureBuffer = r;
27
										trace( r.width );
28
										self.width = r.width;
29
										self.height = r.height;
30
										canvas.Manager.getScreen().children.add( r );
27
28
								trace( el );
29
								trace( el.getAttribute('width') );
30
								var xaml : String = '<ImageBrush ImageSource="' + el.getAttribute( 'src' ) + '"></ImageBrush>';
31
32
								if ( canvas.Manager.getScreen() == null ) {
33
										var self = this;
34
										var cb = function (r:Dynamic) :Void {
35
												self.mTextureBuffer = r;
36
												canvas.Manager.getScreen().children.add( r );
37
										}
38
										canvas.Manager.queueXaml( xaml, cb );
39
								} else {
40
										var ctx = canvas.Manager.getScreen();
41
										try {
42
												var r = ctx.getHost().content.createFromXaml( xaml );
43
												mTextureBuffer = r;
44
												m_Width = el.getAttribute('width')
45
										} catch (e:Dynamic) {
46
												throw "Failed to parse Xaml node '" + el.innerHTML + "'";
47
										}
31
48
								}
32
								canvas.Manager.queueXaml( el.innerHTML, cb );
49
33
50
#else
51
								*/
34
52
								mTextureBuffer = el;
35
53
#end
36
54
						}	else if (inWidth<1 || inHeight<1) {