diff --git a/js/initialization.js b/js/initialization.js index d5469b3..8db224f 100644 --- a/js/initialization.js +++ b/js/initialization.js @@ -1,4 +1,7 @@ -$(document).ready(initialize); + +$(document).ready(function(){ + initialize(); +}); function initialize(a) { //view.js @@ -183,6 +186,16 @@ function initialize(a) { ga('create', 'UA-51272720-1', 'teamsnowman.github.io'); ga('send', 'pageview'); + + document.addEventListener("pause", handlePause, false); + document.addEventListener("backbutton", handlePause, false); + document.addEventListener("menubutton", handlePause, false); //menu button on android + } +} + +function handlePause() { + if (gameState == 1 || gameState == 2) { + pause() } } diff --git a/js/render.js b/js/render.js index 6282339..e057926 100644 --- a/js/render.js +++ b/js/render.js @@ -52,7 +52,7 @@ function render() { settings.hexWidth = settings.baseHexWidth * settings.scale; settings.blockHeight = settings.baseBlockHeight * settings.scale; - if ((MainHex.ct < 400 && (gameState !== 0) && !MainHex.playThrough) || gameState == -1) { + if ((MainHex.ct < 400 && (gameState !== 0) && !MainHex.playThrough)) { if (MainHex.ct > 350) { ctx.globalAlpha = (50 - (MainHex.ct - 350))/50; } diff --git a/js/view.js b/js/view.js index d45f2b3..4f86874 100644 --- a/js/view.js +++ b/js/view.js @@ -131,12 +131,9 @@ function showText(text){ pt.className = 'unfaded'; if (text == 'paused') { - $(pt).css('margin-top','-5%'); if (settings.platform == 'mobile') { text = 'pausedMobile'; } - } else { - $(pt).css('margin-top','-10%'); } pt.innerHTML = messages[text];