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
|
|
|
|
2022-07-09 01:23:11 +08:00
|
|
|
https://axis-project.github.io/
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
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__
|
|
|
|
|
2021-10-23 23:27:14 +08:00
|
|
|
#include "math/CCMath.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
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_BEGIN
|
2012-04-19 14:35:52 +08:00
|
|
|
|
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
|
|
|
|
*/
|
2022-07-15 19:17:01 +08:00
|
|
|
class AX_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();
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
/** Get the group name.
|
2015-03-21 17:06:26 +08:00
|
|
|
*
|
|
|
|
* @return The group name.
|
|
|
|
*/
|
2021-12-26 23:26:34 +08:00
|
|
|
std::string_view getGroupName() const { return _groupName; }
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
/** Set the group name.
|
2015-03-21 17:06:26 +08:00
|
|
|
*
|
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
|
|
|
*/
|
2021-12-26 23:26:34 +08:00
|
|
|
void setGroupName(std::string_view groupName) { _groupName = groupName; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
/** Return the value for the specific property name.
|
2015-03-21 17:06:26 +08:00
|
|
|
*
|
|
|
|
* @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
|
|
|
*/
|
2021-12-26 23:26:34 +08:00
|
|
|
Value getProperty(std::string_view propertyName) const;
|
2021-12-25 10:04:45 +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.
|
|
|
|
*/
|
2021-12-26 23:26:34 +08:00
|
|
|
ValueMap getObject(std::string_view objectName) const;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
/** Gets the offset position of child objects.
|
2015-03-21 17:06:26 +08:00
|
|
|
*
|
|
|
|
* @return The offset position of child objects.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const Vec2& getPositionOffset() const { return _positionOffset; }
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
/** Sets the offset position of child objects.
|
2015-03-21 17:06:26 +08:00
|
|
|
*
|
|
|
|
* @param offset The offset position of child objects.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setPositionOffset(const Vec2& offset) { _positionOffset = offset; }
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
/** Gets the list of properties stored in a dictionary.
|
2015-03-21 17:06:26 +08:00
|
|
|
*
|
|
|
|
* @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; }
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Sets the list of properties.
|
|
|
|
*
|
|
|
|
* @param properties The list of properties.
|
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
void setProperties(const ValueMap& properties) { _properties = properties; }
|
|
|
|
|
|
|
|
/** Gets the array of the objects.
|
2015-03-21 17:06:26 +08:00
|
|
|
*
|
|
|
|
* @return The array of the objects.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const ValueVector& getObjects() const { return _objects; }
|
|
|
|
ValueVector& getObjects() { return _objects; }
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Sets the array of the objects.
|
|
|
|
*
|
|
|
|
* @param objects The array of the objects.
|
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
void setObjects(const ValueVector& 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 */
|
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
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_END
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
#endif //__CCTMX_OBJECT_GROUP_H__
|