cocos2dx 字符串拼接
2024-09-09 17:14:48
for(int i=;i<;i++){
char str[];
sprintf(str,"%d",i); char totalFilename[];
strcpy(totalFilename, "game_loading") ;
const char* suffix = ".png";
strcat(totalFilename, str);
strcat(totalFilename, suffix);
log(totalFilename);
animation->setDelayPerUnit(0.2f);
log("%d",sizeof(str[])); char t = 'q';
log("char %d",sizeof(t)); float a = 10.30; log("t %d",sizeof(&a)); animation->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(totalFilename));
}
读取XML
Dictionary* dic = Dictionary::createWithContentsOfFile("chineseString.xml");
String* strchinese = (String*)dic->objectForKey("startGame"); <?xml version="1.0" encoding="utf-8"?>
<plist version="1.0"> <dict> <key>startGame</key> <string>从XML里面读取的东东</string> <key>japanese</key> <string>地方</string>
</dict>
</plist>
创建动画Animation
Animation* HelloWorld::getAnimation(const char* stts[],int l,float delay){
Animation* ac = Animation::create();
ac->setDelayPerUnit(delay);
for(int i=;i<l;i++){
ac->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(stts[i]));
}
return ac;
} Animation* HelloWorld::getAnimation(const std::string stts[],int l,float delay){
Animation* ac = Animation::create();
ac->setDelayPerUnit(delay);
for(int i=;i<l;i++){
ac->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(stts[i]));
}
return ac;
}
最新文章
- iOSQuartz2D-04-手动剪裁图片并保存到相册
- Java 中正确使用 hashCode 和 equals 方法
- [Javascript] Object.assign()
- js 动态切换视频
- django 创建一个通用视图
- 数据挖掘学习笔记--AdaBoost算法(一)
- [HDU1001] Sum Problem
- js 实现倒计时效果
- oracle 权限
- V4L2驱动的移植与应用(二)
- 新概念英语(1-97)A Small Blue Case
- JProfiler的详细使用介绍
- element-ui中table表头表格错误问题解决
- Python爬虫利器二之Beautiful Soup的用法
- pytest三:fixture_conftest.py 自定义测试用例的预置条件(setup)
- java JDBC (六) org.apache.commons.dbutils 增删改
- 【BZOJ】1831: [AHOI2008]逆序对
- The Django Book第六章(Admin)随笔
- php 统计一维数组中重复的元素个数
- 【Linux】目录文件权限的查看和修改【转】
热门文章
- 使用离线包部署kubernetes 1.9.0、kubernetes-dashboard 1.8
- 14 Go&#39;s Declaration Syntax go语言声明语法
- Windows 10安装MongoDB(安装&;启动)
- docker使用Dockerfile构建ssh容器
- django(1)安装及配置
- ZOJ 3537 Cake(凸包+区间DP)
- 题解-python-CodeForces 1A
- win7下scheme环境配置
- HTML5移动应用左右滑动touchmove touchmove touchend 实例
- JSON解析代码