zoukankan      html  css  js  c++  java
  • cocos2dx进阶学习之CCTMXLayer

    继承关系

    CCTMXLayer -> CCSpriteBatchNode

    CCTMXLayer是在瓦片地图中,抽象一个层的类,它继承自CCSpriteBatchNode,也就是说它抽象了一批相同图片的精灵,在瓦片地图中,用层来抽象她们。

    成员函数

    CCSprite* tileAt(const CCPoint& tileCoordinate);

    获取该坐标的精灵,这里的坐标是网格坐标


    unsigned int  tileGIDAt(const CCPoint& tileCoordinate);

    获取该网格坐标的GID


    void setTileGID(unsigned int gid, const CCPoint& tileCoordinate);

    void setTileGID(unsigned int gid, const CCPoint& tileCoordinate, ccTMXTileFlags flags);

    设置该点的GID


    void removeTileAt(const CCPoint& tileCoordinate);

    删除tile


    CCPoint positionAt(const CCPoint& tileCoordinate);

    坐标转化


    CCString *propertyNamed(const char *propertyName);

    属性值


    void setupTiles();

    创建瓦片


    virtual void addChild(CCNode * child, int zOrder, int tag);

    这个接口在Layer里不支持,在这里重载是为了报错


    void removeChild(CCNode* child, bool cleanup);

    删除子对象


    inline const char* getLayerName(){ return m_sLayerName.c_str(); }

    inline void setLayerName(const char *layerName){ m_sLayerName = layerName; }

    设置和获取Layer名字


    总结

    CCTMXLayer是CCSpriteBatchNode的派生类,所以也是一个批精灵。瓦片地图将其分成一层层的原因也是为了提高渲染的效率。

  • 相关阅读:
    推荐网址:Response.WriteFile Cannot Download a Large File
    为什么是 My?
    Fox开发杂谈
    DCOM配置为匿名访问
    连接到运行 Windows 98 的计算机
    OO面向对象以后是什么
    Com+的未来是什么?
    fox 表单和类库的加密及修复
    来自 COM 经验的八个教训
    VFP的加密问题
  • 原文地址:https://www.cnblogs.com/new0801/p/6177215.html
Copyright © 2011-2022 走看看