crappy-coder / astrid

2D Game Engine and Application Framework
2 stars 0 forks source link

improve Timer, use performance.now #17

Closed fabslab closed 9 years ago

fabslab commented 9 years ago

Uses performance.now instead of Date.now and it also runs at 60fps in Chrome now, thanks to the line: this.lastTickTimestamp = t - (delta % this.interval); changed from just this.lastTickTimestamp = t; It's kinda hard to understand why that helps but I found it and the explanation at http://codetheory.in/controlling-the-frame-rate-with-requestanimationframe/

fixes https://github.com/JTJustCodes/astrid/issues/15