aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorhwc4872012-03-16 15:17:53 -0700
committerhwc4872012-03-16 15:17:53 -0700
commit55b2231d7badec16990b63ef1b6c770ef1e6fc25 (patch)
tree62d555dc627d30be8d7aec49e36935baca4e7fc3 /assets
parent2ac5db3bb1bcee887d6dd742e6c0273abb5366bd (diff)
downloadninja-55b2231d7badec16990b63ef1b6c770ef1e6fc25.tar.gz
Supporting new and old GL data formats.
Diffstat (limited to 'assets')
-rw-r--r--assets/canvas-runtime.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index dd4ad6f9..adff0e8c 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -37,15 +37,25 @@ function CanvasDataManager()
37 for (var i=0; i<nWorlds; i++) 37 for (var i=0; i<nWorlds; i++)
38 { 38 {
39 var importStr = value[i]; 39 var importStr = value[i];
40 var jObj = JSON.parse( importStr );
41 40
42 var id = jObj.id; 41 // there should be some version information in
43 if (id) 42 // the form of 'v0.0;' Pull that off. (the trailing ';' should
43 // be in the first 24 characters).
44 var index = importStr.indexOf( ';' );
45 if ((importStr[0] === 'v') && (index < 24))
44 { 46 {
45 var canvas = this.findCanvasWithID( id, root ); 47 // JSON format. pull off the version info
46 if (canvas) 48 importStr = importStr.substr( index+1 );
49
50 var jObj = JSON.parse( importStr );
51 var id = jObj.id;
52 if (id)
47 { 53 {
48 new GLRuntime( canvas, jObj, assetPath ); 54 var canvas = this.findCanvasWithID( id, root );
55 if (canvas)
56 {
57 new GLRuntime( canvas, jObj, assetPath );
58 }
49 } 59 }
50 } 60 }
51 } 61 }