XCode5添加新建类模板(Cocos2dx Template Class for Scene or Layer)
来源:互联网 发布:软件产业基地1栋 编辑:程序博客网 时间:2024/06/14 18:22
因为常用cocos2dx开发游戏,所以每次新建cpp类文件的时候,XCode默认生成的cpp类基本就是一个空文件,每次都要重复实现cocos2dx的基本代码。很麻烦。(虽然我每次都是修改了HelloWorld文件,新建的文件直接copy HelloWorld内容。感觉还是挺麻烦的。)
今天就修改了下类模板,添加了2个cocos2dx的类模板,下面是新建文件的时候,是不是多出了2个类模板。
下面我就说下怎么添加xcode类模板,很简单的。
1、打开Xcode的类模板目录地址:/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates
2、打开里面C and C++文件,就会看到Xcode的cpp类模板文件。复制一个C++ Class.xctemplate文件夹取名:2dx Scene Class.xctemplate,放在C and C++目录下。
3、修改TemplateInfo.plist(主要修改创建文件时候的描述介绍)
打开2dx Scene Class.xctemplate/TemplateInfo.plist, 修改Description的值为:A C++ class for Cocos2d-x Scene.
4、修改___FILEBASENAME___.h
打开2dx Scene Class.xctemplate/___FILEBASENAME___.h,修改成以下内容:
5、修改___FILEBASENAME___.cpp
打开2dx Scene Class.xctemplate/___FILEBASENAME___.cpp,修改成以下内容:
ok, 这样就完成了一个类模板的添加。
现在在XCode里面新建一个2dx Scene类看看。是不是已经有默认内容了。
对应的你可以添加Layer的类模板。方法一样,我就不重复了。
关于文件模板里面的一个预定义变量,介绍下:
ok,还有很多有趣的功能,可以大家自己探索。比如工程模板,插件等等。
- XCode5添加新建类模板(Cocos2dx Template Class for Scene or Layer)
- XCode5添加新建类模板(Cocos2dx Template Class for Scene or Layer)
- XCode5添加新建类模板(Cocos2dx Template Class for Scene or Layer)
- XCode5添加新建类模板(Cocos2dx Template Class for Scene or Layer)
- XCode5添加新建类模板(Cocos2dx Template Class for Scene or Layer)
- C++ 模板类=设计 or template class operator=
- cocos2dx Layer与Scene生命周期详解
- Cocos2dx 场景类-Scene
- Nontype Class Template Parameters(非类型类模板参数)
- cocos2dx[3.2] ——核心类Director/Scene/Layer/Sprite详细讲解
- 模板类 template <class T> sort
- C++类模板 template <class T>
- C++类模板 template <class T>
- C++类模板 template <class T>
- C++类模板 template <class T>
- C++类模板 template <class T>
- C++类模板 template <class T>
- cocos2dx-3.0(9)------总结sprite、scene、director、layer
- unity 给物体边缘加高光轮廓的办法,付Demo(增加一组算法)
- How can I recover a file that I deleted in my local repo from the remote repo in Git?
- sgu-249 Matrix
- wpf 的拖拽功能实现(含拖拽复制功能实现)
- Rename files and folders with git
- XCode5添加新建类模板(Cocos2dx Template Class for Scene or Layer)
- ubuntu获取版本号和内核信息的方法
- linux配置java环境变量 转过几个,这个最详细和靠谱
- ubuntu获取版本号和内核信息的方法
- Unity3D性能优化总结
- Core Plot学习笔记:绘制饼图
- Android开源框架ImageLoader的完美例子
- Unity 相关经典博客资源总结(持续更新)
- android拦截系统软件盘的某个功能键