cocos2dx 关于lua 绑定的环境配置官方文档翻译与 将自定义c++方法绑定到lua的的方法

前端之家收集整理的这篇文章主要介绍了cocos2dx 关于lua 绑定的环境配置官方文档翻译与 将自定义c++方法绑定到lua的的方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
   网上有好多写怎样讲自定义方法绑定到lua的文章,其中都只对环境配置做了简单的介绍,看到有的帖子写在绑定中遇到了各种各样的error,大部分是由于环境配置不正确导致的,以下是官方的文档有标准的说明,里面说明了使用bindings-generator的环境需要,具体的怎样配置路径网上多事一堆一堆的我把python用到的pyyaml和pyCheetah需要放置的路径写在了下面,所有的开发引擎都会有自己的说明文档。下面就是cocos2dx 官方文档
//怎样使用 bindings-generator
How to Use bindings-generator
==================

//windows 环境下
On Windows:
------------
//安装android-ndk-r9b
* Make sure that you have installed `android-ndk-r9b`.
//下载 python2.7.3
* Download python2.7.3 (32bit) from (http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi).
//把python安装路径配置到path(windows 环境变量配置)
* Add the installed path of python (e.g. C:\Python27) to windows environment variable named 'PATH'.
//下载pyyaml并且安装
* Download pyyaml from http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py2.7.exe and install it.
//下载 pyCheetah 并且解压到安装python路径的Lib文件夹下的site-packages文件夹下
* Download pyCheetah from https://raw.github.com/dumganhar/my_old_cocos2d-x_backup/download/downloads/Cheetah.zip,unzip it to "C:\Python27\Lib\site-packages"
设置ndk——root合法的环境变量
* Set environment variables (`NDK_ROOT`)
* Go to "cocos2d-x/tools/tolua" folder,and run "genbindings.py". The generated codes will be under "cocos\scripting\auto-generated\js-bindings".

//mac环境下
On MAC:
----------
//,mac 10.9的系统版本已经默认安装好了python2.7,如果你的mac 没有安装好则使用pip工具安装
* The OSX 10.9 has a built-in python2.7 and if your os don't have python2.7 then use [Homebrew](http://brew.sh/) to install the python and use pip install the python dependencies.
<pre>
	brew install python
</pre>
//安装python需要用到的库 通过一下命令
* Install python dependices by pip.
<pre>
	//在命令行输入以下命令进行安装
    sudo easy_install pip //安装pip
    sudo pip install PyYAML //安装 pyYAMl 成功时回有个successfully提示
    sudo pip install Cheetah //安装 Cheetah 成功时也会提示successfully提示
</pre>
//下载 64bit ndk-r9b-x86_64 64位 ndk r9b,
* Download [64bit ndk-r9b-x86_64](http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86_64.tar.bz2) from [google](http://developer.android.com/tools/sdk/ndk/index.html)
* Run
//配置路径
<pre>
    export NDK_ROOT=/path/to/android-ndk-r9b
    ./genbindings.py
</pre>

//在 linux 12.04 64 位版本 
On Ubuntu Linux 12.04 64bit
------------
//通过命令行安装python
* Install python
<pre>
	sudo apt-get install python2.7
</pre>
* Install python dependices by pip.
<pre>
	sudo apt-get install python-pip
	sudo pip install PyYAML
	sudo pip install Cheetah
</pre>
//下载 64bit ndk-r9b-x86_64 64位 ndk r9b,以下同mac 操作系统
* Download [64bit ndk-r9b-x86_64]( https://dl.google.com/android/ndk/android-ndk-r9b-linux-x86_64.tar.bz2) from [google](http://developer.android.com/tools/sdk/ndk/index.html)
* Go to "cocos2d-x/tools/tolua",Run
<pre>
	export NDK_ROOT=/path/to/android-ndk-r9b
    ./genbindings.py
</pre>
本文出自 http://blog.csdn.net/han1558249222 未经允许请勿转载
将自定义的c++方法绑定到lua
http://shahdza.blog.51cto.com/2410787/1568051


How to Use bindings-generator
==================

//windows 环境下
On Windows:
------------
//安装android-ndk-r9b
* Make sure that you have installed `android-ndk-r9b`.
//下载 python2.7.3
* Download python2.7.3 (32bit) from (http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi).
//把python安装路径配置到path(windows 环境变量配置)
* Add the installed path of python (e.g. C:\Python27) to windows environment variable named 'PATH'.
//下载pyyaml并且安装 安装python路径的Lib文件夹下的site-packages文件夹下
* Download pyyaml from http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py2.7.exe and install it.
//下载 pyCheetah 并且解压到安装python路径的Lib文件夹下的site-packages文件夹下
* Download pyCheetah from https://raw.github.com/dumganhar/my_old_cocos2d-x_backup/download/downloads/Cheetah.zip,mac 10.9的系统版本已经默认安装好了python2.7,如果你的mac 没有安装好则使用pip工具安装
* The OSX 10.9 has a built-in python2.7 and if your os don't have python2.7 then use [Homebrew](http://brew.sh/) to install the python and use pip install the python dependencies.
<pre>
	brew install python
</pre>
//安装python需要用到的库 通过一下命令
* Install python dependices by pip.
<pre>
	//在命令行输入以下命令进行安装
    sudo easy_install pip //安装pip
    sudo pip install PyYAML //安装 pyYAMl 成功时回有个successfully提示
    sudo pip install Cheetah
</pre>
//下载 64bit ndk-r9b-x86_64 64位 ndk r9b,
* Download [64bit ndk-r9b-x86_64](http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86_64.tar.bz2) from [google](http://developer.android.com/tools/sdk/ndk/index.html)
* Run
//配置路径
<pre>
	export NDK_ROOT=/path/to/android-ndk-r9b
    ./genbindings.py
</pre>

//在 linux 12.04 64 位版本 
On Ubuntu Linux 12.04 64bit
------------
//通过命令行安装python  以下同mac 操作系统配置
* Install python
<pre>
	sudo apt-get install python2.7
</pre>
* Install python dependices by pip.
<pre>
	sudo apt-get install python-pip
	sudo pip install PyYAML
	sudo pip install Cheetah
</pre>
//下载 64bit ndk-r9b-x86_64 64位 ndk r9b,以下同mac 操作系统
* Download [64bit ndk-r9b-x86_64]( https://dl.google.com/android/ndk/android-ndk-r9b-linux-x86_64.tar.bz2) from [google](http://developer.android.com/tools/sdk/ndk/index.html)
* Go to "cocos2d-x/tools/tolua",Run
<pre>
	export NDK_ROOT=/path/to/android-ndk-r9b
    ./genbindings.py
</pre>
本文出自 http://blog.csdn.net/han1558249222 未经允许请勿转载

将自定义的c++方法绑定到lua 感谢
http://shahdza.blog.51cto.com/2410787/1568051

猜你在找的Cocos2d-x相关文章