/** * Keyboard Controls * @param apiKeyboardControls GameLib.API.Controls * @constructor */ GameLib.Controls.Keyboard = function ( apiKeyboardControls ) { if (GameLib.Utils.UndefinedOrNull(apiKeyboardControls)) { apiKeyboardControls = { controlsType : GameLib.API.Controls.CONTROLS_TYPE_KEYBOARD }; } GameLib.API.Controls.Keyboard.call( this, apiKeyboardControls ); GameLib.Controls.call( this, apiKeyboardControls ); }; /** * 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(property) { GameLib.Controls.prototype.updateInstance.call(this, property); }; /** * 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 apiKeyboardControls = GameLib.API.Controls.Keyboard.FromObject(objectControls); return new GameLib.Controls.Keyboard( apiKeyboardControls ); };