2012-04-19 14:35:52 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2010 Neophit
|
|
|
|
Copyright (c) 2010 Ricardo Quesada
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2012-04-19 14:35:52 +08:00
|
|
|
Copyright (c) 2011 Zynga Inc.
|
2018-01-29 16:25:32 +08:00
|
|
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
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__
|
|
|
|
|
2014-04-30 08:37:36 +08:00
|
|
|
#include "math/CCGeometry.h"
|
2014-04-27 01:35:57 +08:00
|
|
|
#include "base/CCValue.h"
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "base/CCRef.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
2015-03-21 17:06:26 +08:00
|
|
|
* @addtogroup _2d
|
2012-06-20 18:09:11 +08:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief TMXObjectGroup represents the TMX object group.
|
2015-03-21 17:06:26 +08:00
|
|
|
* @since v0.99.0
|
|
|
|
*/
|
2014-02-20 10:53:49 +08:00
|
|
|
class CC_DLL TMXObjectGroup : public Ref
|
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();
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Get the group name.
|
|
|
|
*
|
|
|
|
* @return The group name.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const std::string& getGroupName() const { return _groupName; }
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Set the group name.
|
|
|
|
*
|
2015-03-27 11:39:31 +08:00
|
|
|
* @param groupName A string,it is used to set the group name.
|
2015-03-21 17:06:26 +08:00
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setGroupName(const std::string& groupName) { _groupName = groupName; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Return the value for the specific property name.
|
|
|
|
*
|
|
|
|
* @param propertyName The specific property name.
|
|
|
|
* @return Return the value for the specific property name.
|
2015-03-28 14:28:16 +08:00
|
|
|
* @js NA
|
2015-03-21 17:06:26 +08:00
|
|
|
*/
|
2013-12-03 14:47:35 +08:00
|
|
|
Value getProperty(const std::string& propertyName) const;
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2013-12-03 14:47:35 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE Value propertyNamed(const std::string& propertyName) const { return getProperty(propertyName); };
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Return the dictionary for the specific object name.
|
|
|
|
* It will return the 1st object found on the array for the given name.
|
|
|
|
*
|
|
|
|
* @return Return the dictionary for the specific object name.
|
|
|
|
*/
|
2013-12-04 17:46:57 +08:00
|
|
|
ValueMap getObject(const std::string& objectName) const;
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2013-12-04 17:46:57 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE ValueMap objectNamed(const std::string& objectName) const { return getObject(objectName); };
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Gets the offset position of child objects.
|
|
|
|
*
|
|
|
|
* @return The offset position of child objects.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const Vec2& getPositionOffset() const { return _positionOffset; }
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Sets the offset position of child objects.
|
|
|
|
*
|
|
|
|
* @param offset The offset position of child objects.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setPositionOffset(const Vec2& offset) { _positionOffset = offset; }
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Gets the list of properties stored in a dictionary.
|
|
|
|
*
|
|
|
|
* @return The list of properties stored in a dictionary.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const ValueMap& getProperties() const { return _properties; }
|
|
|
|
ValueMap& getProperties() { return _properties; }
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Sets the list of properties.
|
|
|
|
*
|
|
|
|
* @param properties The list of properties.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setProperties(const ValueMap& properties) {
|
2013-07-23 20:36:41 +08:00
|
|
|
_properties = properties;
|
2016-09-20 14:43:48 +08:00
|
|
|
}
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Gets the array of the objects.
|
|
|
|
*
|
|
|
|
* @return The array of the objects.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const ValueVector& getObjects() const { return _objects; }
|
|
|
|
ValueVector& getObjects() { return _objects; }
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Sets the array of the objects.
|
|
|
|
*
|
|
|
|
* @param objects The array of the objects.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setObjects(const ValueVector& objects) {
|
2013-07-23 20:36:41 +08:00
|
|
|
_objects = objects;
|
2016-09-20 14:43:48 +08:00
|
|
|
}
|
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 */
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec2 _positionOffset;
|
2013-07-23 18:26:26 +08:00
|
|
|
/** list of properties stored in a dictionary */
|
2013-12-04 17:46:57 +08:00
|
|
|
ValueMap _properties;
|
2013-07-23 18:26:26 +08:00
|
|
|
/** array of the objects */
|
2013-12-04 17:46:57 +08:00
|
|
|
ValueVector _objects;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of tilemap_parallax_nodes group
|
2015-03-21 17:06:26 +08:00
|
|
|
/** @} */
|
2012-06-20 18:09:11 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
NS_CC_END
|
|
|
|
|
2014-06-19 19:45:49 +08:00
|
|
|
#endif //__CCTMX_OBJECT_GROUP_H__
|