mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_hot_fix
This commit is contained in:
commit
ab0fe54d32
|
@ -51,14 +51,14 @@ THE SOFTWARE.
|
|||
NS_CC_BEGIN
|
||||
namespace experimental {
|
||||
|
||||
const int FastTMXLayer::FAST_TMX_ORIENTATION_ORTHO = 0;
|
||||
const int FastTMXLayer::FAST_TMX_ORIENTATION_HEX = 1;
|
||||
const int FastTMXLayer::FAST_TMX_ORIENTATION_ISO = 2;
|
||||
const int TMXLayer::FAST_TMX_ORIENTATION_ORTHO = 0;
|
||||
const int TMXLayer::FAST_TMX_ORIENTATION_HEX = 1;
|
||||
const int TMXLayer::FAST_TMX_ORIENTATION_ISO = 2;
|
||||
|
||||
// FastTMXLayer - init & alloc & dealloc
|
||||
FastTMXLayer * FastTMXLayer::create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
|
||||
TMXLayer * TMXLayer::create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
|
||||
{
|
||||
FastTMXLayer *ret = new FastTMXLayer();
|
||||
TMXLayer *ret = new TMXLayer();
|
||||
if (ret->initWithTilesetInfo(tilesetInfo, layerInfo, mapInfo))
|
||||
{
|
||||
ret->autorelease();
|
||||
|
@ -67,7 +67,7 @@ FastTMXLayer * FastTMXLayer::create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *l
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool FastTMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
|
||||
bool TMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
|
||||
{
|
||||
|
||||
if( tilesetInfo )
|
||||
|
@ -109,7 +109,7 @@ bool FastTMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo
|
|||
return true;
|
||||
}
|
||||
|
||||
FastTMXLayer::FastTMXLayer()
|
||||
TMXLayer::TMXLayer()
|
||||
: _layerName("")
|
||||
, _layerSize(Size::ZERO)
|
||||
, _mapTileSize(Size::ZERO)
|
||||
|
@ -125,7 +125,7 @@ FastTMXLayer::FastTMXLayer()
|
|||
_buffersVBO[0] = _buffersVBO[1] = 0;
|
||||
}
|
||||
|
||||
FastTMXLayer::~FastTMXLayer()
|
||||
TMXLayer::~TMXLayer()
|
||||
{
|
||||
CC_SAFE_RELEASE(_tileSet);
|
||||
CC_SAFE_RELEASE(_texture);
|
||||
|
@ -141,7 +141,7 @@ FastTMXLayer::~FastTMXLayer()
|
|||
}
|
||||
}
|
||||
|
||||
void FastTMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flags)
|
||||
void TMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flags)
|
||||
{
|
||||
updateTotalQuads();
|
||||
|
||||
|
@ -170,13 +170,13 @@ void FastTMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flag
|
|||
auto& cmd = _renderCommands[index++];
|
||||
|
||||
cmd.init(iter.first);
|
||||
cmd.func = CC_CALLBACK_0(FastTMXLayer::onDraw, this, _indicesVertexZOffsets[iter.first], iter.second);
|
||||
cmd.func = CC_CALLBACK_0(TMXLayer::onDraw, this, _indicesVertexZOffsets[iter.first], iter.second);
|
||||
renderer->addCommand(&cmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FastTMXLayer::onDraw(int offset, int count)
|
||||
void TMXLayer::onDraw(int offset, int count)
|
||||
{
|
||||
GL::bindTexture2D(_texture->getName());
|
||||
getGLProgramState()->apply(_modelViewTransform);
|
||||
|
@ -195,7 +195,7 @@ void FastTMXLayer::onDraw(int offset, int count)
|
|||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, count * 4);
|
||||
}
|
||||
|
||||
void FastTMXLayer::updateTiles(const Rect& culledRect)
|
||||
void TMXLayer::updateTiles(const Rect& culledRect)
|
||||
{
|
||||
Rect visibleTiles = culledRect;
|
||||
Size mapTileSize = CC_SIZE_PIXELS_TO_POINTS(_mapTileSize);
|
||||
|
@ -288,7 +288,7 @@ void FastTMXLayer::updateTiles(const Rect& culledRect)
|
|||
|
||||
}
|
||||
|
||||
void FastTMXLayer::updateVertexBuffer()
|
||||
void TMXLayer::updateVertexBuffer()
|
||||
{
|
||||
GL::bindVAO(0);
|
||||
if(!glIsBuffer(_buffersVBO[0]))
|
||||
|
@ -301,7 +301,7 @@ void FastTMXLayer::updateVertexBuffer()
|
|||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
void FastTMXLayer::updateIndexBuffer()
|
||||
void TMXLayer::updateIndexBuffer()
|
||||
{
|
||||
if(!glIsBuffer(_buffersVBO[1]))
|
||||
{
|
||||
|
@ -313,7 +313,7 @@ void FastTMXLayer::updateIndexBuffer()
|
|||
}
|
||||
|
||||
// FastTMXLayer - setup Tiles
|
||||
void FastTMXLayer::setupTiles()
|
||||
void TMXLayer::setupTiles()
|
||||
{
|
||||
// Optimization: quick hack that sets the image size on the tileset
|
||||
_tileSet->_imageSize = _texture->getContentSizeInPixels();
|
||||
|
@ -353,7 +353,7 @@ void FastTMXLayer::setupTiles()
|
|||
|
||||
}
|
||||
|
||||
Mat4 FastTMXLayer::tileToNodeTransform()
|
||||
Mat4 TMXLayer::tileToNodeTransform()
|
||||
{
|
||||
float w = _mapTileSize.width / CC_CONTENT_SCALE_FACTOR();
|
||||
float h = _mapTileSize.height / CC_CONTENT_SCALE_FACTOR();
|
||||
|
@ -405,7 +405,7 @@ Mat4 FastTMXLayer::tileToNodeTransform()
|
|||
|
||||
}
|
||||
|
||||
void FastTMXLayer::updateTotalQuads()
|
||||
void TMXLayer::updateTotalQuads()
|
||||
{
|
||||
if(_quadsDirty)
|
||||
{
|
||||
|
@ -537,7 +537,7 @@ void FastTMXLayer::updateTotalQuads()
|
|||
}
|
||||
|
||||
// removing / getting tiles
|
||||
Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
|
||||
Sprite* TMXLayer::getTileAt(const Vec2& tileCoordinate)
|
||||
{
|
||||
CCASSERT( tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
|
||||
CCASSERT( _tiles, "TMXLayer: the tiles map has been released");
|
||||
|
@ -577,7 +577,7 @@ Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
|
|||
return tile;
|
||||
}
|
||||
|
||||
int FastTMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags/* = nullptr*/)
|
||||
int TMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags/* = nullptr*/)
|
||||
{
|
||||
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
|
||||
CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
|
||||
|
@ -603,12 +603,12 @@ int FastTMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags/*
|
|||
return (tile & kTMXFlippedMask);
|
||||
}
|
||||
|
||||
Vec2 FastTMXLayer::getPositionAt(const Vec2& pos)
|
||||
Vec2 TMXLayer::getPositionAt(const Vec2& pos)
|
||||
{
|
||||
return PointApplyTransform(pos, _tileToNodeTransform);
|
||||
}
|
||||
|
||||
int FastTMXLayer::getVertexZForPos(const Vec2& pos)
|
||||
int TMXLayer::getVertexZForPos(const Vec2& pos)
|
||||
{
|
||||
int ret = 0;
|
||||
int maxVal = 0;
|
||||
|
@ -639,7 +639,7 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void FastTMXLayer::removeTileAt(const Vec2& tileCoordinate)
|
||||
void TMXLayer::removeTileAt(const Vec2& tileCoordinate)
|
||||
{
|
||||
|
||||
CCASSERT( tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
|
||||
|
@ -662,7 +662,7 @@ void FastTMXLayer::removeTileAt(const Vec2& tileCoordinate)
|
|||
}
|
||||
}
|
||||
|
||||
void FastTMXLayer::setFlaggedTileGIDByIndex(int index, int gid)
|
||||
void TMXLayer::setFlaggedTileGIDByIndex(int index, int gid)
|
||||
{
|
||||
if(gid == _tiles[index]) return;
|
||||
_tiles[index] = gid;
|
||||
|
@ -670,7 +670,7 @@ void FastTMXLayer::setFlaggedTileGIDByIndex(int index, int gid)
|
|||
_dirty = true;
|
||||
}
|
||||
|
||||
void FastTMXLayer::removeChild(Node* node, bool cleanup)
|
||||
void TMXLayer::removeChild(Node* node, bool cleanup)
|
||||
{
|
||||
int tag = node->getTag();
|
||||
auto it = _spriteContainer.find(tag);
|
||||
|
@ -681,8 +681,8 @@ void FastTMXLayer::removeChild(Node* node, bool cleanup)
|
|||
Node::removeChild(node, cleanup);
|
||||
}
|
||||
|
||||
// FastTMXLayer - Properties
|
||||
Value FastTMXLayer::getProperty(const std::string& propertyName) const
|
||||
// TMXLayer - Properties
|
||||
Value TMXLayer::getProperty(const std::string& propertyName) const
|
||||
{
|
||||
if (_properties.find(propertyName) != _properties.end())
|
||||
return _properties.at(propertyName);
|
||||
|
@ -690,7 +690,7 @@ Value FastTMXLayer::getProperty(const std::string& propertyName) const
|
|||
return Value();
|
||||
}
|
||||
|
||||
void FastTMXLayer::parseInternalProperties()
|
||||
void TMXLayer::parseInternalProperties()
|
||||
{
|
||||
auto vertexz = getProperty("cc_vertexz");
|
||||
if (vertexz.isNull()) return;
|
||||
|
@ -720,7 +720,7 @@ void FastTMXLayer::parseInternalProperties()
|
|||
}
|
||||
|
||||
//CCTMXLayer2 - obtaining positions, offset
|
||||
Vec2 FastTMXLayer::calculateLayerOffset(const Vec2& pos)
|
||||
Vec2 TMXLayer::calculateLayerOffset(const Vec2& pos)
|
||||
{
|
||||
Vec2 ret = Vec2::ZERO;
|
||||
switch (_layerOrientation)
|
||||
|
@ -741,12 +741,12 @@ Vec2 FastTMXLayer::calculateLayerOffset(const Vec2& pos)
|
|||
}
|
||||
|
||||
// TMXLayer - adding / remove tiles
|
||||
void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate)
|
||||
void TMXLayer::setTileGID(int gid, const Vec2& tileCoordinate)
|
||||
{
|
||||
setTileGID(gid, tileCoordinate, (TMXTileFlags)0);
|
||||
}
|
||||
|
||||
void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flags)
|
||||
void TMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flags)
|
||||
{
|
||||
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
|
||||
CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
|
||||
|
@ -797,7 +797,7 @@ void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags
|
|||
}
|
||||
}
|
||||
|
||||
void FastTMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid)
|
||||
void TMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid)
|
||||
{
|
||||
sprite->setPosition(getPositionAt(pos));
|
||||
sprite->setPositionZ((float)getVertexZForPos(pos));
|
||||
|
@ -853,7 +853,7 @@ void FastTMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid)
|
|||
}
|
||||
}
|
||||
|
||||
std::string FastTMXLayer::getDescription() const
|
||||
std::string TMXLayer::getDescription() const
|
||||
{
|
||||
return StringUtils::format("<FastTMXLayer | tag = %d, size = %d,%d>", _tag, (int)_mapTileSize.width, (int)_mapTileSize.height);
|
||||
}
|
||||
|
|
|
@ -78,20 +78,20 @@ http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps
|
|||
@since v3.2
|
||||
*/
|
||||
|
||||
class CC_DLL FastTMXLayer : public Node
|
||||
class CC_DLL TMXLayer : public Node
|
||||
{
|
||||
public:
|
||||
/** creates a FastTMXLayer with an tileset info, a layer info and a map info */
|
||||
static FastTMXLayer * create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||
static TMXLayer * create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
FastTMXLayer();
|
||||
TMXLayer();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~FastTMXLayer();
|
||||
virtual ~TMXLayer();
|
||||
|
||||
/** returns the tile gid at a given tile coordinate. It also returns the tile flags.
|
||||
*/
|
||||
|
|
|
@ -38,9 +38,9 @@ namespace experimental {
|
|||
|
||||
// implementation FastTMXTiledMap
|
||||
|
||||
FastTMXTiledMap * FastTMXTiledMap::create(const std::string& tmxFile)
|
||||
TMXTiledMap * TMXTiledMap::create(const std::string& tmxFile)
|
||||
{
|
||||
FastTMXTiledMap *ret = new FastTMXTiledMap();
|
||||
TMXTiledMap *ret = new TMXTiledMap();
|
||||
if (ret->initWithTMXFile(tmxFile))
|
||||
{
|
||||
ret->autorelease();
|
||||
|
@ -50,9 +50,9 @@ FastTMXTiledMap * FastTMXTiledMap::create(const std::string& tmxFile)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
FastTMXTiledMap* FastTMXTiledMap::createWithXML(const std::string& tmxString, const std::string& resourcePath)
|
||||
TMXTiledMap* TMXTiledMap::createWithXML(const std::string& tmxString, const std::string& resourcePath)
|
||||
{
|
||||
FastTMXTiledMap *ret = new FastTMXTiledMap();
|
||||
TMXTiledMap *ret = new TMXTiledMap();
|
||||
if (ret->initWithXML(tmxString, resourcePath))
|
||||
{
|
||||
ret->autorelease();
|
||||
|
@ -62,7 +62,7 @@ FastTMXTiledMap* FastTMXTiledMap::createWithXML(const std::string& tmxString, co
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool FastTMXTiledMap::initWithTMXFile(const std::string& tmxFile)
|
||||
bool TMXTiledMap::initWithTMXFile(const std::string& tmxFile)
|
||||
{
|
||||
CCASSERT(tmxFile.size()>0, "FastTMXTiledMap: tmx file should not be empty");
|
||||
|
||||
|
@ -80,7 +80,7 @@ bool FastTMXTiledMap::initWithTMXFile(const std::string& tmxFile)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FastTMXTiledMap::initWithXML(const std::string& tmxString, const std::string& resourcePath)
|
||||
bool TMXTiledMap::initWithXML(const std::string& tmxString, const std::string& resourcePath)
|
||||
{
|
||||
setContentSize(Size::ZERO);
|
||||
|
||||
|
@ -92,21 +92,21 @@ bool FastTMXTiledMap::initWithXML(const std::string& tmxString, const std::strin
|
|||
return true;
|
||||
}
|
||||
|
||||
FastTMXTiledMap::FastTMXTiledMap()
|
||||
TMXTiledMap::TMXTiledMap()
|
||||
:_mapSize(Size::ZERO)
|
||||
,_tileSize(Size::ZERO)
|
||||
{
|
||||
}
|
||||
|
||||
FastTMXTiledMap::~FastTMXTiledMap()
|
||||
TMXTiledMap::~TMXTiledMap()
|
||||
{
|
||||
}
|
||||
|
||||
// private
|
||||
FastTMXLayer * FastTMXTiledMap::parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
|
||||
TMXLayer * TMXTiledMap::parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
|
||||
{
|
||||
TMXTilesetInfo *tileset = tilesetForLayer(layerInfo, mapInfo);
|
||||
FastTMXLayer *layer = FastTMXLayer::create(tileset, layerInfo, mapInfo);
|
||||
TMXLayer *layer = TMXLayer::create(tileset, layerInfo, mapInfo);
|
||||
|
||||
// tell the layerinfo to release the ownership of the tiles map.
|
||||
layerInfo->_ownTiles = false;
|
||||
|
@ -115,7 +115,7 @@ FastTMXLayer * FastTMXTiledMap::parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *
|
|||
return layer;
|
||||
}
|
||||
|
||||
TMXTilesetInfo * FastTMXTiledMap::tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
|
||||
TMXTilesetInfo * TMXTiledMap::tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
|
||||
{
|
||||
Size size = layerInfo->_layerSize;
|
||||
auto& tilesets = mapInfo->getTilesets();
|
||||
|
@ -156,7 +156,7 @@ TMXTilesetInfo * FastTMXTiledMap::tilesetForLayer(TMXLayerInfo *layerInfo, TMXMa
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
|
||||
void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
|
||||
{
|
||||
_mapSize = mapInfo->getMapSize();
|
||||
_tileSize = mapInfo->getTileSize();
|
||||
|
@ -174,7 +174,7 @@ void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
|
|||
for(const auto &layerInfo : layers) {
|
||||
if (layerInfo->_visible)
|
||||
{
|
||||
FastTMXLayer *child = parseLayer(layerInfo, mapInfo);
|
||||
TMXLayer *child = parseLayer(layerInfo, mapInfo);
|
||||
addChild(child, idx, idx);
|
||||
|
||||
// update content size with the max size
|
||||
|
@ -190,13 +190,13 @@ void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
|
|||
}
|
||||
|
||||
// public
|
||||
FastTMXLayer * FastTMXTiledMap::getLayer(const std::string& layerName) const
|
||||
TMXLayer * TMXTiledMap::getLayer(const std::string& layerName) const
|
||||
{
|
||||
CCASSERT(layerName.size() > 0, "Invalid layer name!");
|
||||
|
||||
for (auto& child : _children)
|
||||
{
|
||||
FastTMXLayer* layer = dynamic_cast<FastTMXLayer*>(child);
|
||||
TMXLayer* layer = dynamic_cast<TMXLayer*>(child);
|
||||
if(layer)
|
||||
{
|
||||
if(layerName.compare( layer->getLayerName()) == 0)
|
||||
|
@ -210,7 +210,7 @@ FastTMXLayer * FastTMXTiledMap::getLayer(const std::string& layerName) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
TMXObjectGroup * FastTMXTiledMap::getObjectGroup(const std::string& groupName) const
|
||||
TMXObjectGroup * TMXTiledMap::getObjectGroup(const std::string& groupName) const
|
||||
{
|
||||
CCASSERT(groupName.size() > 0, "Invalid group name!");
|
||||
|
||||
|
@ -231,7 +231,7 @@ TMXObjectGroup * FastTMXTiledMap::getObjectGroup(const std::string& groupName) c
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Value FastTMXTiledMap::getProperty(const std::string& propertyName) const
|
||||
Value TMXTiledMap::getProperty(const std::string& propertyName) const
|
||||
{
|
||||
if (_properties.find(propertyName) != _properties.end())
|
||||
return _properties.at(propertyName);
|
||||
|
@ -239,7 +239,7 @@ Value FastTMXTiledMap::getProperty(const std::string& propertyName) const
|
|||
return Value();
|
||||
}
|
||||
|
||||
Value FastTMXTiledMap::getPropertiesForGID(int GID) const
|
||||
Value TMXTiledMap::getPropertiesForGID(int GID) const
|
||||
{
|
||||
if (_tileProperties.find(GID) != _tileProperties.end())
|
||||
return _tileProperties.at(GID);
|
||||
|
@ -247,7 +247,7 @@ Value FastTMXTiledMap::getPropertiesForGID(int GID) const
|
|||
return Value();
|
||||
}
|
||||
|
||||
std::string FastTMXTiledMap::getDescription() const
|
||||
std::string TMXTiledMap::getDescription() const
|
||||
{
|
||||
return StringUtils::format("<FastTMXTiledMap | Tag = %d, Layers = %d", _tag, static_cast<int>(_children.size()));
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class TMXMapInfo;
|
|||
|
||||
namespace experimental {
|
||||
|
||||
class FastTMXLayer;
|
||||
class TMXLayer;
|
||||
|
||||
/** @brief FastTMXTiledMap knows how to parse and render a TMX map.
|
||||
|
||||
|
@ -92,17 +92,17 @@ object->getProperty(name_of_the_property);
|
|||
|
||||
@since v3.2
|
||||
*/
|
||||
class CC_DLL FastTMXTiledMap : public Node
|
||||
class CC_DLL TMXTiledMap : public Node
|
||||
{
|
||||
public:
|
||||
/** creates a TMX Tiled Map with a TMX file.*/
|
||||
static FastTMXTiledMap* create(const std::string& tmxFile);
|
||||
static TMXTiledMap* create(const std::string& tmxFile);
|
||||
|
||||
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
|
||||
static FastTMXTiledMap* createWithXML(const std::string& tmxString, const std::string& resourcePath);
|
||||
static TMXTiledMap* createWithXML(const std::string& tmxString, const std::string& resourcePath);
|
||||
|
||||
/** return the FastTMXLayer for the specific layer */
|
||||
FastTMXLayer* getLayer(const std::string& layerName) const;
|
||||
TMXLayer* getLayer(const std::string& layerName) const;
|
||||
|
||||
/** return the TMXObjectGroup for the specific group */
|
||||
TMXObjectGroup* getObjectGroup(const std::string& groupName) const;
|
||||
|
@ -144,12 +144,12 @@ protected:
|
|||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
FastTMXTiledMap();
|
||||
TMXTiledMap();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~FastTMXTiledMap();
|
||||
virtual ~TMXTiledMap();
|
||||
|
||||
/** initializes a TMX Tiled Map with a TMX file */
|
||||
bool initWithTMXFile(const std::string& tmxFile);
|
||||
|
@ -157,7 +157,7 @@ protected:
|
|||
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
|
||||
bool initWithXML(const std::string& tmxString, const std::string& resourcePath);
|
||||
|
||||
FastTMXLayer * parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||
TMXLayer * parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||
TMXTilesetInfo * tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||
void buildWithMapInfo(TMXMapInfo* mapInfo);
|
||||
|
||||
|
@ -176,7 +176,7 @@ protected:
|
|||
ValueMapIntKey _tileProperties;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FastTMXTiledMap);
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TMXTiledMap);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -74,11 +74,13 @@
|
|||
-- @function [parent=#FileUtils] addSearchResolutionsOrder
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#FileUtils] addSearchPath
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#FileUtils] isFileExist
|
||||
|
|
|
@ -15520,6 +15520,19 @@ int lua_cocos2dx_FileUtils_addSearchResolutionsOrder(lua_State* tolua_S)
|
|||
cobj->addSearchResolutionsOrder(arg0);
|
||||
return 0;
|
||||
}
|
||||
if (argc == 2)
|
||||
{
|
||||
std::string arg0;
|
||||
bool arg1;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 3,&arg1);
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->addSearchResolutionsOrder(arg0, arg1);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "addSearchResolutionsOrder",argc, 1);
|
||||
return 0;
|
||||
|
||||
|
@ -15566,6 +15579,19 @@ int lua_cocos2dx_FileUtils_addSearchPath(lua_State* tolua_S)
|
|||
cobj->addSearchPath(arg0);
|
||||
return 0;
|
||||
}
|
||||
if (argc == 2)
|
||||
{
|
||||
std::string arg0;
|
||||
bool arg1;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 3,&arg1);
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->addSearchPath(arg0, arg1);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "addSearchPath",argc, 1);
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#include "2d/CCFastTMXLayer.h"
|
||||
#include "2d/CCFastTMXTiledMap.h"
|
||||
|
||||
using cocos2d::experimental::FastTMXLayer;
|
||||
using cocos2d::experimental::FastTMXTiledMap;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -290,7 +288,7 @@ TMXOrthoTestNew::TMXOrthoTestNew()
|
|||
//auto color = LayerColor::create( Color4B(64,64,64,255) );
|
||||
//addChild(color, -1);
|
||||
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test2.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test2.tmx");
|
||||
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
|
@ -333,7 +331,7 @@ std::string TMXOrthoTestNew::title() const
|
|||
//------------------------------------------------------------------
|
||||
TMXOrthoTest2New::TMXOrthoTest2New()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test1.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test1.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -354,7 +352,7 @@ std::string TMXOrthoTest2New::title() const
|
|||
//------------------------------------------------------------------
|
||||
TMXOrthoTest3New::TMXOrthoTest3New()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test3.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test3.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -376,7 +374,7 @@ std::string TMXOrthoTest3New::title() const
|
|||
//------------------------------------------------------------------
|
||||
TMXOrthoTest4New::TMXOrthoTest4New()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test4.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test4.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s1 = map->getContentSize();
|
||||
|
@ -405,7 +403,7 @@ void TMXOrthoTest4New::removeSprite(float dt)
|
|||
{
|
||||
unschedule(schedule_selector(TMXOrthoTest4New::removeSprite));
|
||||
|
||||
auto map = static_cast<FastTMXTiledMap*>( getChildByTag(kTagTileMap) );
|
||||
auto map = static_cast<cocos2d::experimental::TMXTiledMap*>( getChildByTag(kTagTileMap) );
|
||||
auto layer = map->getLayer("Layer 0");
|
||||
auto s = layer->getLayerSize();
|
||||
|
||||
|
@ -438,7 +436,7 @@ TMXReadWriteTestNew::TMXReadWriteTestNew()
|
|||
{
|
||||
_gid = 0;
|
||||
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test2.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test2.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -504,8 +502,8 @@ void TMXReadWriteTestNew::removeSprite(Node* sender)
|
|||
|
||||
void TMXReadWriteTestNew::updateCol(float dt)
|
||||
{
|
||||
auto map = (FastTMXTiledMap*)getChildByTag(kTagTileMap);
|
||||
auto layer = (FastTMXLayer*)map->getChildByTag(0);
|
||||
auto map = (cocos2d::experimental::TMXTiledMap*)getChildByTag(kTagTileMap);
|
||||
auto layer = (cocos2d::experimental::TMXLayer*)map->getChildByTag(0);
|
||||
|
||||
////----CCLOG("++++atlas quantity: %d", layer->textureAtlas()->getTotalQuads());
|
||||
////----CCLOG("++++children: %d", layer->getChildren()->count() );
|
||||
|
@ -525,8 +523,8 @@ void TMXReadWriteTestNew::repaintWithGID(float dt)
|
|||
{
|
||||
// unschedule:_cmd);
|
||||
|
||||
auto map = (FastTMXTiledMap*)getChildByTag(kTagTileMap);
|
||||
auto layer = (FastTMXLayer*)map->getChildByTag(0);
|
||||
auto map = (cocos2d::experimental::TMXTiledMap*)getChildByTag(kTagTileMap);
|
||||
auto layer = (cocos2d::experimental::TMXLayer*)map->getChildByTag(0);
|
||||
|
||||
auto s = layer->getLayerSize();
|
||||
for( int x=0; x<s.width;x++)
|
||||
|
@ -541,8 +539,8 @@ void TMXReadWriteTestNew::removeTiles(float dt)
|
|||
{
|
||||
unschedule(schedule_selector(TMXReadWriteTestNew::removeTiles));
|
||||
|
||||
auto map = (FastTMXTiledMap*)getChildByTag(kTagTileMap);
|
||||
auto layer = (FastTMXLayer*)map->getChildByTag(0);
|
||||
auto map = (cocos2d::experimental::TMXTiledMap*)getChildByTag(kTagTileMap);
|
||||
auto layer = (cocos2d::experimental::TMXLayer*)map->getChildByTag(0);
|
||||
auto s = layer->getLayerSize();
|
||||
|
||||
for( int y=0; y< s.height; y++ )
|
||||
|
@ -568,7 +566,7 @@ TMXHexTestNew::TMXHexTestNew()
|
|||
auto color = LayerColor::create( Color4B(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
auto map = FastTMXTiledMap::create("TileMaps/hexa-test.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/hexa-test.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -590,7 +588,7 @@ TMXIsoTestNew::TMXIsoTestNew()
|
|||
auto color = LayerColor::create( Color4B(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
auto map = FastTMXTiledMap::create("TileMaps/iso-test.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/iso-test.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
// move map to the center of the screen
|
||||
|
@ -614,7 +612,7 @@ TMXIsoTest1New::TMXIsoTest1New()
|
|||
auto color = LayerColor::create( Color4B(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
auto map = FastTMXTiledMap::create("TileMaps/iso-test1.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/iso-test1.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -638,7 +636,7 @@ TMXIsoTest2New::TMXIsoTest2New()
|
|||
auto color = LayerColor::create( Color4B(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
auto map = FastTMXTiledMap::create("TileMaps/iso-test2.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/iso-test2.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -665,7 +663,7 @@ TMXUncompressedTestNew::TMXUncompressedTestNew()
|
|||
auto color = LayerColor::create( Color4B(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
auto map = FastTMXTiledMap::create("TileMaps/iso-test2-uncompressed.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/iso-test2-uncompressed.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -678,11 +676,11 @@ TMXUncompressedTestNew::TMXUncompressedTestNew()
|
|||
|
||||
//unsupported
|
||||
// // testing release map
|
||||
// FastTMXLayer* layer;
|
||||
// TMXLayer* layer;
|
||||
//
|
||||
// auto& children = map->getChildren();
|
||||
// for(const auto &node : children) {
|
||||
// layer= static_cast<FastTMXLayer*>(node);
|
||||
// layer= static_cast<TMXLayer*>(node);
|
||||
// layer->releaseMap();
|
||||
// }
|
||||
|
||||
|
@ -700,7 +698,7 @@ std::string TMXUncompressedTestNew::title() const
|
|||
//------------------------------------------------------------------
|
||||
TMXTilesetTestNew::TMXTilesetTestNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test5.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test5.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -719,7 +717,7 @@ std::string TMXTilesetTestNew::title() const
|
|||
//------------------------------------------------------------------
|
||||
TMXOrthoObjectsTestNew::TMXOrthoObjectsTestNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/ortho-objects.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/ortho-objects.tmx");
|
||||
addChild(map, -1, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -746,7 +744,7 @@ void TMXOrthoObjectsTestNew::onDraw(const Mat4 &transform, uint32_t flags)
|
|||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
||||
|
||||
auto map = static_cast<FastTMXTiledMap*>( getChildByTag(kTagTileMap) );
|
||||
auto map = static_cast<cocos2d::experimental::TMXTiledMap*>( getChildByTag(kTagTileMap) );
|
||||
auto pos = map->getPosition();
|
||||
auto group = map->getObjectGroup("Object Group 1");
|
||||
|
||||
|
@ -793,7 +791,7 @@ std::string TMXOrthoObjectsTestNew::subtitle() const
|
|||
|
||||
TMXIsoObjectsTestNew::TMXIsoObjectsTestNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/iso-test-objectgroup.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/iso-test-objectgroup.tmx");
|
||||
addChild(map, -1, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -821,7 +819,7 @@ void TMXIsoObjectsTestNew::onDraw(const Mat4 &transform, uint32_t flags)
|
|||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
||||
|
||||
auto map = (FastTMXTiledMap*) getChildByTag(kTagTileMap);
|
||||
auto map = (cocos2d::experimental::TMXTiledMap*) getChildByTag(kTagTileMap);
|
||||
auto pos = map->getPosition();
|
||||
auto group = map->getObjectGroup("Object Group 1");
|
||||
|
||||
|
@ -866,13 +864,13 @@ std::string TMXIsoObjectsTestNew::subtitle() const
|
|||
|
||||
TMXResizeTestNew::TMXResizeTestNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test5.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test5.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
CCLOG("ContentSize: %f, %f", s.width,s.height);
|
||||
|
||||
FastTMXLayer* layer;
|
||||
cocos2d::experimental::TMXLayer* layer;
|
||||
layer = map->getLayer("Layer 0");
|
||||
|
||||
auto ls = layer->getLayerSize();
|
||||
|
@ -903,7 +901,7 @@ std::string TMXResizeTestNew::subtitle() const
|
|||
//------------------------------------------------------------------
|
||||
TMXIsoZorderNew::TMXIsoZorderNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/iso-test-zorder.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/iso-test-zorder.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
auto s = map->getContentSize();
|
||||
|
@ -972,7 +970,7 @@ std::string TMXIsoZorderNew::subtitle() const
|
|||
//------------------------------------------------------------------
|
||||
TMXOrthoZorderNew::TMXOrthoZorderNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test-zorder.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test-zorder.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -1033,7 +1031,7 @@ std::string TMXOrthoZorderNew::subtitle() const
|
|||
//------------------------------------------------------------------
|
||||
TMXIsoVertexZNew::TMXIsoVertexZNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/iso-test-vertexz.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/iso-test-vertexz.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
auto s = map->getContentSize();
|
||||
|
@ -1105,7 +1103,7 @@ std::string TMXIsoVertexZNew::subtitle() const
|
|||
//------------------------------------------------------------------
|
||||
TMXOrthoVertexZNew::TMXOrthoVertexZNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test-vertexz.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test-vertexz.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -1176,7 +1174,7 @@ std::string TMXOrthoVertexZNew::subtitle() const
|
|||
//------------------------------------------------------------------
|
||||
TMXIsoMoveLayerNew::TMXIsoMoveLayerNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/iso-test-movelayer.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/iso-test-movelayer.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
map->setPosition(Vec2(-700,-50));
|
||||
|
@ -1203,7 +1201,7 @@ std::string TMXIsoMoveLayerNew::subtitle() const
|
|||
//------------------------------------------------------------------
|
||||
TMXOrthoMoveLayerNew::TMXOrthoMoveLayerNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test-movelayer.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test-movelayer.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -1228,7 +1226,7 @@ std::string TMXOrthoMoveLayerNew::subtitle() const
|
|||
|
||||
TMXTilePropertyTestNew::TMXTilePropertyTestNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/ortho-tile-property.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/ortho-tile-property.tmx");
|
||||
addChild(map ,0 ,kTagTileMap);
|
||||
|
||||
for(int i=1;i<=20;i++){
|
||||
|
@ -1257,7 +1255,7 @@ std::string TMXTilePropertyTestNew::subtitle() const
|
|||
|
||||
TMXOrthoFlipTestNew::TMXOrthoFlipTestNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/ortho-rotation-test.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/ortho-rotation-test.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -1280,7 +1278,7 @@ std::string TMXOrthoFlipTestNew::title() const
|
|||
|
||||
TMXOrthoFlipRunTimeTestNew::TMXOrthoFlipRunTimeTestNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/ortho-rotation-test.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/ortho-rotation-test.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
auto s = map->getContentSize();
|
||||
|
@ -1304,7 +1302,7 @@ std::string TMXOrthoFlipRunTimeTestNew::subtitle() const
|
|||
|
||||
void TMXOrthoFlipRunTimeTestNew::flipIt(float dt)
|
||||
{
|
||||
auto map = (FastTMXTiledMap*) getChildByTag(kTagTileMap);
|
||||
auto map = (cocos2d::experimental::TMXTiledMap*) getChildByTag(kTagTileMap);
|
||||
auto layer = map->getLayer("Layer 0");
|
||||
|
||||
//blue diamond
|
||||
|
@ -1352,7 +1350,7 @@ TMXOrthoFromXMLTestNew::TMXOrthoFromXMLTestNew()
|
|||
auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str());
|
||||
CCASSERT(str != nullptr, "Unable to open file");
|
||||
|
||||
auto map = FastTMXTiledMap::createWithXML(str->getCString() ,resources.c_str());
|
||||
auto map = cocos2d::experimental::TMXTiledMap::createWithXML(str->getCString() ,resources.c_str());
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
auto s = map->getContentSize();
|
||||
|
@ -1378,7 +1376,7 @@ TMXOrthoXMLFormatTestNew::TMXOrthoXMLFormatTestNew()
|
|||
// 1. load xml format tilemap
|
||||
// 2. gid lower than firstgid is ignored
|
||||
// 3. firstgid in tsx is ignored, tile property in tsx loaded correctly.
|
||||
auto map = FastTMXTiledMap::create("TileMaps/xml-test.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/xml-test.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
auto s = map->getContentSize();
|
||||
|
@ -1404,7 +1402,7 @@ std::string TMXOrthoXMLFormatTestNew::title() const
|
|||
//------------------------------------------------------------------
|
||||
TMXBug987New::TMXBug987New()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/orthogonal-test6.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/orthogonal-test6.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s1 = map->getContentSize();
|
||||
|
@ -1432,7 +1430,7 @@ std::string TMXBug987New::subtitle() const
|
|||
//------------------------------------------------------------------
|
||||
TMXBug787New::TMXBug787New()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/iso-test-bug787.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/iso-test-bug787.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
map->setScale(0.25f);
|
||||
|
@ -1455,7 +1453,7 @@ std::string TMXBug787New::subtitle() const
|
|||
//------------------------------------------------------------------
|
||||
TMXGIDObjectsTestNew::TMXGIDObjectsTestNew()
|
||||
{
|
||||
auto map = FastTMXTiledMap::create("TileMaps/test-object-layer.tmx");
|
||||
auto map = cocos2d::experimental::TMXTiledMap::create("TileMaps/test-object-layer.tmx");
|
||||
addChild(map, -1, kTagTileMap);
|
||||
|
||||
Size CC_UNUSED s = map->getContentSize();
|
||||
|
@ -1480,7 +1478,7 @@ void TMXGIDObjectsTestNew::onDraw(const Mat4 &transform, uint32_t flags)
|
|||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
||||
|
||||
auto map = (FastTMXTiledMap*)getChildByTag(kTagTileMap);
|
||||
auto map = (cocos2d::experimental::TMXTiledMap*)getChildByTag(kTagTileMap);
|
||||
auto pos = map->getPosition();
|
||||
auto group = map->getObjectGroup("Object Layer 1");
|
||||
|
||||
|
|
|
@ -77,7 +77,9 @@ Controller g_aTestNames[] = {
|
|||
{ "Node: Sprite", [](){return new SpriteTestScene(); } },
|
||||
{ "Node: Sprite3D", [](){ return new Sprite3DTestScene(); }},
|
||||
{ "Node: TileMap", [](){return new TileMapTestScene(); } },
|
||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
|
||||
{ "Node: FastTileMap", [](){return new TileMapTestSceneNew(); } },
|
||||
#endif
|
||||
{ "Node: Text Input", [](){return new TextInputTestScene(); } },
|
||||
{ "Node: UI", [](){ return new UITestScene(); }},
|
||||
{ "Mouse", []() { return new MouseTestScene(); } },
|
||||
|
|
|
@ -276,6 +276,10 @@ function GameControllerTest:registerControllerListener()
|
|||
holder._buttonL1:setColor(cc.c3b(19,231,238))
|
||||
elseif keyCode == cc.ControllerKey.BUTTON_RIGHT_SHOULDER then
|
||||
holder._buttonR1:setColor(cc.c3b(19,231,238))
|
||||
elseif keyCode == cc.ControllerKey.BUTTON_LEFT_THUMBSTICK then
|
||||
holder._leftJoystick:setColor(cc.c3b(19,231,238))
|
||||
elseif keyCode == cc.ControllerKey.BUTTON_RIGHT_THUMBSTICK then
|
||||
holder._rightJoystick:setColor(cc.c3b(19,231,238))
|
||||
else
|
||||
local ketStatus = string.format("Key Down:%d",keyCode)
|
||||
holder._externalKeyLabel:setString(ketStatus)
|
||||
|
@ -301,6 +305,10 @@ function GameControllerTest:registerControllerListener()
|
|||
holder._buttonL1:setColor(cc.c3b(250,255,255))
|
||||
elseif keyCode == cc.ControllerKey.BUTTON_RIGHT_SHOULDER then
|
||||
holder._buttonR1:setColor(cc.c3b(250,255,255))
|
||||
elseif keyCode == cc.ControllerKey.BUTTON_LEFT_THUMBSTICK then
|
||||
holder._leftJoystick:setColor(cc.c3b(250,255,255))
|
||||
elseif keyCode == cc.ControllerKey.BUTTON_RIGHT_THUMBSTICK then
|
||||
holder._rightJoystick:setColor(cc.c3b(250,255,255))
|
||||
else
|
||||
local ketStatus = string.format("Key Up:%d",keyCode)
|
||||
holder._externalKeyLabel:setString(ketStatus)
|
||||
|
|
Loading…
Reference in New Issue