1 /** 2 * The Render Engine 3 * DebugComponent 4 * 5 * @fileoverview A debugging component. 6 * 7 * @author: Brett Fattori (brettf@renderengine.com) 8 * 9 * @author: $Author: bfattori $ 10 * @version: $Revision: 1555 $ 11 * 12 * Copyright (c) 2011 Brett Fattori (brettf@renderengine.com) 13 * 14 * Permission is hereby granted, free of charge, to any person obtaining a copy 15 * of this software and associated documentation files (the "Software"), to deal 16 * in the Software without restriction, including without limitation the rights 17 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 * copies of the Software, and to permit persons to whom the Software is 19 * furnished to do so, subject to the following conditions: 20 * 21 * The above copyright notice and this permission notice shall be included in 22 * all copies or substantial portions of the Software. 23 * 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 * THE SOFTWARE. 31 * 32 */ 33 34 // The class this file defines and its required classes 35 R.Engine.define({ 36 "class":"R.components.Debug", 37 "requires":[ 38 "R.components.Base" 39 ] 40 }); 41 42 /** 43 * @class A debugging component to render helpful debug widgets alongside an object. 44 * 45 * @param name {String} Name of the component 46 * 47 * @extends R.components.Base 48 * @constructor 49 * @description A debugging component. 50 */ 51 R.components.Debug = function () { 52 "use strict"; 53 return R.components.Base.extend(/** @scope R.components.Collider.prototype */{ 54 55 /** 56 * @private 57 */ 58 constructor:function (name, priority) { 59 this.base(name, R.components.Base.TYPE_POST, priority || 1.0); 60 }, 61 62 /** 63 * Destroy the component instance. 64 */ 65 destroy:function () { 66 this.base(); 67 }, 68 69 /** 70 * This method has been deprecated in favor of {@link #setGameObject}. 71 * @deprecated 72 */ 73 setHostObject:function (gameObject) { 74 this.base(gameObject); 75 }, 76 77 /** 78 * Establishes the link between this component and its game object. 79 * When you assign components to a game object, it will call this method 80 * so that each component can refer to its game object, the same way 81 * a game object can refer to a component with {@link R.engine.GameObject#getComponent}. 82 * 83 * @param gameObject {R.engine.GameObject} The object which holds this component 84 */ 85 setGameObject:function (gameObject) { 86 this.base(gameObject); 87 }, 88 89 /** 90 * Releases the component back into the pool for reuse. See {@link R.engine.PooledObject#release} 91 * for more information. 92 */ 93 release:function () { 94 this.base(); 95 }, 96 97 /** 98 * Updates the object within the collision model and determines if 99 * the host object should to be alerted whenever a potential collision 100 * has occurred. If a potential collision occurs, an array (referred to 101 * as a Potential Collision List, or PCL) will be created which 102 * contains objects that might be colliding with the host object. It 103 * is up to the host object to make the final determination that a 104 * collision has occurred. If no collisions have occurred, that will be reported 105 * as well. 106 * <p/> 107 * The list of objects within the PCL will be passed to the <tt>onCollide()</tt> 108 * method (if declared) on the host object. If a collision occurred and was 109 * handled, the <tt>onCollide()</tt> method should return {@link CollisionComponent#STOP}, 110 * otherwise, it should return {@link CollisionComponent#CONTINUE} to continue 111 * checking objects from the PCL against the host object. 112 * 113 * @param renderContext {R.rendercontexts.AbstractRenderContext} The render context for the component 114 * @param time {Number} The current engine time in milliseconds 115 * @param dt {Number} The delta between the world time and the last time the world was updated 116 * in milliseconds. 117 */ 118 execute:function (renderContext, time, dt) { 119 120 } 121 122 }, /** @scope R.components.Debug.prototype */{ // Statics 123 124 /** 125 * Get the class name of this object 126 * 127 * @return {String} "R.components.Debug" 128 */ 129 getClassName:function () { 130 return "R.components.Debug"; 131 } 132 133 }); 134 }