2012-04-19 14:35:52 +08:00
|
|
|
/****************************************************************************
|
2012-09-24 21:22:20 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2012-04-19 14:35:52 +08:00
|
|
|
Copyright (c) 2010 Neophit
|
|
|
|
Copyright (c) 2010 Ricardo Quesada
|
|
|
|
Copyright (c) 2011 Zynga Inc.
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __CCTMX_OBJECT_GROUP_H__
|
|
|
|
#define __CCTMX_OBJECT_GROUP_H__
|
|
|
|
|
2013-10-14 14:01:00 +08:00
|
|
|
#include "CCGeometry.h"
|
|
|
|
#include "CCString.h"
|
|
|
|
#include "CCArray.h"
|
|
|
|
#include "CCDictionary.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup tilemap_parallax_nodes
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief TMXObjectGroup represents the TMX object group.
|
2012-04-19 14:35:52 +08:00
|
|
|
@since v0.99.0
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL TMXObjectGroup : public Object
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-09-13 16:46:31 +08:00
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
TMXObjectGroup();
|
2013-09-13 13:52:42 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual ~TMXObjectGroup();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
inline const char* getGroupName(){ return _groupName.c_str(); }
|
|
|
|
inline void setGroupName(const char *groupName){ _groupName = groupName; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** return the value for the specific property name */
|
2013-07-25 19:58:59 +08:00
|
|
|
String* getProperty(const char* propertyName) const;
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2013-07-25 19:58:59 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE String *propertyNamed(const char* propertyName) const { return getProperty(propertyName); };
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** return the dictionary for the specific object name.
|
|
|
|
It will return the 1st object found on the array for the given name.
|
|
|
|
*/
|
2013-07-25 19:58:59 +08:00
|
|
|
Dictionary* getObject(const char *objectName) const;
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2013-07-25 19:58:59 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE Dictionary* objectNamed(const char *objectName) const { return getObject(objectName); };
|
2013-07-23 18:26:26 +08:00
|
|
|
|
|
|
|
/** Gets the offset position of child objects */
|
|
|
|
inline const Point& getPositionOffset() const { return _positionOffset; };
|
|
|
|
|
|
|
|
/** Sets the offset position of child objects */
|
|
|
|
inline void setPositionOffset(const Point& offset) { _positionOffset = offset; };
|
|
|
|
|
|
|
|
/** Gets the list of properties stored in a dictionary */
|
2013-07-23 20:36:41 +08:00
|
|
|
inline Dictionary* getProperties() const { return _properties; };
|
2013-07-23 18:26:26 +08:00
|
|
|
|
|
|
|
/** Sets the list of properties */
|
2013-07-23 20:36:41 +08:00
|
|
|
inline void setProperties(Dictionary* properties) {
|
|
|
|
CC_SAFE_RETAIN(properties);
|
|
|
|
CC_SAFE_RELEASE(_properties);
|
|
|
|
_properties = properties;
|
|
|
|
};
|
2013-07-23 18:26:26 +08:00
|
|
|
|
|
|
|
/** Gets the array of the objects */
|
2013-07-23 20:36:41 +08:00
|
|
|
inline Array* getObjects() const { return _objects; };
|
2013-07-23 18:26:26 +08:00
|
|
|
|
|
|
|
/** Sets the array of the objects */
|
2013-07-23 20:36:41 +08:00
|
|
|
inline void setObjects(Array* objects) {
|
|
|
|
CC_SAFE_RETAIN(objects);
|
|
|
|
CC_SAFE_RELEASE(_objects);
|
|
|
|
_objects = objects;
|
|
|
|
};
|
2013-07-23 18:26:26 +08:00
|
|
|
|
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
/** name of the group */
|
2013-06-15 14:03:30 +08:00
|
|
|
std::string _groupName;
|
2013-07-23 18:26:26 +08:00
|
|
|
/** offset position of child objects */
|
|
|
|
Point _positionOffset;
|
|
|
|
/** list of properties stored in a dictionary */
|
|
|
|
Dictionary* _properties;
|
|
|
|
/** array of the objects */
|
|
|
|
Array* _objects;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of tilemap_parallax_nodes group
|
|
|
|
/// @}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
NS_CC_END
|
|
|
|
|
2010-08-30 11:45:46 +08:00
|
|
|
#endif //__CCTMX_OBJECT_GROUP_H__
|