Gln.Engine=GE.Klass(GE.Engine,{$name:"Gln.Engine",tClock:null,gRenderer:null,gContainer:null,gScene:null,tControls:null,tEffects:null,gRenderFn:null,tAssignedRenderer:null,gScreen:{w:0,h:0,aspect:0},initialize:function(a){this.$super();"undefined"===typeof a&&(a="game-container",GE.jQuery("<div>").attr("id",a).appendTo("body"));0!=a.indexOf("#")&&(a="#"+a);this.gContainer=GE.jQuery(a);this.trigger(GE.Events.Engine.READY)},start:function(a){var b=Gln.defaults;this.tClock=new THREE.Clock;this.gScene=
new PIXI.Stage(6750105);var c=b.View.size;if("string"===typeof c)if("screen"==c)this.gScreen.w=window.innerWidth,this.gScreen.h=window.innerHeight;else throw"Invalid size";else this.gScreen.x=c[0],this.gScreen.y=c[1];this.gScreen.aspect=this.gScreen.w/this.gScreen.h;this.gRenderer=PIXI.autoDetectRenderer(400,300);this.gRenderFn=this.__render;this.gContainer.append(this.gContainer.view);b.DEBUG&&Stats&&(b=new Stats,b.domElement.style.position="absolute",b.domElement.style.bottom="0px",b.domElement.style.zIndex=
100,this.gContainer.append(b.domElement),this.on("stats",b,GE.Events.Engine.POSUPDATE,function(){this.update()}));var d=this;this.$super(a,function(){d.trigger(GE.Events.Engine.START);d.animate()});return this},animate:function(){requestAnimationFrame(function(){GE.engine.animate()});this.render();this.update(this.tClock.getDelta())},addEffect:function(a,b,c){return this},clearEffects:function(){return this},getScreen:function(){return{width:this.gScreen.w,height:this.gScreen.h}},updateScreenSize:function(){},
render:function(){this.getCurrentScene()&&this.tRenderFn()},__render:function(){this.tRenderer.render(this.tScene)}});AGE.Mod.GUI=AGE.Mod.GUI||{};
AGE.Mod.GUI.DatGUI=GE.Klass(GE.Module,{$name:"Mod.GUI.DatGUI",name:"datgui",file:"gui/datgui/dat.gui.min.js",initialize:function(a){this.async=!0;this.file=a||this.file},load:function(a,b){if(!document.dat||!document.dat.gui){var c=this.name;"undefined"===typeof TWEEN&&GE.loadScript(GE.Path.combine(AGE.Folders.Modules,this.file)).done(function(){a(c)}).fail(function(){b(c)})}},dispose:function(){}});GE.Events.Com.Timer={TICK:"com-timer-tick"};
AGE.Com.Timer=GE.Klass(GE.Component,{$name:"Com.Timer",__timeout:null,__enabled:!1,alarmId:0,loop:!1,time:1E3,initialize:function(a){this.$super(a)},load:function(){"undefined"==typeof this.entity.alarms&&(this.entity.__alarmId=0,this.entity.alarms={});this.id=++this.entity.__alarmId;this.entity.alarms[this.alarmId]=this},dispose:function(){this.stop();delete this.entity.alarms[this.alarmId]},start:function(a){if(this.__enabled)return console.warn("Alarm "+this.alarmId+" was enabled."),this;this.__enabled=
!0;a&&("undefined"!==typeof a.time&&(this.time=a.time),"undefined"!==typeof a.loop&&(this.loop=a.loop));this.__timeout=setTimeout(this.__onTick,this.time);return this},isEnabled:function(){return this.__enabled},stop:function(){this.__enabled=!1;this.__timeout&&(clearTimeout(this.__timeout),this.__timeout=null);return this},__onTick:function(){this.trigger(GE.Events.Com.Timer.TICK,this);this.__enabled&&(this.__timeout=null,this.stop(),this.loop&&this.start())}.$bound()});
