/** * Runtime mouse for updating instance objects * @param graphics GameLib.D3.Graphics * @param apiMouse GameLib.API.Mouse * @constructor */ GameLib.Mouse = function (graphics, apiMouse) { this.graphics = graphics; this.graphics.isNotThreeThrow(); GameLib.API.Mouse.call( this, apiMouse.id, apiMouse.name, apiMouse.x, apiMouse.y ); this.parentObject = parentObject; // this.instance = this.createInstance(); }; /** * Creates an instance mouse * @param update * @returns {*} */ GameLib.Mouse.prototype.createInstance = function(update) { // // var instance = null; // // if (update) { // instance = this.instance; // instance.x = this.x; // instance.y = this.y; // } else { // instance = new THREE.Mouse(this.x, this.y); // } // // return instance; }; /** * Updates the instance vector, calls updateInstance on the parent object */ GameLib.Mouse.prototype.updateInstance = function() { this.createInstance(true); if (this.parentObject.updateInstance) { this.parentObject.updateInstance(); } }; /** * Converts runtime vector to API Vector * @returns {GameLib.API.Mouse} */ GameLib.Mouse.prototype.toApiMouse = function() { return new GameLib.API.Mouse( this.id, this.name, this.x, this.y ); };