r3-legacy/src/game-lib-d3-viewport.js

92 lines
1.9 KiB
JavaScript
Raw Normal View History

2017-01-11 16:09:06 +01:00
/**
* Viewport Runtime
* @param graphics GameLib.GraphicsRuntime
2017-01-11 16:09:06 +01:00
* @param apiViewport GameLib.D3.API.Viewport
* @constructor
*/
GameLib.D3.Viewport = function (
graphics,
2017-02-21 18:55:18 +01:00
apiViewport
2017-01-11 16:09:06 +01:00
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
if (GameLib.Utils.UndefinedOrNull(apiViewport)) {
apiViewport = {};
}
if (apiViewport instanceof GameLib.D3.Viewport) {
return apiViewport;
}
2017-01-11 16:09:06 +01:00
GameLib.D3.API.Viewport.call(
this,
apiViewport.id,
apiViewport.name,
apiViewport.width,
apiViewport.height,
apiViewport.x,
apiViewport.y,
apiViewport.parentEntity
);
2017-06-16 15:49:53 +02:00
GameLib.Component.call(
this,
2017-08-24 22:20:40 +02:00
GameLib.Component.COMPONENT_VIEWPORT
2017-06-16 15:49:53 +02:00
);
2017-01-11 16:09:06 +01:00
};
GameLib.D3.Viewport.prototype = Object.create(GameLib.D3.API.Viewport.prototype);
GameLib.D3.Viewport.prototype.constructor = GameLib.D3.Viewport;
/**
*
2017-08-24 22:20:40 +02:00
* @returns {boolean}
2017-01-11 16:09:06 +01:00
*/
2017-06-28 17:09:06 +02:00
GameLib.D3.Viewport.prototype.createInstance = function() {
2017-10-23 14:52:35 +02:00
this.instance = true;
GameLib.Component.prototype.createInstance.call(this);
2017-01-11 16:09:06 +01:00
};
/**
*
*/
GameLib.D3.Viewport.prototype.updateInstance = function() {
};
/**
* GameLib.D3.Viewport to GameLib.D3.API.Viewport
* @returns {GameLib.D3.API.Viewport}
*/
2017-05-16 14:51:57 +02:00
GameLib.D3.Viewport.prototype.toApiObject = function() {
2017-01-11 16:09:06 +01:00
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
*/
2017-06-14 14:21:57 +02:00
GameLib.D3.Viewport.FromObject = function(graphics, objectComponent) {
2017-01-11 16:09:06 +01:00
2017-06-14 14:21:57 +02:00
var apiViewport = GameLib.D3.API.Viewport.FromObject(objectComponent);
2017-01-11 16:09:06 +01:00
return new GameLib.D3.Viewport(
graphics,
apiViewport
);
};