Created
December 7, 2015 00:54
-
-
Save quantumpotato/19788003148b47ea423d to your computer and use it in GitHub Desktop.
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
loop() { | |
this.now = Date.now(); | |
var delta = this.now - this.last; | |
this.last = this.now; | |
this.dt = this.dt + delta; | |
if (this.dt < this.rate) { | |
window.requestAnimationFrame(this.loop.bind(this)); | |
return; | |
} else { | |
this.game.loop(); | |
this.draw(); | |
this.dt = this.dt - this.rate; | |
} | |
this.game.loopKeyboardInput(this.key_pressed_map); | |
window.requestAnimationFrame(this.loop.bind(this)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment