Merge branch 'gh-pages' of http://github.com/hextris/hextris into gh-pages

This commit is contained in:
Garrett Finucane 2014-07-22 16:47:48 -04:00
commit c118f24049
3 changed files with 45 additions and 36 deletions

View file

@ -64,7 +64,7 @@
<a href = 'url'>Found a bug? Go here</a>
</p>
</div>
<div onClick="showHelp()" id="openSideBar" class = 'helpText'><i class="fa fa-info-circle fa-lg"></i> <i class="fa fa-arrow-left"><b> Help</b></i></div>
<div id="openSideBar" class = 'helpText'><i class="fa fa-info-circle fa-lg"></i> <i class="fa fa-arrow-left"><b> Help</b></i></div>
<div id="overlay" class="faded"></div>
<div id = 'pauseBtn'><i class="fa fa-pause fa-2x"></i></div>
<div id = 'restartBtn'><i class="fa fa-refresh fa-2x"></i></div>

View file

@ -157,39 +157,14 @@ function initialize(a) {
};
$('#startBtn').off();
$('#startBtn').on('touchstart mousedown', function(){
if (!canRestart) return false;
if ($('#helpScreen').is(':visible')) {
$('#helpScreen').fadeOut(150, "linear");
}
if (importing == 1) {
init(1);
} else {
resumeGame();
}
setTimeout(function(){
if(settings.platform == "mobile"){
try {
document.body.removeEventListener('touchstart', handleTap ,false);
} catch (e) {
}
document.body.addEventListener('touchstart', handleTap, false);
}
else {
try {
document.body.removeEventListener('mousedown', handleClick ,false);
} catch (e) {
}
document.body.addEventListener('mousedown', handleClick, false);
}
}, 1);
});
if (settings.platform == 'mobile') {
$('#startBtn').on('touchstart',startBtnHandler);
$('.helpText').on('touchstart',showHelp);
} else {
$('#startBtn').on('mousedown',startBtnHandler);
$('.helpText').on('mousedown',showHelp);
}
document.addEventListener('touchmove', function(e) { e.preventDefault(); }, false);
$(window).resize(scaleCanvas);
@ -210,6 +185,41 @@ function initialize(a) {
}
}
function startBtnHandler() {
if (!canRestart) return false;
if ($('#helpScreen').is(':visible')) {
$('#helpScreen').fadeOut(150, "linear");
}
if (importing == 1) {
init(1);
} else {
resumeGame();
}
setTimeout(function(){
if(settings.platform == "mobile"){
try {
document.body.removeEventListener('touchstart', handleTap ,false);
} catch (e) {
}
document.body.addEventListener('touchstart', handleTap, false);
}
else {
try {
document.body.removeEventListener('mousedown', handleClick ,false);
} catch (e) {
}
document.body.addEventListener('mousedown', handleClick, false);
}
}, 1);
}
function handlePause() {
if (gameState == 1 || gameState == 2) {
pause();

View file

@ -44,7 +44,7 @@ function resumeGame() {
importing = 0;
startTime = Date.now();
setTimeout(function(){
if (gameState == 1 || gameState == 2) {
if ((gameState == 1 || gameState == 2) && !$('#helpScreen').is(':visible')) {
$('.helpText').fadeOut(150, "linear");
}
}, 7000);
@ -235,7 +235,6 @@ function animLoop() {
$('#helpScreen').fadeOut(150, "linear");
}
if ($('.helpText').is(":visible")) $('.helpText').fadeOut(150, "linear");
if ($('#pauseBtn').is(':visible')) $('#pauseBtn').fadeOut(150, "linear");
if ($('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear");
@ -325,7 +324,7 @@ function checkGameOver() {
function showHelp(){
if (gameState == 1 || gameState == 2) {
pause(1);
pause();
}
$('#helpScreen').fadeToggle(150, "linear");