home *** CD-ROM | disk | FTP | other *** search
- class com.neodelight.std.Timer
- {
- var config;
- var t;
- var msPerFrame;
- var smoothing;
- function Timer(config)
- {
- _global.dt = 1;
- this.config = config;
- this.t = getTimer();
- this.msPerFrame = !this.config.timerFps ? 33.33333333333333 : 1000 / this.config.timerFps;
- this.smoothing = Math.min(1,Math.max(0,com.neodelight.std.XMath.toNumber(this.config.timerSmoothing)));
- }
- function update()
- {
- var _loc3_ = getTimer();
- _global.dt = this.smoothing * _global.dt + (1 - this.smoothing) * (_loc3_ - this.t) / this.msPerFrame;
- this.t = _loc3_;
- }
- }
-