/** * Runtime Mouse * @param apiMouse * @returns {GameLib.Mouse} * @constructor */ GameLib.Mouse = function (apiMouse) { if (GameLib.Utils.UndefinedOrNull(apiMouse)){ apiMouse = {}; } GameLib.API.Mouse.call( this, apiMouse.id, apiMouse.name, apiMouse.x, apiMouse.y, apiMouse.parentEntity ); GameLib.Component.call(this); }; GameLib.Mouse.prototype = Object.create(GameLib.Component.prototype); GameLib.Mouse.prototype.constructor = GameLib.Mouse; /** * createInstance */ GameLib.Mouse.prototype.createInstance = function() { this.instance = {}; GameLib.Component.prototype.createInstance.call(this); }; /** * updateInstance * @param property */ GameLib.Mouse.prototype.updateInstance = function(property) { if ( property === 'x' || property === 'y' ) { this.instance.x = this.x; this.instance.y = this.y; return; } GameLib.Component.prototype.updateInstance.call(this, property); }; /** * Converts GameLib.Mouse vector to GameLib.API.Mouse * @returns {GameLib.API.Mouse} */ GameLib.Mouse.prototype.toApiObject = function() { return new GameLib.API.Mouse( this.id, this.name, this.x, this.y, this.parentEntity ); };