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

67 lines
1.5 KiB
JavaScript
Raw Normal View History

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