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

67 lines
1.5 KiB
JavaScript

/**
* Keyboard Controls
* @param apiControls GameLib.API.Controls
* @constructor
*/
GameLib.Controls.Keyboard = function (
apiControls
) {
GameLib.Controls.call(
this,
apiControls
);
};
/**
* Inheritance
* @type {GameLib.Controls}
*/
GameLib.Controls.Keyboard.prototype = Object.create(GameLib.Controls.prototype);
GameLib.Controls.Keyboard.prototype.constructor = GameLib.Controls.Keyboard;
/**
* Create Instance
* @returns
*/
GameLib.Controls.Keyboard.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.Keyboard.prototype.updateInstance = function() {
GameLib.Controls.prototype.updateInstance.call(this);
};
/**
* Converts a GameLib.Controls.Keyboard to a GameLib.API.Controls
* @returns {GameLib.API.Controls}
*/
GameLib.Controls.Keyboard.prototype.toApiObject = function() {
var apiControls = GameLib.Controls.prototype.toApiObject.call(this);
/**
* add other properties here as this component develops...
*/
return apiControls;
};
/**
* Construct an Keyboard Controls object from data
* @param objectControls
* @returns {GameLib.Controls.Keyboard}
* @constructor
*/
GameLib.Controls.Keyboard.FromObject = function(objectControls) {
var apiControls = GameLib.API.Controls.FromObject(objectControls);
return new GameLib.Controls.Keyboard(
apiControls
);
};