1 /****************************************************************************
  2  Copyright (c) 2010-2012 cocos2d-x.org
  3 
  4  http://www.cocos2d-x.org
  5 
  6  Permission is hereby granted, free of charge, to any person obtaining a copy
  7  of this software and associated documentation files (the "Software"), to deal
  8  in the Software without restriction, including without limitation the rights
  9  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 10  copies of the Software, and to permit persons to whom the Software is
 11  furnished to do so, subject to the following conditions:
 12 
 13  The above copyright notice and this permission notice shall be included in
 14  all copies or substantial portions of the Software.
 15 
 16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 21  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 22  THE SOFTWARE.
 23  ****************************************************************************/
 24 
 25 /**
 26  * Base class for ccs.DecotativeDisplay
 27  * @class
 28  * @extends ccs.Class
 29  */
 30 ccs.DecotativeDisplay = ccs.Class.extend({
 31     _display:null,
 32     _colliderDetector:null,
 33     _displayData:null,
 34 
 35     ctor:function () {
 36         this._display = null;
 37         this._colliderDetector = null;
 38         this._displayData = null;
 39     },
 40 
 41     init:function () {
 42         return true;
 43     },
 44 
 45     /**
 46      * display setter
 47      * @param {cc.Node} display
 48      */
 49     setDisplay:function (display) {
 50         this._display = display;
 51     },
 52 
 53     /**
 54      * display getter
 55      * @returns {cc.Node}
 56      */
 57     getDisplay:function () {
 58         return this._display;
 59     },
 60 
 61     /**
 62      * colliderDetector setter
 63      * @param {ccs.ColliderDetector} colliderDetector
 64      */
 65     setColliderDetector:function (colliderDetector) {
 66         this._colliderDetector = colliderDetector;
 67     },
 68 
 69     /**
 70      * colliderDetector getter
 71      * @returns {ccs.ColliderDetector}
 72      */
 73     getColliderDetector:function () {
 74         return this._colliderDetector;
 75     },
 76 
 77     /**
 78      * display data setter
 79      * @param {ccs.DisplayData} displayData
 80      */
 81     setDisplayData:function (displayData) {
 82         this._displayData = displayData;
 83     },
 84 
 85     /**
 86      * display data getter
 87      * @returns {ccs.DisplayData}
 88      */
 89     getDisplayData:function () {
 90         return this._displayData;
 91     },
 92     release:function () {
 93         CC_SAFE_RELEASE(this._display);
 94         this._display = null;
 95         CC_SAFE_RELEASE(this._displayData);
 96         this._displayData = null;
 97         CC_SAFE_RELEASE(this._colliderDetector);
 98         this._colliderDetector = null;
 99     }
100 
101 });
102 
103 /**
104  * allocates and initializes a decotative display.
105  * @constructs
106  * @return {ccs.DecotativeDisplay}
107  * @example
108  * // example
109  * var display = ccs.DecotativeDisplay.create();
110  */
111 ccs.DecotativeDisplay.create = function () {
112     var decotativeDisplay = new ccs.DecotativeDisplay();
113     if (decotativeDisplay && decotativeDisplay.init()) {
114         return decotativeDisplay;
115     }
116     return null;
117 };