render run loop to render system
parent
20163c4f93
commit
c4d70e8795
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
||||
var __DATE__ = "Tue Dec 12 2017 11:13:34 GMT+0100 (CET)";
|
||||
var __DATE__ = "Tue Dec 12 2017 11:35:24 GMT+0100 (CET)";
|
||||
// END COMPILE TIME DEFINITIONS
|
||||
|
||||
/**
|
||||
|
@ -32021,10 +32021,12 @@ GameLib.System.Physics.prototype.stop = function() {
|
|||
/**
|
||||
* System takes care of updating all the entities (based on their component data)
|
||||
* @param apiSystem GameLib.API.System
|
||||
* @param graphicsRuntime
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.System.Render = function(
|
||||
apiSystem
|
||||
apiSystem,
|
||||
graphicsRuntime
|
||||
) {
|
||||
|
||||
GameLib.System.call(
|
||||
|
@ -32034,6 +32036,12 @@ GameLib.System.Render = function(
|
|||
|
||||
this.renderSubscription = null;
|
||||
|
||||
this.clock = new GameLib.Clock(graphicsRuntime);
|
||||
|
||||
this.delta = null;
|
||||
|
||||
this.animationFrameHook = null;
|
||||
|
||||
};
|
||||
|
||||
GameLib.System.Render.prototype = Object.create(GameLib.System.prototype);
|
||||
|
@ -32075,6 +32083,24 @@ GameLib.System.Render.prototype.start = function() {
|
|||
this.nativeWindowResize,
|
||||
false
|
||||
);
|
||||
|
||||
this.run();
|
||||
|
||||
};
|
||||
|
||||
GameLib.System.Render.prototype.run = function() {
|
||||
|
||||
this.animationFrameHook = requestAnimationFrame( this.run.bind(this) );
|
||||
|
||||
this.delta = this.clock.getDelta();
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.RENDER,
|
||||
{
|
||||
delta : this.delta
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
GameLib.System.Render.prototype.nativeWindowResize = function() {
|
||||
|
@ -32238,6 +32264,8 @@ GameLib.System.Render.prototype.stop = function() {
|
|||
|
||||
GameLib.System.prototype.stop.call(this);
|
||||
|
||||
cancelAnimationFrame(this.animationFrameHook);
|
||||
|
||||
this.instanceCreatedSubscription.remove();
|
||||
|
||||
this.removeComponentSubscription.remove();
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
/**
|
||||
* System takes care of updating all the entities (based on their component data)
|
||||
* @param apiSystem GameLib.API.System
|
||||
* @param graphicsRuntime
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.System.Render = function(
|
||||
apiSystem
|
||||
apiSystem,
|
||||
graphicsRuntime
|
||||
) {
|
||||
|
||||
GameLib.System.call(
|
||||
|
@ -14,6 +16,12 @@ GameLib.System.Render = function(
|
|||
|
||||
this.renderSubscription = null;
|
||||
|
||||
this.clock = new GameLib.Clock(graphicsRuntime);
|
||||
|
||||
this.delta = null;
|
||||
|
||||
this.animationFrameHook = null;
|
||||
|
||||
};
|
||||
|
||||
GameLib.System.Render.prototype = Object.create(GameLib.System.prototype);
|
||||
|
@ -55,6 +63,24 @@ GameLib.System.Render.prototype.start = function() {
|
|||
this.nativeWindowResize,
|
||||
false
|
||||
);
|
||||
|
||||
this.run();
|
||||
|
||||
};
|
||||
|
||||
GameLib.System.Render.prototype.run = function() {
|
||||
|
||||
this.animationFrameHook = requestAnimationFrame( this.run.bind(this) );
|
||||
|
||||
this.delta = this.clock.getDelta();
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.RENDER,
|
||||
{
|
||||
delta : this.delta
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
GameLib.System.Render.prototype.nativeWindowResize = function() {
|
||||
|
@ -218,6 +244,8 @@ GameLib.System.Render.prototype.stop = function() {
|
|||
|
||||
GameLib.System.prototype.stop.call(this);
|
||||
|
||||
cancelAnimationFrame(this.animationFrameHook);
|
||||
|
||||
this.instanceCreatedSubscription.remove();
|
||||
|
||||
this.removeComponentSubscription.remove();
|
||||
|
|
Loading…
Reference in New Issue