pop.init.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. POP.init = function() {
  2. POP.Ua.init();
  3. if (window.screen.availWidth > 640) {
  4. // could add in css transform here for larger screen sizes
  5. // then need to recalibrate mouse / touch offsets
  6. // POP.ua.scale = 1.5;
  7. }
  8. POP.container = document.getElementById('SF_Game');
  9. POP.canvas = document.getElementsByTagName('canvas')[0];
  10. POP.canvas.width = POP.W;
  11. POP.canvas.height = POP.H;
  12. POP.ctx = POP.canvas.getContext('2d');
  13. POP.offset = {
  14. top: POP.container.offsetTop,
  15. left: POP.container.offsetLeft
  16. };
  17. POP.textLayer = document.getElementById('textLayer');
  18. POP.inputBox = document.getElementById('inputBox');
  19. POP.stats = new Stats();
  20. POP.stats.domElement.style.position = 'absolute';
  21. POP.stats.domElement.style.right = '0px';
  22. POP.stats.domElement.style.bottom = '0px';
  23. if (window.location.hash === '#debug') {
  24. POP.debug = true;
  25. }
  26. if (POP.debug) {
  27. document.body.appendChild( POP.stats.domElement );
  28. }
  29. POP.lives = POP.MAX_LIVES;
  30. POP.wave.total = POP.W / POP.wave.r + 1;
  31. POP.bonus = new POP.Starfish();
  32. POP.input();
  33. POP.router();
  34. };