Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/src/js/jgame.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 39 by tsugehara, Thu Feb 28 16:55:00 2013 UTC revision 41 by tsugehara, Fri Mar 1 09:39:55 2013 UTC
# Line 2491  var Game = (function () { Line 2491  var Game = (function () {
2491      return Game;      return Game;
2492  })();  })();
2493  ;  ;
 var FrameGame = (function (_super) {  
     __extends(FrameGame, _super);  
     function FrameGame(width, height, fps) {  
         _super.call(this, width, height);  
         this._fps = fps;  
         this.targetFps = Math.floor(1000 / this._fps);  
         Timeline.prototype.isFrameBased = true;  
     }  
     FrameGame.prototype.main = function () {  
         var _this = this;  
         var fps_stack = new Array();  
         var _main = function () {  
             var t = window.getTime();  
             if(_this.tick > (t + 10000) || (_this.tick + 10000) < t) {  
                 _this.tick = t - 1;  
                 _this.renderTick = t - _this.targetFps;  
                 _this.refresh();  
             }  
             for(var i = 0; i < _this.timers.length; i++) {  
                 _this.timers[i].tryFire(t);  
             }  
             if((_this.renderTick + _this.targetFps) <= t) {  
                 if(_this.fps) {  
                     fps_stack.push(t);  
                     if(fps_stack.length == 20) {  
                         _this.fps.innerHTML = Math.round(20000 / (t - fps_stack[0])).toString();  
                         fps_stack = [];  
                     }  
                 }  
                 if(_this.enterFrame) {  
                     _this.enterFrame.fire();  
                 }  
                 _this.update.fire(t - _this.tick);  
                 _this.tick = t;  
                 if(_this.render) {  
                     _this.render.fire();  
                 }  
                 _this.renderer.render();  
                 _this.renderTick = t;  
             }  
             if(!_this._exit) {  
                 window.requestAnimationFrame(_main);  
             }  
         };  
         this.tick = window.getTime();  
         this.renderTick = this.tick - this.targetFps;  
         window.requestAnimationFrame(_main);  
     };  
     return FrameGame;  
 })(Game);  
2494  var ImageFilter;  var ImageFilter;
2495  (function (ImageFilter) {  (function (ImageFilter) {
2496      var FilterChain = (function () {      var FilterChain = (function () {

Legend:
Removed from v.39  
changed lines
  Added in v.41

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26