2011-03-19 10:59:01 +08:00
|
|
|
/****************************************************************************
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2008-2010 Ricardo Quesada
|
2012-09-24 21:22:20 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2011-07-04 14:11:43 +08:00
|
|
|
Copyright (c) 2011 Zynga Inc.
|
2016-08-05 09:42:15 +08:00
|
|
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
2011-03-19 10:59:01 +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_LAYER_H__
|
|
|
|
#define __CCTMX_LAYER_H__
|
2012-03-16 13:42:53 +08:00
|
|
|
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "2d/CCSpriteBatchNode.h"
|
2014-08-28 17:03:29 +08:00
|
|
|
#include "2d/CCTMXXMLParser.h"
|
2014-05-17 05:36:00 +08:00
|
|
|
#include "base/ccCArray.h"
|
2012-03-16 13:42:53 +08:00
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
class TMXMapInfo;
|
|
|
|
class TMXLayerInfo;
|
|
|
|
class TMXTilesetInfo;
|
2012-03-16 13:42:53 +08:00
|
|
|
struct _ccCArray;
|
|
|
|
|
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 TMXLayer represents the TMX layer.
|
2015-03-21 17:06:26 +08:00
|
|
|
* It is a subclass of SpriteBatchNode. By default the tiles are rendered using a TextureAtlas.
|
|
|
|
* If you modify a tile on runtime, then, that tile will become a Sprite, otherwise no Sprite objects are created.
|
|
|
|
* The benefits of using Sprite objects as tiles are:
|
|
|
|
* - tiles (Sprite) can be rotated/scaled/moved with a nice API.
|
|
|
|
* If the layer contains a property named "cc_vertexz" with an integer (in can be positive or negative),
|
|
|
|
* then all the tiles belonging to the layer will use that value as their OpenGL vertex Z for depth.
|
|
|
|
* On the other hand, if the "cc_vertexz" property has the "automatic" value, then the tiles will use an automatic vertex Z value.
|
|
|
|
* Also before drawing the tiles, GL_ALPHA_TEST will be enabled, and disabled after drawing them. The used alpha func will be:
|
|
|
|
* glAlphaFunc( GL_GREATER, value ).
|
|
|
|
* "value" by default is 0, but you can change it from Tiled by adding the "cc_alpha_func" property to the layer.
|
|
|
|
* The value 0 should work for most cases, but if you have tiles that are semi-transparent, then you might want to use a different
|
|
|
|
* value, like 0.5.
|
|
|
|
* For further information, please see the programming guide:
|
|
|
|
* http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps
|
|
|
|
* @since v0.8.1
|
|
|
|
* Tiles can have tile flags for additional properties. At the moment only flip horizontal and flip vertical are used. These bit flags are defined in TMXXMLParser.h.
|
|
|
|
* @since 1.1
|
|
|
|
*/
|
2012-03-16 13:42:53 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL TMXLayer : public SpriteBatchNode
|
2012-03-16 13:42:53 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Creates a TMXLayer with an tileset info, a layer info and a map info.
|
|
|
|
*
|
|
|
|
* @param tilesetInfo An tileset info.
|
|
|
|
* @param layerInfo A layer info.
|
|
|
|
* @param mapInfo A map info.
|
|
|
|
* @return An autorelease object.
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
static TMXLayer * create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
2013-09-13 16:46:31 +08:00
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
2013-07-19 14:57:54 +08:00
|
|
|
TMXLayer();
|
2013-09-13 13:52:42 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-19 14:57:54 +08:00
|
|
|
virtual ~TMXLayer();
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Initializes a TMXLayer with a tileset info, a layer info and a map info.
|
|
|
|
*
|
|
|
|
* @param tilesetInfo An tileset info.
|
|
|
|
* @param layerInfo A layer info.
|
|
|
|
* @param mapInfo A map info.
|
2015-09-22 16:08:23 +08:00
|
|
|
* @return If initializes successfully, it will return true.
|
2015-03-21 17:06:26 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
bool initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Dealloc the map that contains the tile position from memory.
|
|
|
|
* Unless you want to know at runtime the tiles positions, you can safely call this method.
|
|
|
|
* If you are going to call layer->tileGIDAt() then, don't release the map.
|
|
|
|
*/
|
2012-04-19 14:35:52 +08:00
|
|
|
void releaseMap();
|
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Returns the tile (Sprite) at a given a tile coordinate.
|
|
|
|
* The returned Sprite will be already added to the TMXLayer. Don't add it again.
|
|
|
|
* The Sprite can be treated like any other Sprite: rotated, scaled, translated, opacity, color, etc.
|
|
|
|
* You can remove either by calling:
|
|
|
|
* - layer->removeChild(sprite, cleanup);
|
|
|
|
* - or layer->removeTileAt(Vec2(x,y));
|
|
|
|
*
|
|
|
|
* @param tileCoordinate A tile coordinate.
|
|
|
|
* @return Returns the tile (Sprite) at a given a tile coordinate.
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
Sprite* getTileAt(const Vec2& tileCoordinate);
|
2015-03-28 14:28:16 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE Sprite* tileAt(const Vec2& tileCoordinate) { return getTileAt(tileCoordinate); };
|
2013-07-19 14:57:54 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Returns the tile gid at a given tile coordinate. It also returns the tile flags.
|
2015-11-04 16:09:58 +08:00
|
|
|
* This method requires the tile map has not been previously released (eg. don't call [layer releaseMap]).
|
2015-03-21 17:06:26 +08:00
|
|
|
*
|
|
|
|
* @param tileCoordinate The tile coordinate.
|
|
|
|
* @param flags Tile flags.
|
|
|
|
* @return Returns the tile gid at a given tile coordinate. It also returns the tile flags.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2015-03-28 14:28:16 +08:00
|
|
|
uint32_t getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags = nullptr);
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE uint32_t tileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags = nullptr){
|
2013-07-19 14:57:54 +08:00
|
|
|
return getTileGIDAt(tileCoordinate, flags);
|
2016-09-20 14:43:48 +08:00
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Sets the tile gid (gid = tile global id) at a given tile coordinate.
|
|
|
|
* The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor -> Tileset Mgr +1.
|
|
|
|
* If a tile is already placed at that position, then it will be removed.
|
|
|
|
*
|
|
|
|
* @param gid The tile gid.
|
|
|
|
* @param tileCoordinate The tile coordinate.
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
void setTileGID(uint32_t gid, const Vec2& tileCoordinate);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Sets the tile gid (gid = tile global id) at a given tile coordinate.
|
|
|
|
* The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor -> Tileset Mgr +1.
|
|
|
|
* If a tile is already placed at that position, then it will be removed.
|
|
|
|
* Use withFlags if the tile flags need to be changed as well.
|
|
|
|
*
|
|
|
|
* @param gid The tile gid.
|
|
|
|
* @param tileCoordinate The tile coordinate.
|
|
|
|
* @param flags The tile flags.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
|
|
|
|
2014-05-15 01:07:09 +08:00
|
|
|
void setTileGID(uint32_t gid, const Vec2& tileCoordinate, TMXTileFlags flags);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Removes a tile at given tile coordinate.
|
|
|
|
*
|
|
|
|
* @param tileCoordinate The tile coordinate.
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
void removeTileAt(const Vec2& tileCoordinate);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Returns the position in points of a given tile coordinate.
|
|
|
|
*
|
|
|
|
* @param tileCoordinate The tile coordinate.
|
|
|
|
* @return The position in points of a given tile coordinate.
|
|
|
|
*/
|
2015-03-28 14:28:16 +08:00
|
|
|
Vec2 getPositionAt(const Vec2& tileCoordinate);
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE Vec2 positionAt(const Vec2& tileCoordinate) { return getPositionAt(tileCoordinate); };
|
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
|
|
|
Value getProperty(const std::string& propertyName) const;
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
*/
|
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
|
|
|
/** Creates the tiles. */
|
2012-04-19 14:35:52 +08:00
|
|
|
void setupTiles();
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Get the layer name.
|
|
|
|
*
|
|
|
|
* @return The layer name.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const std::string& getLayerName() { return _layerName; }
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Set the layer name.
|
|
|
|
*
|
|
|
|
* @param layerName The layer name.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setLayerName(const std::string& layerName) { _layerName = layerName; }
|
2013-07-16 03:43:22 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Size of the layer in tiles.
|
|
|
|
*
|
|
|
|
* @return Size of the layer in tiles.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const Size& getLayerSize() const { return _layerSize; }
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Set size of the layer in tiles.
|
|
|
|
*
|
|
|
|
* @param size Size of the layer in tiles.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setLayerSize(const Size& size) { _layerSize = size; }
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Size of the map's tile (could be different from the tile's size).
|
|
|
|
*
|
|
|
|
* @return The size of the map's tile.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const Size& getMapTileSize() const { return _mapTileSize; }
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Set the size of the map's tile.
|
|
|
|
*
|
|
|
|
* @param size The size of the map's tile.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setMapTileSize(const Size& size) { _mapTileSize = size; }
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Pointer to the map of tiles.
|
2013-09-13 11:41:20 +08:00
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
2015-03-21 17:06:26 +08:00
|
|
|
* @return Pointer to the map of tiles.
|
2013-09-13 11:41:20 +08:00
|
|
|
*/
|
2014-02-08 10:11:17 +08:00
|
|
|
uint32_t* getTiles() const { return _tiles; };
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Set a pointer to the map of tiles.
|
|
|
|
*
|
|
|
|
* @param tiles A pointer to the map of tiles.
|
|
|
|
*/
|
2014-02-08 10:11:17 +08:00
|
|
|
void setTiles(uint32_t* tiles) { _tiles = tiles; };
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Tileset information for the layer.
|
|
|
|
*
|
|
|
|
* @return Tileset information for the layer.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
TMXTilesetInfo* getTileSet() const { return _tileSet; }
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Set tileset information for the layer.
|
|
|
|
*
|
2015-03-27 11:39:31 +08:00
|
|
|
* @param info The tileset information for the layer.
|
2015-03-28 14:28:16 +08:00
|
|
|
* @js NA
|
2015-03-21 17:06:26 +08:00
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setTileSet(TMXTilesetInfo* info) {
|
2013-07-23 20:36:41 +08:00
|
|
|
CC_SAFE_RETAIN(info);
|
|
|
|
CC_SAFE_RELEASE(_tileSet);
|
|
|
|
_tileSet = info;
|
2016-09-20 14:43:48 +08:00
|
|
|
}
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Layer orientation, which is the same as the map orientation.
|
|
|
|
*
|
|
|
|
* @return Layer orientation, which is the same as the map orientation.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
int getLayerOrientation() const { return _layerOrientation; }
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Set layer orientation, which is the same as the map orientation.
|
|
|
|
*
|
|
|
|
* @param orientation Layer orientation,which is the same as the map orientation.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setLayerOrientation(int orientation) { _layerOrientation = orientation; }
|
2013-07-23 18:26:26 +08:00
|
|
|
|
2015-03-21 17:06:26 +08:00
|
|
|
/** Properties from the layer. They can be added using Tiled.
|
|
|
|
*
|
|
|
|
* @return Properties from the layer. They can be added using Tiled.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const ValueMap& getProperties() const { return _properties; }
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Properties from the layer. They can be added using Tiled.
|
|
|
|
*
|
|
|
|
* @return Properties from the layer. They can be added using Tiled.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
ValueMap& getProperties() { return _properties; }
|
2015-03-21 17:06:26 +08:00
|
|
|
|
|
|
|
/** Set an Properties from to layer.
|
|
|
|
*
|
|
|
|
* @param properties It is used to set the layer 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-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Override
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
/** TMXLayer doesn't support adding a Sprite manually.
|
2015-12-03 20:00:51 +08:00
|
|
|
@warning addChild(z, tag); is not supported on TMXLayer. Instead of setTileGID.
|
2013-07-16 03:43:22 +08:00
|
|
|
*/
|
2013-12-23 21:53:23 +08:00
|
|
|
using SpriteBatchNode::addChild;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void addChild(Node * child, int zOrder, int tag) override;
|
2012-04-19 14:35:52 +08:00
|
|
|
// super method
|
2013-07-16 03:43:22 +08:00
|
|
|
void removeChild(Node* child, bool cleanup) override;
|
2015-03-28 14:28:16 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
*/
|
2013-12-13 06:30:22 +08:00
|
|
|
virtual std::string getDescription() const override;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-11-26 09:53:52 +08:00
|
|
|
protected:
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec2 getPositionForIsoAt(const Vec2& pos);
|
|
|
|
Vec2 getPositionForOrthoAt(const Vec2& pos);
|
|
|
|
Vec2 getPositionForHexAt(const Vec2& pos);
|
2014-10-10 17:52:13 +08:00
|
|
|
Vec2 getPositionForStaggeredAt(const Vec2& pos);
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec2 calculateLayerOffset(const Vec2& offset);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-09-17 15:02:24 +08:00
|
|
|
/* optimization methods */
|
2014-05-15 01:07:09 +08:00
|
|
|
Sprite* appendTileForGID(uint32_t gid, const Vec2& pos);
|
|
|
|
Sprite* insertTileForGID(uint32_t gid, const Vec2& pos);
|
|
|
|
Sprite* updateTileForGID(uint32_t gid, const Vec2& pos);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2016-09-14 12:47:36 +08:00
|
|
|
intptr_t getZForPos(const Vec2& pos) const;
|
|
|
|
|
2015-12-03 20:00:51 +08:00
|
|
|
/* The layer recognizes some special properties, like cc_vertexz */
|
2012-04-19 14:35:52 +08:00
|
|
|
void parseInternalProperties();
|
2016-05-17 12:17:56 +08:00
|
|
|
void setupTileSprite(Sprite* sprite, const Vec2& pos, int gid);
|
|
|
|
Sprite* reusedTileWithRect(const Rect& rect);
|
2014-05-15 01:07:09 +08:00
|
|
|
int getVertexZForPos(const Vec2& pos);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// index
|
2013-12-20 09:50:53 +08:00
|
|
|
ssize_t atlasIndexForExistantZ(int z);
|
2013-12-12 12:07:20 +08:00
|
|
|
ssize_t atlasIndexForNewZ(int z);
|
2014-11-26 09:53:52 +08:00
|
|
|
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//! name of the layer
|
2013-06-15 14:03:30 +08:00
|
|
|
std::string _layerName;
|
2012-04-19 14:35:52 +08:00
|
|
|
//! TMX Layer supports opacity
|
2014-11-26 09:53:52 +08:00
|
|
|
unsigned char _opacity;
|
2013-12-23 10:37:46 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//! Only used when vertexZ is used
|
2014-11-26 09:53:52 +08:00
|
|
|
int _vertexZvalue;
|
|
|
|
bool _useAutomaticVertexZ;
|
2012-03-16 13:42:53 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//! used for optimization
|
2014-11-26 09:53:52 +08:00
|
|
|
Sprite *_reusedTile;
|
|
|
|
ccCArray *_atlasIndexArray;
|
2012-03-16 13:42:53 +08:00
|
|
|
|
|
|
|
// used for retina display
|
2014-11-26 09:53:52 +08:00
|
|
|
float _contentScaleFactor;
|
2013-07-19 14:57:54 +08:00
|
|
|
|
|
|
|
/** size of the layer in tiles */
|
2013-07-23 18:26:26 +08:00
|
|
|
Size _layerSize;
|
2013-07-19 14:57:54 +08:00
|
|
|
/** size of the map's tile (could be different from the tile's size) */
|
2013-07-23 18:26:26 +08:00
|
|
|
Size _mapTileSize;
|
2013-07-19 14:57:54 +08:00
|
|
|
/** pointer to the map of tiles */
|
2014-02-08 10:11:17 +08:00
|
|
|
uint32_t* _tiles;
|
2013-07-19 14:57:54 +08:00
|
|
|
/** Tileset information for the layer */
|
2013-07-23 18:26:26 +08:00
|
|
|
TMXTilesetInfo* _tileSet;
|
2013-07-19 14:57:54 +08:00
|
|
|
/** Layer orientation, which is the same as the map orientation */
|
2013-12-20 09:50:53 +08:00
|
|
|
int _layerOrientation;
|
2016-07-02 06:51:00 +08:00
|
|
|
/** Stagger Axis */
|
|
|
|
int _staggerAxis;
|
|
|
|
/** Stagger Index */
|
|
|
|
int _staggerIndex;
|
|
|
|
/** Hex side length*/
|
|
|
|
int _hexSideLength;
|
2013-07-19 14:57:54 +08:00
|
|
|
/** properties from the layer. They can be added using Tiled */
|
2013-12-04 17:46:57 +08:00
|
|
|
ValueMap _properties;
|
2012-03-16 13:42:53 +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-03-16 13:42:53 +08:00
|
|
|
NS_CC_END
|
|
|
|
|
2011-03-19 10:59:01 +08:00
|
|
|
#endif //__CCTMX_LAYER_H__
|
|
|
|
|