r3-legacy/src/game-lib-d3-controls-mouse.js

76 lines
1.7 KiB
JavaScript

/**
* Mouse Controls
* @param graphics GameLib.D3.Graphics
* @param apiControls GameLib.D3.API.Controls
* @constructor
*/
GameLib.D3.Controls.Mouse = function (
graphics,
apiControls
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
GameLib.D3.Controls.call(
this,
this.graphics,
apiControls
);
};
/**
* Inheritance
* @type {GameLib.D3.Controls}
*/
GameLib.D3.Controls.Mouse.prototype = Object.create(GameLib.D3.Controls.prototype);
GameLib.D3.Controls.Mouse.prototype.constructor = GameLib.D3.Controls.Mouse;
/**
* Create Instance
* @returns
*/
GameLib.D3.Controls.Mouse.prototype.createInstance = function() {
/**
* Set instance to true to indicate no dependencies to other components
*/
this.instance = true;
GameLib.D3.Controls.prototype.createInstance.call(this);
};
/**
* Update Instance
*/
GameLib.D3.Controls.Mouse.prototype.updateInstance = function() {
GameLib.D3.Controls.prototype.updateInstance.call(this);
};
/**
* Converts a GameLib.D3.Controls.Mouse to a GameLib.D3.API.Controls
* @returns {GameLib.D3.API.Controls}
*/
GameLib.D3.Controls.Mouse.prototype.toApiObject = function() {
var apiControls = GameLib.D3.Controls.prototype.toApiObject.call(this);
/**
* add other properties here as this component develops...
*/
return apiControls;
};
/**
* Construct an Mouse Controls object from data
* @param graphics
* @param objectControls
* @returns {GameLib.D3.Controls.Mouse}
* @constructor
*/
GameLib.D3.Controls.Mouse.FromObject = function(graphics, objectControls) {
var apiControls = GameLib.D3.API.Controls.FromObject(objectControls);
return new GameLib.D3.Controls.Mouse(
graphics,
apiControls
);
};