forked from gabrielecirulli/2048
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into best-score
Conflicts: index.html js/application.js js/html_actuator.js
- Loading branch information
Showing
9 changed files
with
459 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(function() { | ||
var lastTime = 0; | ||
var vendors = ['webkit', 'moz']; | ||
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { | ||
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; | ||
window.cancelAnimationFrame = | ||
window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; | ||
} | ||
|
||
if (!window.requestAnimationFrame) { | ||
window.requestAnimationFrame = function(callback, element) { | ||
var currTime = new Date().getTime(); | ||
var timeToCall = Math.max(0, 16 - (currTime - lastTime)); | ||
var id = window.setTimeout(function() { callback(currTime + timeToCall); }, | ||
timeToCall); | ||
lastTime = currTime + timeToCall; | ||
return id; | ||
}; | ||
} | ||
|
||
if (!window.cancelAnimationFrame) { | ||
window.cancelAnimationFrame = function(id) { | ||
clearTimeout(id); | ||
}; | ||
} | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
document.addEventListener("DOMContentLoaded", function () { | ||
// Wait till the browser is ready to render the game (avoids glitches) | ||
window.requestAnimationFrame(function () { | ||
new GameManager(4, KeyboardInputManager, HTMLActuator, LocalScoreManager); | ||
}); | ||
// Wait till the browser is ready to render the game (avoids glitches) | ||
window.requestAnimationFrame(function () { | ||
new GameManager(4, KeyboardInputManager, HTMLActuator, LocalScoreManager); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.