main.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // file main.js
  3. // Copyright (c) 2012 Frédéric J. Rézeau. All rights reserved.
  4. ///////////////////////////////////////////////////////////////////////////////
  5. // Provides requestAnimationFrame in a cross browser way. @author paulirish / http://paulirish.com/
  6. if (!window.requestAnimationFrame) {
  7. window.requestAnimationFrame = (function () {
  8. "use strict";
  9. return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
  10. function (callback) {
  11. window.setTimeout(callback, 1000 / 60);
  12. };
  13. })();
  14. }
  15. // Retrieve the game language.
  16. function getLanguage() {
  17. "use strict";
  18. return AquaThiefGame.language;
  19. }
  20. function startGame() {
  21. "use strict";
  22. // Retrieve the language.
  23. // "en" (english)
  24. // "es" (spanish)
  25. // "fr" (french)
  26. // "it" (italian)
  27. // "pt" (portuguese)
  28. // "tr" (turkish)
  29. // "ru" (russian)
  30. // "de" (german)
  31. AquaThiefGame.language = SG.lang; //SG_Hooks.getLanguage(['en', 'es', 'fr', 'it', 'pt', 'tr', 'ru', 'de', 'th']);
  32. // Resizing events.
  33. SG_Hooks.setOrientationHandler(resetDisplay); // Provide a function f, that handles orientation changes for your game.
  34. SG_Hooks.setResizeHandler(resetDisplay); // Provide the function f, that handles screen resizing for your game.
  35. // Initialize the game.
  36. AquaThiefGame.initialize();
  37. }
  38. // Document has loaded.
  39. $(document).on("pageinit", function () {
  40. "use strict";
  41. $(".ui-loader").hide();
  42. // Disable scrollbars.
  43. $("body").css("overflow", "hidden");
  44. // Remove outlines.
  45. $("body > *").css("outline", "none");
  46. });
  47. // Window is resized.
  48. $(window).resize(function () {
  49. "use strict";
  50. resetDisplay();
  51. });
  52. function resetDisplay() {
  53. "use strict";
  54. // Reset the display.
  55. AquaThiefGame.resetDisplay();
  56. };
  57. // Prevent scrolling when moving.
  58. $(document).on("touchmove", function (e) {
  59. "use strict";
  60. e.preventDefault();
  61. });