Skip to content

Commit

Permalink
Remove deltaSeconds from the tick method.
Browse files Browse the repository at this point in the history
  • Loading branch information
jverkoey committed Mar 1, 2010
1 parent ffd2b36 commit 3de7d6e
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions dev/engine/class.scene.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ Breeze.Engine.Scene = function(options) {
*/ */
this.lastLayer_ = 0; this.lastLayer_ = 0;


/**
* @type {Date}
* @private
*/
this.lastTick_ = new Date();

/** /**
* @type {boolean} * @type {boolean}
* @private * @private
Expand All @@ -90,13 +84,11 @@ Breeze.Engine.Scene = function(options) {
}; };


Breeze.Engine.Scene.GOAL_FPS = 40; // The desired frames per second. Breeze.Engine.Scene.GOAL_FPS = 40; // The desired frames per second.
Breeze.Engine.Scene.MAX_TIME_DELTA = 50; // The maximum time delta for a given tick.


/** /**
* Kick off the animation timer for the scene. * Kick off the animation timer for the scene.
*/ */
Breeze.Engine.Scene.prototype.runScene = function() { Breeze.Engine.Scene.prototype.runScene = function() {
this.lastTick_ = new Date();
this.timeout_ = window.setInterval( this.timeout_ = window.setInterval(
Breeze.Engine.Scene.prototype.animate.bind(this), Breeze.Engine.Scene.prototype.animate.bind(this),
parseInt(1000 / Breeze.Engine.Scene.GOAL_FPS, 10)); parseInt(1000 / Breeze.Engine.Scene.GOAL_FPS, 10));
Expand Down Expand Up @@ -139,12 +131,7 @@ Breeze.Engine.Scene.prototype.drawScene = function() {
* Callback for the animation event. * Callback for the animation event.
*/ */
Breeze.Engine.Scene.prototype.animate = function() { Breeze.Engine.Scene.prototype.animate = function() {
var currentTick = new Date(); this.tick();
var deltaMS = Math.min(Breeze.Engine.Scene.MAX_TIME_DELTA, currentTick.getTime() - this.lastTick_);

this.tick(deltaMS / 1000);

this.lastTick_ = currentTick;


Breeze.Engine.Scene.prototype.drawScene.call(this); Breeze.Engine.Scene.prototype.drawScene.call(this);


Expand Down

0 comments on commit 3de7d6e

Please sign in to comment.