搭建Windows下的Cocos2d-X的开发环境

时间:2023-02-07 00:16:00

在搭建环境之前,需要准备 Cocos2d-x压缩包,我用的是Cocos2d-X 2.2.3,Python2.7.5,Python.bat,开发工具我用的是 VS2012

Cocos2d-X-2.2.3的下载地址:http://pan.baidu.com/s/1eQpKhNk

Python2.7.5的下载地址:http://pan.baidu.com/s/1bnGUCLh

Python.bat的下载地址:http://pan.baidu.com/s/1sjBcyXB

Python.bat可以有,也可以不需要,Python.bat的目的只是为了方便创建Cocos2d-X工程


解压Cocos2d-X 2.2.3(我将文件解压在E盘的game目录下,建议不要解压在根目录下)

搭建Windows下的Cocos2d-X的开发环境


查看解压后的Cocos2d-x的目录

搭建Windows下的Cocos2d-X的开发环境


启动build-win32

搭建Windows下的Cocos2d-X的开发环境


编译版本库:

启动build-win32后的效果(编译Cocos2d-x编译过程中显示的是纯文本的批处理文件需要一直等到编译完成)

搭建Windows下的Cocos2d-X的开发环境


编译完成的标志

搭建Windows下的Cocos2d-X的开发环境


搭建Windows下的Cocos2d-X的开发环境


安装Python:

1、打开Python-2.7.5

搭建Windows下的Cocos2d-X的开发环境


2、单击Next

搭建Windows下的Cocos2d-X的开发环境


3、单击Next

搭建Windows下的Cocos2d-X的开发环境


4、单击Next

搭建Windows下的Cocos2d-X的开发环境


5、这表示正在安装Python

搭建Windows下的Cocos2d-X的开发环境


6、单击Finish(Python安装完成)

搭建Windows下的Cocos2d-X的开发环境



配置环境变量:

1、将鼠标移到计算机上单击鼠标右键,选择属性

搭建Windows下的Cocos2d-X的开发环境


2、选择高级系统选项

搭建Windows下的Cocos2d-X的开发环境


3、选择环境变量

搭建Windows下的Cocos2d-X的开发环境


4、选定path

搭建Windows下的Cocos2d-X的开发环境


5、选好path后单击编辑

搭建Windows下的Cocos2d-X的开发环境


6、单击编辑后弹出的对话框

搭建Windows下的Cocos2d-X的开发环境


7、将Python的安装路径添加到环境变量中

搭建Windows下的Cocos2d-X的开发环境


8、单击确定

搭建Windows下的Cocos2d-X的开发环境


9、单击确定

搭建Windows下的Cocos2d-X的开发环境


将Python.bat放到E:\game\cocos2d-x-2.2.3\tools\project-creator目录下

搭建Windows下的Cocos2d-X的开发环境


创建项目:

1、打开Python.bat

搭建Windows下的Cocos2d-X的开发环境


2、输入项目名称为hellofyt

搭建Windows下的Cocos2d-X的开发环境


3、输入包标示名 : com.fyt.hello

搭建Windows下的Cocos2d-X的开发环境


4、按下回车键(下图表示工程创建成功)

搭建Windows下的Cocos2d-X的开发环境


5、找到E:\game\cocos2d-x-2.2.3\projects\hellofyt\proj.win32文件

搭建Windows下的Cocos2d-X的开发环境


6、用VS2012打开下图所示的文件

搭建Windows下的Cocos2d-X的开发环境


7、打开后的效果:

搭建Windows下的Cocos2d-X的开发环境


编译程序:

程序执行结果

 搭建Windows下的Cocos2d-X的开发环境