demo.js 963 B

12345678910111213141516171819202122232425262728293031323334
  1. window.console = window.console || { log: function () { } };
  2. Array.prototype.forEach = Array.prototype.each = Array.prototype.forEach || function (callback) {
  3. for (var i = 0; i < this.length; i++) {
  4. callback(this[i], i, this);
  5. }
  6. };
  7. var renderTypeDict = {
  8. 'canvas': 'canvas',
  9. 'dom': 'dom',
  10. 'webgl': 'webgl',
  11. 'forceFlash': 'flash'
  12. };
  13. // var renderType = location.search.slice(1);
  14. // if (!renderTypeDict[renderType]) {
  15. // renderType = 'canvas';
  16. // }
  17. var renderType = 'canvas';
  18. var winWidth = window.innerWidth || document.documentElement.clientWidth;
  19. var winHeight = window.innerHeight || document.documentElement.clientHeight;
  20. var gameContainer = document.getElementById("game-container");
  21. var stageWidth = window.stageWidth || winWidth;
  22. var stageHeight = 480;// window.stageHeight || (winHeight - gameContainer.offsetTop);
  23. gameContainer.style.height = stageHeight + 'px';
  24. gameContainer.style.width = stageWidth + 'px';