/** * Viewport Runtime * @param graphics GameLib.GraphicsRuntime * @param apiViewport GameLib.D3.API.Viewport * @constructor */ GameLib.D3.Viewport = function ( graphics, apiViewport ) { this.graphics = graphics; this.graphics.isNotThreeThrow(); if (GameLib.Utils.UndefinedOrNull(apiViewport)) { apiViewport = {}; } if (apiViewport instanceof GameLib.D3.Viewport) { return apiViewport; } GameLib.D3.API.Viewport.call( this, apiViewport.id, apiViewport.name, apiViewport.width, apiViewport.height, apiViewport.x, apiViewport.y, apiViewport.parentEntity ); GameLib.Component.call(this); }; GameLib.D3.Viewport.prototype = Object.create(GameLib.Component.prototype); GameLib.D3.Viewport.prototype.constructor = GameLib.D3.Viewport; /** * * @returns {boolean} */ GameLib.D3.Viewport.prototype.createInstance = function() { this.instance = true; GameLib.Component.prototype.createInstance.call(this); }; /** * */ GameLib.D3.Viewport.prototype.updateInstance = function() { }; /** * GameLib.D3.Viewport to GameLib.D3.API.Viewport * @returns {GameLib.D3.API.Viewport} */ GameLib.D3.Viewport.prototype.toApiObject = function() { var apiViewport = new GameLib.D3.API.Viewport( this.id, this.name, this.width, this.height, this.x, this.y, GameLib.Utils.IdOrNull(this.parentEntity) ); return apiViewport; }; /** * GameLib.D3.Viewport from Object Viewport * @param graphics * @param objectComponent * @returns {GameLib.D3.Viewport} * @constructor */ GameLib.D3.Viewport.FromObject = function(graphics, objectComponent) { var apiViewport = GameLib.D3.API.Viewport.FromObject(objectComponent); return new GameLib.D3.Viewport( graphics, apiViewport ); };