@@ -25,6 +25,8 @@ function RequestAnimationFrame (game)
2525 */
2626 this . isRunning = false ;
2727
28+ this . tick = 0 ;
29+
2830 var vendors = [
2931 'ms' ,
3032 'moz' ,
@@ -48,19 +50,25 @@ function RequestAnimationFrame (game)
4850 */
4951 this . timeOutID = null ;
5052
53+ var _this = this ;
54+
5155 // timestamp = DOMHighResTimeStamp
52- this . step = function ( timestamp )
56+ var step = function ( timestamp )
5357 {
54- this . timeOutID = window . requestAnimationFrame ( this . step ) ;
58+ _this . tick = timestamp ;
5559
56- this . game . update ( timestamp ) ;
60+ _this . timeOutID = window . requestAnimationFrame ( step ) ;
61+
62+ _this . game . update ( timestamp ) ;
5763 } ;
5864
59- this . stepTimeout = function ( )
65+ var stepTimeout = function ( )
6066 {
61- this . game . update ( Date . now ( ) ) ;
67+ _this . tick = Date . now ( ) ;
68+
69+ // _this.game.update(_this.tick);
6270
63- this . timeOutID = window . setTimeout ( this . stepTimeout , this . game . time . timeToCall ) ;
71+ // _this .timeOutID = window.setTimeout(stepTimeout, _this .game.time.timeToCall);
6472 } ;
6573
6674 /**
@@ -75,13 +83,13 @@ function RequestAnimationFrame (game)
7583 {
7684 this . isSetTimeOut = true ;
7785
78- this . timeOutID = window . setTimeout ( this . stepTimeout , 0 ) ;
86+ this . timeOutID = window . setTimeout ( stepTimeout , 0 ) ;
7987 }
8088 else
8189 {
8290 this . isSetTimeOut = false ;
8391
84- this . timeOutID = window . requestAnimationFrame ( this . step ) ;
92+ this . timeOutID = window . requestAnimationFrame ( step ) ;
8593 }
8694 } ;
8795
0 commit comments