Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!Engine){
- throw new Error("Engine is not loaded");
- }
- Engine.DebugEngine = (()=>{
- class DebugEngine extends Engine{
- constructor(){
- super();
- this._frames = 0;
- this._fpsClock = new Engine.StopWatch();
- }
- Update(){
- let ms = this._fpsClock.ElapsedMilliseconds;
- let s = ms/1000;
- if(this._fpsClock.ElapsedMilliseconds >= 1000){
- console.log("DebugEngine:::FPS = ", this._frames/s);
- this._frames = 0;
- this._fpsClock.Restart();
- }
- this._frames++;
- super.Update();
- }
- Run(){
- super.Run();
- this._fpsClock.Start();
- }
- Stop(){
- super.Stop();
- this._fpsClock.Stop();
- this._fpsClock.Reset();
- }
- }
- return DebugEngine;
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement