duckengine
Version:
A 2D Game Engine for the web.
60 lines (59 loc) • 2.02 kB
TypeScript
import { Duck } from '../../../..';
import Game from '../../../game';
/**
* @class RendererPipeline
* @classdesc Creates a DuckEngine RendererPipeline
* @description The RendererPipeline Class. Manages all visible scenes and renderables by pooling them on an interval for GC efficiency
* @since 2.1.0
*/
export default class RendererPipeline {
/**
* @memberof RendererPipeline
* @description Game instance
* @type Game
* @since 2.1.0
*/
game: Game;
/**
* @memberof RendererPipeline
* @description The interval that calls RendererPipeline.pool, time: 1000 / this.game.fps
* @type unknown
* @since 2.1.0
*/
poolInterval: unknown;
/**
* @memberof RendererPipeline
* @description The poolStack, contains objects that holds a scene and its renderables
* @type Duck.Types.RendererPipeline.PoolStackItem[]
* @since 2.1.0
*/
poolStack: Duck.Types.RendererPipeline.PoolStackItem[];
/**
* @memberof RendererPipeline
* @description The interval that calls RendererPipeline.updateTime, time: 1000, updates the time that the poolInterval is called for better results
* @type unknown
* @since 2.1.0
*/
protected updateTimeInterval: unknown;
/**
* @constructor RendererPipeline
* @description Creates a RendererPipeline instance
* @param {Game} game Game instance
* @param {number} [poolingInterval= 1000 / game.fps] How often RendererPipeline.pool is called
* @since 2.1.0
*/
constructor(game: Game, poolingInterval?: number);
/**
* @memberof RendererPipeline
* @description Pools all visible scenes from the game stack and its renderables
* @since 2.1.0
*/
pool(): void;
/**
* @memberof RendererPipeline
* @description Clears the poolInterval and sets the interval again to a more recent time, time: 1000 / game.fps,
* gets called automatically every 1000 ms
* @since 2.1.0
*/
updateTime(): void;
}