-
-
Save kg/3702486 to your computer and use it in GitHub Desktop.
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| </head> | |
| <body onload="onLoad()"> | |
| <script type="text/javascript"> | |
| var jsilConfig = { | |
| printStackTrace: false, | |
| xna: 4, | |
| manifests: [ | |
| "YOUR APPLICATION NAME.exe", | |
| "Content/YOUR APPLICATION NAME.contentproj" | |
| ], | |
| }; | |
| </script> | |
| <script src="../Libraries/JSIL.js" type="text/javascript"></script> | |
| <canvas id="canvas" width="1280" height="720"> | |
| </canvas><br> | |
| <div id="log"></div> | |
| <script type="text/javascript"> | |
| function runMain () { | |
| // We can't invoke Main() since it disposes the Game immediately, breaking everything. | |
| var asm = JSIL.GetAssembly("YOUR APPLICATION NAME", true); | |
| var game = new asm.YOURNAMESPACE.YOURGAME(); | |
| game.Run(); | |
| }; | |
| </script> | |
| </body> | |
| </html> |
I can't get run anything...
It crashs at 29 var game = new asm.YOURNAMESPACE.YOURGAME();
TypeError: asm.MapGame is undefined
I created an index.html page in the same directory as the JSIL produced .js files using the index.html above (substituting for , and also putting my application name in where appropriate. I then copied the Library directory to the same directory as the index.html and JSIL produced .js file. I also changed <script src="../Libraries/JSIL.js" type="text/javascript"></script> to <script src="Libraries/JSIL.js" type="text/javascript"></script>.
When I load the index.html with Internet explorer (so I can use the built in debugger), I get "Object doesn't support property or method 'GetAssembly' when it tries to run the line
var $asm00 = JSIL.GetAssembly("memulator, Version=1.2.0.4, Culture=neutral, PublicKeyToken=null");
from manifest.js file to load the first Assembly.
Does anyone have a gist that actually was tested and works?
Default XNA projects usually are of the form:
"YOUR APPLICATION NAME"
and
"YOUR APPLICATION NAMEContent"
so I suggest that you update line 14 of the above Gist to:
"Content/YOUR CONTENT PROJECT NAME.contentproj"
not naming the content project manifest correctly here leads to no content being loaded. This was highly confusing as I am very new to javascript - it took me a while to track it down with a javascript console.