2017-09-27 14:38:58 +02:00
|
|
|
/**
|
|
|
|
* 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() {
|
|
|
|
/**
|
2017-10-23 14:52:35 +02:00
|
|
|
* Set instance to true to indicate no dependencies to other components
|
2017-09-27 14:38:58 +02:00
|
|
|
*/
|
2017-10-23 14:52:35 +02:00
|
|
|
this.instance = true;
|
|
|
|
GameLib.D3.Controls.prototype.createInstance.call(this);
|
2017-09-27 14:38:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
);
|
|
|
|
|
|
|
|
};
|