Merge pull request #9267 from samuele3hu/v3_strip

Adjust binding structure to decrease the package size of lua_empty_test
This commit is contained in:
minggo 2014-11-27 20:21:06 +08:00
commit dcc517e8d4
18 changed files with 435 additions and 267 deletions

View File

@ -93,6 +93,7 @@ set(lua_bindings_manual_files
manual/cocosdenshion/lua_cocos2dx_cocosdenshion_manual.cpp
manual/cocostudio/CustomGUIReader.cpp
manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp
manual/cocostudio/lua_cocos2dx_csloader_manual.cpp
manual/controller/lua_cocos2dx_controller_manual.cpp
manual/extension/lua_cocos2dx_extension_manual.cpp
manual/network/lua_extensions.c
@ -119,6 +120,7 @@ set(lua_bindings_auto_files
auto/lua_cocos2dx_physics_auto.cpp
auto/lua_cocos2dx_spine_auto.cpp
auto/lua_cocos2dx_studio_auto.cpp
auto/lua_cocos2dx_csloader_auto.cpp
auto/lua_cocos2dx_ui_auto.cpp
auto/lua_cocos2dx_audioengine_auto.cpp
)

View File

@ -26,7 +26,6 @@
#include <string>
#include "tolua_fix.h"
#include "cocos2d.h"
#include "extensions/cocos-ext.h"
#include "CCLuaStack.h"
#include "CCLuaValue.h"
#include "CCLuaEngine.h"
@ -34,8 +33,6 @@
#include "LuaBasicConversions.h"
using namespace cocos2d;
using namespace cocos2d::extension;
void GLNode::draw(Renderer *renderer, const cocos2d::Mat4& transform, uint32_t flags)

View File

@ -26,14 +26,12 @@
#include <string>
#include "tolua_fix.h"
#include "cocos2d.h"
#include "extensions/cocos-ext.h"
#include "CCLuaStack.h"
#include "CCLuaValue.h"
#include "CCLuaEngine.h"
#include "LuaOpengl.h"
using namespace cocos2d;
using namespace cocos2d::extension;
NS_CC_BEGIN

View File

@ -27,10 +27,8 @@
#include "LuaBasicConversions.h"
#include "LuaScriptHandlerMgr.h"
#include "CCLuaValue.h"
#include "cocos-ext.h"
USING_NS_CC;
USING_NS_CC_EXT;
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

View File

@ -31,9 +31,6 @@
#else
#include <sys/socket.h>
#endif
#include "ui/UIWidget.h"
#include "ActionTimeline/CCActionTimeline.h"
#include "ActionTimeline/CSLoader.h"
static int tolua_cocos2d_MenuItemImage_create(lua_State* tolua_S)
{
@ -6643,182 +6640,6 @@ static void extendTMXLayer(lua_State* tolua_S)
lua_pop(tolua_S, 1);
}
static int tolua_cocos2dx_EventListenerFocus_create(lua_State* tolua_S)
{
if (nullptr == tolua_S)
return 0;
int argc = 0;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S, 1, "cc.EventListenerFocus", 0, &tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
cocos2d::EventListenerFocus* tolua_ret = cocos2d::EventListenerFocus::create();
if(nullptr == tolua_ret)
return 0;
int ID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* luaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)tolua_ret,"cc.EventListenerFocus");
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.EventListenerFocus:create", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'tolua_cocos2dx_EventListenerFocus_create'.",&tolua_err);
return 0;
#endif
}
static void cloneFocusHandler(const EventListenerFocus* src,EventListenerFocus* dst )
{
if (nullptr == src || nullptr == dst)
return;
LUA_FUNCTION handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)src, ScriptHandlerMgr::HandlerType::EVENT_FOCUS);
if (0 != handler)
{
int newscriptHandler = cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->reallocateScriptHandler(handler);
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)dst, newscriptHandler, ScriptHandlerMgr::HandlerType::EVENT_FOCUS);
dst->onFocusChanged = [=](ui::Widget* widgetLostFocus, ui::Widget* widgetGetFocus){
lua_State* tolua_S = LuaEngine::getInstance()->getLuaStack()->getLuaState();
int id = (widgetLostFocus) ? (int)widgetLostFocus->_ID : -1;
int* luaID = (widgetLostFocus) ? &widgetLostFocus->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)widgetLostFocus,"ccui.Widget");
id = (widgetGetFocus) ? (int)widgetGetFocus->_ID : -1;
luaID = (widgetGetFocus) ? &widgetGetFocus->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)widgetGetFocus,"ccui.Widget");
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
};
}
}
static int tolua_cocos2dx_EventListenerFocus_clone(lua_State* tolua_S)
{
if (nullptr == tolua_S)
return 0;
int argc = 0;
EventListenerFocus* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S, 1, "cc.EventListenerFocus", 0, &tolua_err)) goto tolua_lerror;
#endif
self = static_cast<EventListenerFocus*>(tolua_tousertype(tolua_S,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_EventListenerFocus_clone'\n", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
cocos2d::EventListenerFocus* tolua_ret = cocos2d::EventListenerFocus::create();
if(nullptr == tolua_ret)
return 0;
cloneFocusHandler(self, tolua_ret);
int ID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* luaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)tolua_ret,"cc.EventListenerFocus");
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.EventListenerFocus:clone", argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'tolua_cocos2dx_EventListenerFocus_clone'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2dx_EventListenerFocus_registerScriptHandler(lua_State* tolua_S)
{
if (nullptr == tolua_S)
return 0;
int argc = 0;
EventListenerFocus* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S, 1, "cc.EventListenerFocus", 0, &tolua_err)) goto tolua_lerror;
#endif
self = static_cast<EventListenerFocus*>(tolua_tousertype(tolua_S,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_EventListenerFocus_registerScriptHandler'\n", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = toluafix_ref_function(tolua_S,2,0);
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::EVENT_FOCUS);
self->onFocusChanged = [=](ui::Widget* widgetLostFocus, ui::Widget* widgetGetFocus){
int id = (widgetLostFocus) ? (int)widgetLostFocus->_ID : -1;
int* luaID = (widgetLostFocus) ? &widgetLostFocus->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)widgetLostFocus,"ccui.Widget");
id = (widgetGetFocus) ? (int)widgetGetFocus->_ID : -1;
luaID = (widgetGetFocus) ? &widgetGetFocus->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)widgetGetFocus,"ccui.Widget");
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
};
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.EventListenerFocus:registerScriptHandler", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'tolua_cocos2dx_EventListenerFocus_registerScriptHandler'.",&tolua_err);
return 0;
#endif
}
static void extendEventListenerFocus(lua_State* tolua_S)
{
lua_pushstring(tolua_S, "cc.EventListenerFocus");
lua_rawget(tolua_S, LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
tolua_function(tolua_S, "create", tolua_cocos2dx_EventListenerFocus_create);
tolua_function(tolua_S, "registerScriptHandler", tolua_cocos2dx_EventListenerFocus_registerScriptHandler);
tolua_function(tolua_S, "clone", tolua_cocos2dx_EventListenerFocus_clone);
}
lua_pop(tolua_S, 1);
}
int lua_cocos2dx_Application_isIOS64bit(lua_State* tolua_S)
{
@ -7088,51 +6909,6 @@ static void extendCamera(lua_State* tolua_S)
lua_pop(tolua_S, 1);
}
int lua_cocos2dx_CSLoader_createTimeline(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:createTimeline");
if(!ok)
return 0;
cocostudio::timeline::ActionTimeline* ret = cocos2d::CSLoader::createTimeline(arg0);
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.CSLoader:createTimeline",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_CSLoader_createTimeline'.",&tolua_err);
#endif
return 0;
}
static void extendCSLoader(lua_State* tolua_S)
{
lua_pushstring(tolua_S, "cc.CSLoader");
lua_rawget(tolua_S, LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
tolua_function(tolua_S, "createTimeline", lua_cocos2dx_CSLoader_createTimeline);
}
lua_pop(tolua_S, 1);
}
int register_all_cocos2dx_manual(lua_State* tolua_S)
{
if (NULL == tolua_S)
@ -7184,12 +6960,10 @@ int register_all_cocos2dx_manual(lua_State* tolua_S)
extendGLProgramState(tolua_S);
extendOrbitCamera(tolua_S);
extendTMXLayer(tolua_S);
extendEventListenerFocus(tolua_S);
extendApplication(tolua_S);
extendTextureCache(tolua_S);
extendGLView(tolua_S);
extendCamera(tolua_S);
extendCSLoader(tolua_S);
return 0;
}

View File

@ -23,6 +23,8 @@
****************************************************************************/
#include "lua_cocos2dx_coco_studio_manual.hpp"
#include "lua_cocos2dx_studio_auto.hpp"
#include "lua_cocos2dx_csloader_auto.hpp"
#include "lua_cocos2dx_csloader_manual.hpp"
#include "cocos2d.h"
#include "tolua_fix.h"
#include "LuaBasicConversions.h"
@ -599,7 +601,9 @@ int register_cocostudio_module(lua_State* L)
if (lua_istable(L,-1))//stack:...,_G,
{
register_all_cocos2dx_studio(L);
register_all_cocos2dx_csloader(L);
register_all_cocos2dx_coco_studio_manual(L);
register_all_cocos2dx_csloader_manual(L);
lua_register_cocos2dx_coco_studio_CustomGUIReader(L);
}
lua_pop(L, 1);

View File

@ -0,0 +1,78 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "lua_cocos2dx_csloader_manual.hpp"
#include "tolua_fix.h"
#include "LuaBasicConversions.h"
#include "CCLuaValue.h"
#include "CCLuaEngine.h"
#include "ActionTimeline/CCActionTimeline.h"
#include "ActionTimeline/CSLoader.h"
int lua_cocos2dx_csloader_CSLoader_createTimeline(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:createTimeline");
if(!ok)
return 0;
cocostudio::timeline::ActionTimeline* ret = cocos2d::CSLoader::createTimeline(arg0);
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.CSLoader:createTimeline",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_CSLoader_createTimeline'.",&tolua_err);
#endif
return 0;
}
int register_all_cocos2dx_csloader_manual(lua_State* L)
{
lua_pushstring(L, "cc.CSLoader");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "createTimeline", lua_cocos2dx_csloader_CSLoader_createTimeline);
}
lua_pop(L, 1);
return 0;
}

View File

@ -0,0 +1,40 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef COCOS_SCRIPTING_LUA_BINDINGS_MANUAL_COCOSTUDIO_LUA_COCOS2DX_CSLOADER_MANUAL_H
#define COCOS_SCRIPTING_LUA_BINDINGS_MANUAL_COCOSTUDIO_LUA_COCOS2DX_CSLOADER_MANUAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif
#include "base/CCRef.h"
#include <string>
TOLUA_API int register_all_cocos2dx_csloader_manual(lua_State* L);
#endif // #ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_COCO_STUDIO_MANUAL_H

View File

@ -680,9 +680,9 @@ static void extendLayoutParameter(lua_State* L)
}
static int tolua_cocos2d_EditBox_registerScriptEditBoxHandler(lua_State* tolua_S)
static int tolua_cocos2d_EditBox_registerScriptEditBoxHandler(lua_State* L)
{
if (NULL == tolua_S)
if (NULL == L)
return 0;
int argc = 0;
@ -690,29 +690,29 @@ static int tolua_cocos2d_EditBox_registerScriptEditBoxHandler(lua_State* tolua_S
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S,1,"ccui.EditBox",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccui.EditBox",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<EditBox*>(tolua_tousertype(tolua_S,1,0));
self = static_cast<EditBox*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2d_EditBox_registerScriptEditBoxHandler'\n", NULL);
tolua_error(L,"invalid 'self' in function 'tolua_cocos2d_EditBox_registerScriptEditBoxHandler'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(tolua_S) - 1;
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err))
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
self->registerScriptEditBoxHandler(handler);
return 0;
}
@ -722,16 +722,16 @@ static int tolua_cocos2d_EditBox_registerScriptEditBoxHandler(lua_State* tolua_S
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'tolua_cocos2d_EditBox_registerScriptEditBoxHandler'.",&tolua_err);
tolua_error(L,"#ferror in function 'tolua_cocos2d_EditBox_registerScriptEditBoxHandler'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler(lua_State* tolua_S)
static int tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler(lua_State* L)
{
if (NULL == tolua_S)
if (NULL == L)
return 0;
int argc = 0;
@ -739,19 +739,19 @@ static int tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler(lua_State* tolua
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S,1,"ccui.EditBox",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccui.EditBox",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<EditBox*>(tolua_tousertype(tolua_S,1,0));
self = static_cast<EditBox*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler'\n", NULL);
tolua_error(L,"invalid 'self' in function 'tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(tolua_S) - 1;
argc = lua_gettop(L) - 1;
if (0 == argc)
{
@ -764,25 +764,25 @@ static int tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler(lua_State* tolua
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler'.",&tolua_err);
tolua_error(L,"#ferror in function 'tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler'.",&tolua_err);
return 0;
#endif
}
static void extendEditBox(lua_State* tolua_S)
static void extendEditBox(lua_State* L)
{
lua_pushstring(tolua_S, "ccui.EditBox");
lua_rawget(tolua_S, LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
lua_pushstring(L, "ccui.EditBox");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
lua_pushstring(tolua_S,"registerScriptEditBoxHandler");
lua_pushcfunction(tolua_S,tolua_cocos2d_EditBox_registerScriptEditBoxHandler );
lua_rawset(tolua_S,-3);
lua_pushstring(tolua_S,"unregisterScriptEditBoxHandler");
lua_pushcfunction(tolua_S,tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler );
lua_rawset(tolua_S,-3);
lua_pushstring(L,"registerScriptEditBoxHandler");
lua_pushcfunction(L,tolua_cocos2d_EditBox_registerScriptEditBoxHandler );
lua_rawset(L,-3);
lua_pushstring(L,"unregisterScriptEditBoxHandler");
lua_pushcfunction(L,tolua_cocos2d_EditBox_unregisterScriptEditBoxHandler );
lua_rawset(L,-3);
}
lua_pop(tolua_S, 1);
lua_pop(L, 1);
}
int register_all_cocos2dx_ui_manual(lua_State* L)
@ -802,6 +802,182 @@ int register_all_cocos2dx_ui_manual(lua_State* L)
return 0;
}
static int tolua_cocos2dx_EventListenerFocus_create(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(L, 1, "cc.EventListenerFocus", 0, &tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(L) - 1;
if (argc == 0)
{
cocos2d::EventListenerFocus* tolua_ret = cocos2d::EventListenerFocus::create();
if(nullptr == tolua_ret)
return 0;
int ID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* luaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(L, ID, luaID, (void*)tolua_ret,"cc.EventListenerFocus");
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.EventListenerFocus:create", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'tolua_cocos2dx_EventListenerFocus_create'.",&tolua_err);
return 0;
#endif
}
static void cloneFocusHandler(const EventListenerFocus* src,EventListenerFocus* dst )
{
if (nullptr == src || nullptr == dst)
return;
LUA_FUNCTION handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)src, ScriptHandlerMgr::HandlerType::EVENT_FOCUS);
if (0 != handler)
{
int newscriptHandler = cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->reallocateScriptHandler(handler);
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)dst, newscriptHandler, ScriptHandlerMgr::HandlerType::EVENT_FOCUS);
dst->onFocusChanged = [=](ui::Widget* widgetLostFocus, ui::Widget* widgetGetFocus){
lua_State* L = LuaEngine::getInstance()->getLuaStack()->getLuaState();
int id = (widgetLostFocus) ? (int)widgetLostFocus->_ID : -1;
int* luaID = (widgetLostFocus) ? &widgetLostFocus->_luaID : nullptr;
toluafix_pushusertype_ccobject(L, id, luaID, (void*)widgetLostFocus,"ccui.Widget");
id = (widgetGetFocus) ? (int)widgetGetFocus->_ID : -1;
luaID = (widgetGetFocus) ? &widgetGetFocus->_luaID : nullptr;
toluafix_pushusertype_ccobject(L, id, luaID, (void*)widgetGetFocus,"ccui.Widget");
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
};
}
}
static int tolua_cocos2dx_EventListenerFocus_clone(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
EventListenerFocus* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L, 1, "cc.EventListenerFocus", 0, &tolua_err)) goto tolua_lerror;
#endif
self = static_cast<EventListenerFocus*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'tolua_cocos2dx_EventListenerFocus_clone'\n", nullptr);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (argc == 0)
{
cocos2d::EventListenerFocus* tolua_ret = cocos2d::EventListenerFocus::create();
if(nullptr == tolua_ret)
return 0;
cloneFocusHandler(self, tolua_ret);
int ID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* luaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(L, ID, luaID, (void*)tolua_ret,"cc.EventListenerFocus");
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.EventListenerFocus:clone", argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'tolua_cocos2dx_EventListenerFocus_clone'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2dx_EventListenerFocus_registerScriptHandler(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
EventListenerFocus* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L, 1, "cc.EventListenerFocus", 0, &tolua_err)) goto tolua_lerror;
#endif
self = static_cast<EventListenerFocus*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'tolua_cocos2dx_EventListenerFocus_registerScriptHandler'\n", nullptr);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (argc == 1)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = toluafix_ref_function(L,2,0);
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::EVENT_FOCUS);
self->onFocusChanged = [=](ui::Widget* widgetLostFocus, ui::Widget* widgetGetFocus){
int id = (widgetLostFocus) ? (int)widgetLostFocus->_ID : -1;
int* luaID = (widgetLostFocus) ? &widgetLostFocus->_luaID : nullptr;
toluafix_pushusertype_ccobject(L, id, luaID, (void*)widgetLostFocus,"ccui.Widget");
id = (widgetGetFocus) ? (int)widgetGetFocus->_ID : -1;
luaID = (widgetGetFocus) ? &widgetGetFocus->_luaID : nullptr;
toluafix_pushusertype_ccobject(L, id, luaID, (void*)widgetGetFocus,"ccui.Widget");
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
};
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.EventListenerFocus:registerScriptHandler", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'tolua_cocos2dx_EventListenerFocus_registerScriptHandler'.",&tolua_err);
return 0;
#endif
}
static void extendEventListenerFocusEvent(lua_State* L)
{
lua_pushstring(L, "cc.EventListenerFocus");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "create", tolua_cocos2dx_EventListenerFocus_create);
tolua_function(L, "registerScriptHandler", tolua_cocos2dx_EventListenerFocus_registerScriptHandler);
tolua_function(L, "clone", tolua_cocos2dx_EventListenerFocus_clone);
}
lua_pop(L, 1);
}
int register_ui_moudle(lua_State* L)
{
lua_getglobal(L, "_G");
@ -813,6 +989,7 @@ int register_ui_moudle(lua_State* L)
register_all_cocos2dx_experimental_video(L);
register_all_cocos2dx_experimental_video_manual(L);
#endif
extendEventListenerFocusEvent(L);
}
lua_pop(L, 1);

View File

@ -95,6 +95,8 @@ LOCAL_SRC_FILES += ../manual/cocosbuilder/lua_cocos2dx_cocosbuilder_manual.cpp \
#cocostudio
LOCAL_SRC_FILES += ../manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp \
../manual/cocostudio/CustomGUIReader.cpp \
../manual/cocostudio/lua_cocos2dx_csloader_manual.cpp \
../auto/lua_cocos2dx_csloader_auto.cpp \
../auto/lua_cocos2dx_studio_auto.cpp
#spine

View File

@ -143,6 +143,14 @@
155C7E2719A71CDE00F08B25 /* lua_cocos2dx_ui_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15C1BD1A1986526C00A46ACC /* lua_cocos2dx_ui_manual.cpp */; };
155C7E2819A71CE600F08B25 /* lua_cocos2dx_ui_manual.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15C1BD1B1986526C00A46ACC /* lua_cocos2dx_ui_manual.hpp */; };
155C7E2919A71CE800F08B25 /* lua_cocos2dx_ui_manual.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15C1BD1B1986526C00A46ACC /* lua_cocos2dx_ui_manual.hpp */; };
1595523A1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 159552381A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp */; };
1595523B1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 159552381A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp */; };
1595523C1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 159552391A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp */; };
1595523D1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 159552391A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp */; };
159552401A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1595523E1A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.cpp */; };
159552411A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1595523E1A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.cpp */; };
159552421A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 1595523F1A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.hpp */; };
159552431A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 1595523F1A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.hpp */; };
15AC69D519876E9300D17520 /* lua_cocos2dx_physics_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE75218BC45C200215002 /* lua_cocos2dx_physics_auto.cpp */; };
15AC69D619876EA200D17520 /* lua_cocos2dx_physics_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE75318BC45C200215002 /* lua_cocos2dx_physics_auto.hpp */; };
15AC69D91987710400D17520 /* tolua_event.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1F918CD8F6E0087CE3A /* tolua_event.c */; };
@ -317,6 +325,10 @@
156EADF21977A2BA00F53709 /* lua_cocos2dx_experimental_video_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_experimental_video_auto.hpp; sourceTree = "<group>"; };
158C128519A0FA1300781A76 /* lua_cocos2dx_3d_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_3d_manual.cpp; sourceTree = "<group>"; };
158C128619A0FA1300781A76 /* lua_cocos2dx_3d_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_cocos2dx_3d_manual.h; sourceTree = "<group>"; };
159552381A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_csloader_auto.cpp; sourceTree = "<group>"; };
159552391A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_csloader_auto.hpp; sourceTree = "<group>"; };
1595523E1A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_csloader_manual.cpp; sourceTree = "<group>"; };
1595523F1A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_csloader_manual.hpp; sourceTree = "<group>"; };
15C1BCC019864D8700A46ACC /* lua_cocos2dx_cocosbuilder_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_cocosbuilder_auto.cpp; sourceTree = "<group>"; };
15C1BCC119864D8700A46ACC /* lua_cocos2dx_cocosbuilder_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_cocosbuilder_auto.hpp; sourceTree = "<group>"; };
15C1BCC219864D8700A46ACC /* lua_cocos2dx_cocosdenshion_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_cocosdenshion_auto.cpp; sourceTree = "<group>"; };
@ -561,6 +573,8 @@
15EFA400198B2AB2000C57D3 /* cocostudio */ = {
isa = PBXGroup;
children = (
1595523E1A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.cpp */,
1595523F1A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.hpp */,
566F015D19B5EB0F00FCA620 /* CustomGUIReader.cpp */,
566F015E19B5EB0F00FCA620 /* CustomGUIReader.h */,
15EFA401198B2AB2000C57D3 /* lua_cocos2dx_coco_studio_manual.cpp */,
@ -572,6 +586,8 @@
1AACE74818BC45C200215002 /* auto */ = {
isa = PBXGroup;
children = (
159552381A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp */,
159552391A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp */,
3E2BDB0319C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.cpp */,
3E2BDB0419C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.hpp */,
1516227F19A0F3E3006099B8 /* lua_cocos2dx_3d_auto.cpp */,
@ -801,6 +817,7 @@
15415ADB19A71A53004F1E71 /* unix.h in Headers */,
155C7DF419A71C3700F08B25 /* lua_cocos2dx_3d_manual.h in Headers */,
15415ABB19A71A53004F1E71 /* luasocket.h in Headers */,
159552421A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.hpp in Headers */,
155C7E2419A71CD800F08B25 /* lua_cocos2dx_experimental_video_manual.hpp in Headers */,
15415ACF19A71A53004F1E71 /* tcp.h in Headers */,
15415AAB19A71A53004F1E71 /* buffer.h in Headers */,
@ -828,6 +845,7 @@
15C1C2ED19874CBE00A46ACC /* CCLuaObjcBridge.h in Headers */,
15C1C2EE19874CBE00A46ACC /* tolua_fix.h in Headers */,
155C7E2019A71CCC00F08B25 /* LuaSkeletonAnimation.h in Headers */,
1595523C1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp in Headers */,
15415AB719A71A53004F1E71 /* io.h in Headers */,
566F016119B5EB0F00FCA620 /* CustomGUIReader.h in Headers */,
15C1C2DC19874B4400A46ACC /* xxtea.h in Headers */,
@ -870,6 +888,7 @@
15415ADC19A71A53004F1E71 /* unix.h in Headers */,
155C7DF519A71C3900F08B25 /* lua_cocos2dx_3d_manual.h in Headers */,
15415ABC19A71A53004F1E71 /* luasocket.h in Headers */,
159552431A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.hpp in Headers */,
155C7E2519A71CDA00F08B25 /* lua_cocos2dx_experimental_video_manual.hpp in Headers */,
15415AD019A71A53004F1E71 /* tcp.h in Headers */,
15415AAC19A71A53004F1E71 /* buffer.h in Headers */,
@ -897,6 +916,7 @@
15EFA641198B32BB000C57D3 /* CCLuaObjcBridge.h in Headers */,
15EFA642198B32BB000C57D3 /* tolua_fix.h in Headers */,
155C7E2119A71CCE00F08B25 /* LuaSkeletonAnimation.h in Headers */,
1595523D1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp in Headers */,
15415AB819A71A53004F1E71 /* io.h in Headers */,
566F016219B5EB0F00FCA620 /* CustomGUIReader.h in Headers */,
15EFA62B198B3220000C57D3 /* LuaOpengl.h in Headers */,
@ -1019,6 +1039,7 @@
F4FE0D5719ECD00100B8B12B /* luasocket_scripts.c in Sources */,
15415AC519A71A53004F1E71 /* select.c in Sources */,
155C7DFE19A71C5A00F08B25 /* CCBProxy.cpp in Sources */,
1595523A1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp in Sources */,
15415AD919A71A53004F1E71 /* unix.c in Sources */,
155C7E0619A71C7600F08B25 /* lua_cocos2dx_extension_manual.cpp in Sources */,
15C1C2DD19874B8800A46ACC /* CCLuaBridge.cpp in Sources */,
@ -1062,6 +1083,7 @@
15415AA919A71A53004F1E71 /* buffer.c in Sources */,
15C1C2CD1987495500A46ACC /* lua_cocos2dx_auto.cpp in Sources */,
15415AB919A71A53004F1E71 /* luasocket.c in Sources */,
159552401A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.cpp in Sources */,
155C7E1219A71CA200F08B25 /* Lua_web_socket.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -1095,6 +1117,7 @@
F4FE0D5819ECD00100B8B12B /* luasocket_scripts.c in Sources */,
15EFA639198B328B000C57D3 /* tolua_fix.cpp in Sources */,
155C7DFF19A71C5C00F08B25 /* CCBProxy.cpp in Sources */,
1595523B1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp in Sources */,
155C7DF019A71C1E00F08B25 /* lua_cocos2dx_spine_auto.cpp in Sources */,
155C7E0719A71C7800F08B25 /* lua_cocos2dx_extension_manual.cpp in Sources */,
15EFA625198B31FB000C57D3 /* LuaOpengl.cpp in Sources */,
@ -1138,6 +1161,7 @@
15EFA618198B2E2B000C57D3 /* lua_cocos2dx_auto.cpp in Sources */,
15EFA619198B2E2B000C57D3 /* lua_cocos2dx_physics_auto.cpp in Sources */,
15415AB219A71A53004F1E71 /* inet.c in Sources */,
159552411A25E4B8001E9FC9 /* lua_cocos2dx_csloader_manual.cpp in Sources */,
155C7E1319A71CA400F08B25 /* Lua_web_socket.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -41,6 +41,7 @@
<ClCompile Include="..\auto\lua_cocos2dx_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_cocosbuilder_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_cocosdenshion_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_csloader_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_experimental_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_experimental_video_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_extension_auto.cpp" />
@ -66,6 +67,7 @@
<ClCompile Include="..\manual\cocosdenshion\lua_cocos2dx_cocosdenshion_manual.cpp" />
<ClCompile Include="..\manual\cocostudio\CustomGUIReader.cpp" />
<ClCompile Include="..\manual\cocostudio\lua_cocos2dx_coco_studio_manual.cpp" />
<ClCompile Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.cpp" />
<ClCompile Include="..\manual\extension\lua_cocos2dx_extension_manual.cpp" />
<ClCompile Include="..\manual\LuaBasicConversions.cpp" />
<ClCompile Include="..\manual\network\lua_cocos2dx_network_manual.cpp" />
@ -111,6 +113,7 @@
<ClInclude Include="..\auto\lua_cocos2dx_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_cocosbuilder_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_cocosdenshion_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_csloader_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_experimental_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_experimental_video_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_extension_auto.hpp" />
@ -136,6 +139,7 @@
<ClInclude Include="..\manual\cocosdenshion\lua_cocos2dx_cocosdenshion_manual.h" />
<ClInclude Include="..\manual\cocostudio\CustomGUIReader.h" />
<ClInclude Include="..\manual\cocostudio\lua_cocos2dx_coco_studio_manual.hpp" />
<ClInclude Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.hpp" />
<ClInclude Include="..\manual\extension\lua_cocos2dx_extension_manual.h" />
<ClInclude Include="..\manual\LuaBasicConversions.h" />
<ClInclude Include="..\manual\network\lua_cocos2dx_network_manual.h" />

View File

@ -276,6 +276,12 @@
<ClCompile Include="..\manual\audioengine\lua_cocos2dx_audioengine_manual.cpp">
<Filter>manual\audioengine</Filter>
</ClCompile>
<ClCompile Include="..\auto\lua_cocos2dx_csloader_auto.cpp">
<Filter>auto</Filter>
</ClCompile>
<ClCompile Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.cpp">
<Filter>manual\cocostudio</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\auto\lua_cocos2dx_auto.hpp">
@ -482,6 +488,12 @@
<ClInclude Include="..\manual\audioengine\lua_cocos2dx_audioengine_manual.h">
<Filter>manual\audioengine</Filter>
</ClInclude>
<ClInclude Include="..\auto\lua_cocos2dx_csloader_auto.hpp">
<Filter>auto</Filter>
</ClInclude>
<ClInclude Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.hpp">
<Filter>manual\cocostudio</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\script\CCBReaderLoad.lua">

View File

@ -1,13 +1,11 @@
#ifndef __TEST_LUA_TESTS_PROJECT_CLASSES_LUA_MODULE_REGISTER_H__
#define __TEST_LUA_TESTS_PROJECT_CLASSES_LUA_MODULE_REGISTER_H__
#include "network/lua_cocos2dx_network_manual.h"
#include "cocosdenshion/lua_cocos2dx_cocosdenshion_manual.h"
int lua_module_register(lua_State* L)
{
register_network_module(L);
register_cocosdenshion_module(L);
return 1;
}

View File

@ -54,7 +54,7 @@ else()
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}${RES_PREFIX}/res
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}${RES_PREFIX}/Resources/src
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}${RES_PREFIX}/src
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}/Resources/src/cocos
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tests/cpp-tests/Resources ${APP_BIN_DIR}${RES_PREFIX}/res
)

View File

@ -22,11 +22,11 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCProtectedNode.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device CSLoader ClippingRectangleNode .*Light$
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device ClippingRectangleNode .*Light$
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
@ -144,8 +144,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
DirectionLight3D::[*],
PointLight3D::[*],
SpotLight3D::[*],
AmbientLight3D::[*],
CSLoader::[nodeFromXML nodeFromProtocolBuffers createTimeline nodeWithFlatBuffers]
AmbientLight3D::[*]
rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame],
ProgressTimer::[setReverseProgress=setReverseDirection],

View File

@ -0,0 +1,60 @@
[cocos2dx_csloader]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = cocos2dx_csloader
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = cc
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
clang_flags = -nostdinc -x c++ -std=c++11 -U __SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = CSLoader
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = CSLoader::[nodeFromXML nodeFromProtocolBuffers createTimeline nodeWithFlatBuffers]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no

View File

@ -139,6 +139,7 @@ def main():
'cocos2dx_cocosdenshion.ini': ('cocos2dx_cocosdenshion', 'lua_cocos2dx_cocosdenshion_auto'), \
'cocos2dx_3d.ini': ('cocos2dx_3d', 'lua_cocos2dx_3d_auto'), \
'cocos2dx_audioengine.ini': ('cocos2dx_audioengine', 'lua_cocos2dx_audioengine_auto'), \
'cocos2dx_csloader.ini' : ('cocos2dx_csloader', 'lua_cocos2dx_csloader_auto'), \
}
target = 'lua'
generator_py = '%s/generator.py' % cxx_generator_root