index.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Impact Game</title>
  5. <style type="text/css">
  6. html,body {
  7. background-color: #333;
  8. color: #fff;
  9. font-family: helvetica, arial, sans-serif;
  10. margin: 0;
  11. padding: 0;
  12. font-size: 12pt;
  13. }
  14. #canvas {
  15. position: absolute;
  16. left: 0;
  17. right: 0;
  18. top: 0;
  19. bottom: 0;
  20. margin: auto;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <canvas id="canvas"></canvas>
  26. <script type="text/javascript">
  27. function getParameterByName(name, url) {
  28. if (!url) url = window.location.href;
  29. name = name.replace(/[\[\]]/g, "\\$&");
  30. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  31. results = regex.exec(url);
  32. if (!results) return null;
  33. if (!results[2]) return '';
  34. return decodeURIComponent(results[2].replace(/\+/g, " "));
  35. }
  36. var gameToPlay = getParameterByName("game") || "lights";
  37. var sampleGames = {
  38. memory: {
  39. id: "1",
  40. folderName: "memory",
  41. includePath: "memory",
  42. displayName: "Memory Level 3",
  43. backgroundColor: "#8577B3",
  44. backgroundHighlightColor: "#9688C4",
  45. complementColor: "#43B6CF",
  46. complementHighlightColor: "#54C7DF",
  47. gameIcon: "common/spr-icons-categories-lg.png",
  48. gameIconIndex: 2
  49. },
  50. missingpiece: {
  51. id: "2",
  52. folderName: "missingpiece",
  53. includePath: "missingpiece",
  54. displayName: "Missing Piece Level 1",
  55. backgroundColor: "#55AAAA",
  56. backgroundHighlightColor: "#66BBBB",
  57. complementColor: "#228888",
  58. complementHighlightColor: "#339999",
  59. gameIcon: "common/spr-icons-categories-lg.png",
  60. gameIconIndex: 8
  61. },
  62. swarm: {
  63. id: "3",
  64. folderName: "swarm",
  65. includePath: "swarm",
  66. displayName: "Swarm Level 2",
  67. backgroundColor: "#42AC71",
  68. backgroundHighlightColor: "#53BD82",
  69. complementColor: "#315B43",
  70. complementHighlightColor: "#426C54",
  71. gameIcon: "common/spr-icons-categories-lg.png",
  72. gameIconIndex: 11
  73. },
  74. lights: {
  75. id: 4,
  76. folderName: "lights",
  77. includePath: "lights",
  78. displayName: "Lights Level 2",
  79. backgroundColor: "#26455C",
  80. backgroundHighlightColor: "#37566D",
  81. complementColor: "#73E9FF",
  82. complementHighlightColor: "#84F1FF",
  83. gameIcon: "common/spr-icons-categories-lg.png",
  84. gameIconIndex: 5
  85. }
  86. };
  87. var pmGameData = sampleGames[gameToPlay];
  88. pmGameData.assetPath = "./";
  89. pmGameData.start = function() {};
  90. pmGameData.finish = function() {};
  91. var script = document.createElement('script');
  92. script.onload = function () {
  93. //do stuff with the script
  94. };
  95. script.src = "./"+gameToPlay+"/game-baked.js";
  96. document.head.appendChild(script);
  97. </script>
  98. </body>
  99. </html>