/jsil.org/demos/Tetris/Tetris.html

http://github.com/kevingadd/JSIL · HTML · 74 lines · 64 code · 10 blank · 0 comment · 0 complexity · 04b1bda6ce34ce206b4ffa28ecd93b7a MD5 · raw file

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>XNA4 Tetris Game</title>
  5. <link rel="stylesheet" href="../Common/browser.css">
  6. <link rel="stylesheet" href="tetris.css">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  8. </head>
  9. <body onload="onLoad()">
  10. <script type="text/javascript">
  11. var jsilConfig = {
  12. printStackTrace: false,
  13. webgl2d: true,
  14. xna: 4,
  15. manifests: [
  16. "tetris.exe",
  17. "Content/tetrisContent.contentproj"
  18. ],
  19. showProgressBar: true,
  20. showStats: true,
  21. scriptRoot: "",
  22. libraryRoot: "../Libraries/",
  23. fileRoot: "",
  24. contentRoot: "Content/"
  25. };
  26. </script>
  27. <script src="../Libraries/JSIL.js" type="text/javascript"></script>
  28. <canvas id="canvas" width="1024" height="768">
  29. </canvas><br>
  30. <div id="welcomeMessage">
  31. <p align="center"><a href="http://jsil.org/"><img src="http://jsil.org/images/jsil_48px.png" alt="JSIL logo" border="0"></a></p>
  32. <p>This demo is a simple XNA 4.0 game, compiled from C# to JavaScript using <A href="http://jsil.org/">JSIL, my open-source C# to JavaScript compiler</a>. It should run in any browser that supports HTML5 and a modern version of JavaScript, no plugins required.</p>
  33. <p>You can get the source code to this demo from <a href="https://github.com/ttocs7/tetris">the author's page on GitHub</a>.</p>
  34. <p align="center">To begin playing, click the <b>Load Game</b> button below.</p>
  35. </div>
  36. <button id="loadButton">Load Game</button>
  37. <div id="log"><center><i>Left/right arrows to move piece. Up to rotate piece. Space to drop piece.</i></center><br></div>
  38. <script type="text/javascript">
  39. var assetsToLoad = [
  40. ];
  41. function runMain () {
  42. try {
  43. document.getElementById("welcomeMessage").setAttribute("style", "display: none");
  44. } catch (ex) {
  45. }
  46. // We can't invoke Main() since it disposes the Game immediately, breaking everything.
  47. var asm = JSIL.GetAssembly("tetris, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
  48. var game = new asm.tetris.Game1();
  49. game.Run();
  50. };
  51. </script>
  52. <script type="text/javascript">
  53. var _gaq = _gaq || [];
  54. _gaq.push(['_setAccount', 'UA-6375004-2']);
  55. _gaq.push(['_setDomainName', '.luminance.org']);
  56. _gaq.push(['_trackPageview']);
  57. (function() {
  58. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  59. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  60. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  61. })();
  62. </script>
  63. </body>
  64. </html>