Ejemplo n.º 1
0
TDLuaMgr::TDLuaMgr(void)
{
	luaThreadPool = new TDThreadPool(1);
	engine = LuaEngine::getInstance();
	m_pLuaState = LuaEngine::getInstance()->getLuaStack()->getLuaState();
	addLuaLoader(custom_loadlua);
}
Ejemplo n.º 2
0
bool LuaStack::init(void)
{
    _state = lua_open();
    luaL_openlibs(_state);
    tolua_Cocos2d_open(_state);
    toluafix_open(_state);

    // Register our version of the global "print" function
    const luaL_reg global_functions [] = {
        {"print", lua_print},
        {NULL, NULL}
    };
    luaL_register(_state, "_G", global_functions);

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    LuaObjcBridge::luaopen_luaoc(_state);
#endif
    tolua_extensions_ccb_open(_state);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
    tolua_web_socket_open(_state);
#endif
    tolua_opengl_open(_state);
    tolua_scroll_view_open(_state);
    tolua_script_handler_mgr_open(_state);
    
    // add cocos2dx loader
    addLuaLoader(cocos2dx_lua_loader);

    return true;
}
Ejemplo n.º 3
0
bool LuaStack::init(void)
{
    _state = lua_open();
    luaL_openlibs(_state);
    toluafix_open(_state);

    // Register our version of the global "print" function
    const luaL_reg global_functions [] = {
        {"print", lua_print},
        {NULL, NULL}
    };
    luaL_register(_state, "_G", global_functions);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    luaopen_lua_extensions(_state);
#endif
    g_luaType.clear();
    register_all_cocos2dx(_state);
    register_all_cocos2dx_extension(_state);
    register_cocos2dx_extension_CCBProxy(_state);
    tolua_opengl_open(_state);
    register_all_cocos2dx_ui(_state);
    register_all_cocos2dx_studio(_state);
    register_all_cocos2dx_manual(_state);
    register_all_cocos2dx_module_manual(_state);
    register_all_cocos2dx_extension_manual(_state);
    register_all_cocos2dx_coco_studio_manual(_state);
    register_all_cocos2dx_ui_manual(_state);
    register_all_cocos2dx_spine(_state);
    register_all_cocos2dx_spine_manual(_state);
    register_glnode_manual(_state);
#if CC_USE_PHYSICS
    register_all_cocos2dx_physics(_state);
    register_all_cocos2dx_physics_manual(_state);
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    LuaObjcBridge::luaopen_luaoc(_state);
#endif

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    LuaJavaBridge::luaopen_luaj(_state);
#endif

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
    tolua_web_socket_open(_state);
    register_web_socket_manual(_state);
#endif

    register_xml_http_request(_state);
    register_all_cocos2dx_deprecated(_state);
    register_all_cocos2dx_manual_deprecated(_state);

    tolua_script_handler_mgr_open(_state);

    // add cocos2dx loader
    addLuaLoader(cocos2dx_lua_loader);

    return true;
}
Ejemplo n.º 4
0
bool CCLuaEngine::init(void)
{
    m_state = lua_open();
    luaL_openlibs(m_state);
    tolua_Cocos2d_open(m_state);
    tolua_prepare_ccobject_table(m_state);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    addLuaLoader(loader_Android);
#endif
    return true;
}
bool LuaStack::init(void)
{
    _state = lua_open();
    luaL_openlibs(_state);
    toluafix_open(_state);

    // Register our version of the global "print" function
    const luaL_reg global_functions [] = {
        {"print", lua_print},
        {"release_print",lua_release_print},
        {nullptr, nullptr}
    };
    luaL_register(_state, "_G", global_functions);

    g_luaType.clear();
    register_all_cocos2dx(_state);
    tolua_opengl_open(_state);
    register_all_cocos2dx_manual(_state);
    register_all_cocos2dx_module_manual(_state);
    register_all_cocos2dx_math_manual(_state);
    register_all_cocos2dx_experimental(_state);
    register_all_cocos2dx_experimental_manual(_state);

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    register_all_cocos2dx_TalkingDataGA(_state);
    register_all_cocos2dx_TDGAAccount(_state);
    register_all_cocos2dx_TDGAMission(_state);
    register_all_cocos2dx_TDGAVirtualCurrency(_state);
    register_all_cocos2dx_TDGAItem(_state);
#endif
    
    register_glnode_manual(_state);
#if CC_USE_PHYSICS
    register_all_cocos2dx_physics(_state);
    register_all_cocos2dx_physics_manual(_state);
#endif

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    LuaObjcBridge::luaopen_luaoc(_state);
#endif
    
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    LuaJavaBridge::luaopen_luaj(_state);
#endif
    register_all_cocos2dx_deprecated(_state);
    register_all_cocos2dx_manual_deprecated(_state);
    
    tolua_script_handler_mgr_open(_state);

    // add cocos2dx loader
    addLuaLoader(cocos2dx_lua_loader);

    return true;
}
Ejemplo n.º 6
0
bool CCLuaEngine::init(void)
{
    m_state = lua_open();
    luaL_openlibs(m_state);
    tolua_Cocos2d_open(m_state);
	tolua_UI_open(m_state);
    toluafix_open(m_state);
	luaopen_bit_custom(m_state);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
	CCLOG("addLuaLoader!!");
    addLuaLoader(loader_Android);
#endif
    return true;
}
Ejemplo n.º 7
0
bool CCLuaStack::init(void)
{
    m_state = lua_open();
    luaL_openlibs(m_state);
    tolua_Cocos2d_open(m_state);
    toluafix_open(m_state);

    // Register our version of the global "print" function
    const luaL_reg global_functions [] = {
        {"print", lua_print},
        {NULL, NULL}
    };
    luaL_register(m_state, "_G", global_functions);

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    CCLuaObjcBridge::luaopen_luaoc(m_state);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    addLuaLoader(loader_Android);
#endif
    return true;
}
bool CCLuaStack::init(void)
{
    m_state = lua_open();
    luaL_openlibs(m_state);
    tolua_Cocos2d_open(m_state);
    toluafix_open(m_state);

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    CCLuaObjcBridge::luaopen_luaoc(m_state);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    addLuaLoader(loader_Android);
#endif
    
    // register CCLuaLoadChunksFromZip
    lua_pushcfunction(m_state, loadChunksFromZip);
    lua_setglobal(m_state, "CCLuaLoadChunksFromZip");
    
    // register CCLuaStackSnapshot
    luaopen_snapshot(m_state);
    
    return true;
}
Ejemplo n.º 9
0
bool CCLuaStack::init(void)
{
    m_state = lua_open();
    luaL_openlibs(m_state);
    tolua_Cocos2d_open(m_state);
    toluafix_open(m_state);

    // Register our version of the global "print" function
    const luaL_reg global_functions [] = {
        {"print", lua_print},
        {NULL, NULL}
    };
    luaL_register(m_state, "_G", global_functions);
    tolua_CocoStudio_open(m_state);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    CCLuaObjcBridge::luaopen_luaoc(m_state);
#endif
    register_all_cocos2dx_extension_manual(m_state);
    register_all_cocos2dx_studio_manual(m_state);
    // add cocos2dx loader
    addLuaLoader(cocos2dx_lua_loader);

    return true;
}
bool LuaStack::init(void)
{
    _state = lua_open();
    luaL_openlibs(_state);
    toluafix_open(_state);

    // Register our version of the global "print" function
    const luaL_reg global_functions [] = {
        {"print", lua_print},
        {"release_print",lua_release_print},
        {nullptr, nullptr}
    };
    luaL_register(_state, "_G", global_functions);

    g_luaType.clear();
    register_all_cocos2dx(_state);
    tolua_opengl_open(_state);
    register_all_cocos2dx_manual(_state);
    register_all_cocos2dx_module_manual(_state);
    register_all_cocos2dx_math_manual(_state);
    register_all_cocos2dx_experimental(_state);
    register_all_cocos2dx_experimental_manual(_state);

    register_glnode_manual(_state);
#if CC_USE_PHYSICS
    register_all_cocos2dx_physics(_state);
    register_all_cocos2dx_physics_manual(_state);
#endif

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    LuaObjcBridge::luaopen_luaoc(_state);
#endif
    
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    LuaJavaBridge::luaopen_luaj(_state);
#endif
    register_all_cocos2dx_deprecated(_state);
    register_all_cocos2dx_manual_deprecated(_state);
    
    tolua_script_handler_mgr_open(_state);

    // add cocos2dx loader
    addLuaLoader(cocos2dx_lua_loader);
    
#if CC_USE_UC > 0
    // uc
    luaopen_ForUcLua_extra(_state);
#endif
    
#if CC_USE_QH >0
    luaopen_ForQiHuLua_extra(_state);
#endif
    
#if CC_USE_DATAEYE>0
    //DataEye
    luaopen_DataEye(_state);
#endif
    
#if CC_USE_AUDIO > 0
    tolua_script_handler_mgr_open(_state);
    tolua_DriftAudioSdkCocos2dxHelper_open(_state);
#endif
    
    
#if CC_USE_ALLSDK > 0
    //    所以SDK的接口
    luaopen_ForSDKLua_extra(_state);
#endif

    return true;
}
Ejemplo n.º 11
0
bool LuaStack::init(void)
{
    _state = lua_open();
    luaL_openlibs(_state);
    toluafix_open(_state);

    // Register our version of the global "print" function
    const luaL_reg global_functions [] = {
        {"print", lua_print},
        {"LuaLoadChunksFromZIP", LuaStack::lua_loadChunksFromZIP},
        {NULL, NULL}
    };
    luaL_register(_state, "_G", global_functions);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
    luaopen_lua_extensions(_state);
#endif
    
    // register CCLuaStackSnapshot
    luaopen_snapshot(_state);
    
    g_luaType.clear();

    register_all_cocos2dx(_state);
    register_all_cocos2dx_extension(_state);


    register_all_cocos2dx_manual(_state);
    register_all_cocos2dx_extension_manual(_state);

    // add spine support
    register_all_cocos2dx_spine(_state);
    register_all_cocos2dx_spine_manual(_state);

     
#if CC_USE_EXTRA_FILTERS
    register_all_cocos2dx_extension_filter(_state);
#endif
    
    luaopen_cocos2dx_extra_luabinding(_state);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    luaopen_cocos2dx_extra_ios_iap_luabinding(_state);
#endif
    luaopen_HelperFunc_luabinding(_state);
#if CC_USE_PHYSICS
    register_all_cocos2dx_physics(_state);
    register_all_cocos2dx_physics_manual(_state);
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    LuaObjcBridge::luaopen_luaoc(_state);
#endif
    
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    LuaJavaBridge::luaopen_luaj(_state);
#endif

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#if CC_USE_WEBSOCKET
    tolua_web_socket_open(_state);
    register_web_socket_manual(_state);
#endif
#endif

#if ANYSDK_DEFINE > 0
    register_all_anysdk(_state);
    register_all_anysdk_manual(_state);
#endif
    
    //register_xml_http_request(_state);
    
    tolua_script_handler_mgr_open(_state);

    // add cocos2dx loader
    addLuaLoader(cocos2dx_lua_loader);

    return true;
}