一、在项目的Classes目录里新建一个头文件命名为:CustomExport.h和源文件CustomExport.cpp并添加进VS工程
二、添加代码
1.在CustomExport.h头文件中添加如下代码:
#ifndef _CUSTOM_EXPORT_H_
#define _CUSTOM_EXPORT_H_#ifdef __cplusplus
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif//注册自定义的导出函数
void registerCustomFunction(lua_State* L);#endif
2.在CustomExport.cpp源文件中添加如下代码:
#include "CustomExport.h"
#include <string>
#include "base/ccUtils.h"
#include "external/xxtea/xxtea.h"
#include &#
cocos2dx-lua开发, c++函数绑定导出lua方法
最新推荐文章于 2021-03-18 12:01:28 发布