cocos2d-x中TextAtlas艺术字create函数各参数的含义

来源:互联网 发布:金山网络官网 编辑:程序博客网 时间:2024/05/16 18:10

今天在代码里面创建艺术字的时候,踩了坑。一直不理解create函数五个参数的含义,网上找的各有各的说法,部分都是错的,最后实践得出结论

static TextAtlas* create(const std::string& stringValue,
                             const std::string& charMapFile,
                             int itemWidth,
                             int itemHeight,
                             const std::string& startCharMap);

1.stringValue  是指你需要显示的字符串

2.charMapFile  你的艺术字图片的路径

3.itemWidth   *******注意********  单个字符的长度

4.itemHeight  *******注意********  单个字符的宽度

5.startCharMap 字符索引的起始字符   比如你的图片是0123456789,那么起始字符是0, 如果你的图片是./0123456789,那么起始字符是.(当然根据实际需要字符和图片也不需要一一对应)。

相信我,没错。

原创粉丝点击