mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_cocostudio
This commit is contained in:
commit
9bf706aef5
|
@ -1,5 +1,6 @@
|
|||
cocos2d-x-3.3 ???
|
||||
[FIX] Label: when a label is added to a invisible parent node, app will crash if switching from background
|
||||
[FIX] Label: label will not be shown when using system font on Mac
|
||||
[FIX] Studio reader: replace protocol buffer with flatbuffer
|
||||
|
||||
cocos2d-x-3.3-rc1 Nov.29 2014
|
||||
|
|
|
@ -127,7 +127,7 @@ else()
|
|||
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
|
||||
endif()
|
||||
|
||||
foreach(pkg ZLIB MINIZIP JPEG PNG TIFF TinyXML2 FREETYPE WEBSOCKETS CURL PROTOBUF_LITE)
|
||||
foreach(pkg ZLIB MINIZIP JPEG PNG TIFF TinyXML2 FREETYPE WEBSOCKETS CURL FLATBUFFERS)
|
||||
cocos_use_pkg(cocos2d ${pkg})
|
||||
endforeach()
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch
|
|||
lastBreakLocation = i + insertCount;
|
||||
}
|
||||
textSize = [lineBreak sizeWithAttributes:tokenAttributesDict];
|
||||
if(textSize.height > info->height)
|
||||
if(info->height > 0 && textSize.height > info->height)
|
||||
break;
|
||||
if (textSize.width > info->width) {
|
||||
if(lastBreakLocation > 0) {
|
||||
|
|
|
@ -460,7 +460,7 @@ void MeshCommand::setLightUniforms()
|
|||
else // normal does not exist
|
||||
{
|
||||
Vec3 ambient(0.0f, 0.0f, 0.0f);
|
||||
bool hasAmbient;
|
||||
bool hasAmbient = false;
|
||||
for (const auto& light : lights)
|
||||
{
|
||||
if (light->getLightType() == LightType::AMBIENT)
|
||||
|
|
|
@ -12,28 +12,14 @@
|
|||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineCache] createActionFromProtocolBuffers
|
||||
-- @function [parent=#ActionTimelineCache] createActionWithFlatBuffersFile
|
||||
-- @param self
|
||||
-- @param #string fileName
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineCache] createActionFromXML
|
||||
-- @param self
|
||||
-- @param #string fileName
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithFileFromProtocolBuffers
|
||||
-- @param self
|
||||
-- @param #string fileName
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithFileFromXML
|
||||
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithFlatBuffersFile
|
||||
-- @param self
|
||||
-- @param #string fileName
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
-- @module CSLoader
|
||||
-- @parent_module cc
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] setJsonPath
|
||||
-- @param self
|
||||
-- @param #string jsonPath
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] createNodeFromJson
|
||||
|
@ -12,28 +18,11 @@
|
|||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] createNodeFromProtocolBuffers
|
||||
-- @function [parent=#CSLoader] createNodeWithFlatBuffersFile
|
||||
-- @param self
|
||||
-- @param #string filename
|
||||
-- @return Node#Node ret (return value: cc.Node)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] init
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] setRecordXMLPath
|
||||
-- @param self
|
||||
-- @param #bool record
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] setJsonPath
|
||||
-- @param self
|
||||
-- @param #string jsonPath
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] loadNodeWithFile
|
||||
|
@ -41,6 +30,26 @@
|
|||
-- @param #string fileName
|
||||
-- @return Node#Node ret (return value: cc.Node)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] bindCallback
|
||||
-- @param self
|
||||
-- @param #string callbackName
|
||||
-- @param #string callbackType
|
||||
-- @param #ccui.Widget sender
|
||||
-- @param #cc.Node handler
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] purge
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] init
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] loadNodeWithContent
|
||||
|
@ -48,49 +57,12 @@
|
|||
-- @param #string content
|
||||
-- @return Node#Node ret (return value: cc.Node)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] isRecordProtocolBuffersPath
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] isRecordXMLPath
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] getProtocolBuffersPath
|
||||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] getXMLPath
|
||||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] createNodeFromXML
|
||||
-- @param self
|
||||
-- @param #string filename
|
||||
-- @return Node#Node ret (return value: cc.Node)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] isRecordJsonPath
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] setRecordProtocolBuffersPath
|
||||
-- @param self
|
||||
-- @param #bool record
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] getJsonPath
|
||||
|
@ -103,23 +75,6 @@
|
|||
-- @param self
|
||||
-- @param #bool record
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] setProtocolBuffersPath
|
||||
-- @param self
|
||||
-- @param #string protocolBuffersPath
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] purge
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] setXMLPath
|
||||
-- @param self
|
||||
-- @param #string xmlPath
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] destroyInstance
|
||||
|
|
|
@ -30,6 +30,12 @@
|
|||
-- @param self
|
||||
-- @param #bool flippedX
|
||||
|
||||
--------------------------------
|
||||
-- callbackName getter and setter.
|
||||
-- @function [parent=#Widget] setCallbackName
|
||||
-- @param self
|
||||
-- @param #string callbackName
|
||||
|
||||
--------------------------------
|
||||
-- Gets the Virtual Renderer of widget.<br>
|
||||
-- For example, a button's Virtual Renderer is it's texture renderer.<br>
|
||||
|
@ -118,13 +124,10 @@
|
|||
-- @return LayoutParameter#LayoutParameter ret (return value: ccui.LayoutParameter)
|
||||
|
||||
--------------------------------
|
||||
-- Checks a point if is in widget's space<br>
|
||||
-- param point<br>
|
||||
-- return true if the point is in widget's space, flase otherwise.
|
||||
-- @function [parent=#Widget] hitTest
|
||||
-- Set a event handler to the widget in order to use cocostudio editor and framework
|
||||
-- @function [parent=#Widget] addCCSEventListener
|
||||
-- @param self
|
||||
-- @param #vec2_table pt
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
-- @param #function callback
|
||||
|
||||
--------------------------------
|
||||
-- Gets the position type of the widget<br>
|
||||
|
@ -186,6 +189,12 @@
|
|||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Widget] getCallbackName
|
||||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Widget] getActionTag
|
||||
|
@ -311,6 +320,15 @@
|
|||
-- @param self
|
||||
-- @return Widget#Widget ret (return value: ccui.Widget)
|
||||
|
||||
--------------------------------
|
||||
-- Checks a point if is in widget's space<br>
|
||||
-- param point<br>
|
||||
-- return true if the point is in widget's space, flase otherwise.
|
||||
-- @function [parent=#Widget] hitTest
|
||||
-- @param self
|
||||
-- @param #vec2_table pt
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- when a widget calls this method, it will get focus immediately.
|
||||
-- @function [parent=#Widget] requestFocus
|
||||
|
@ -337,6 +355,12 @@
|
|||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Widget] getCallbackType
|
||||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Widget] addTouchEventListener
|
||||
|
@ -408,6 +432,12 @@
|
|||
-- @param self
|
||||
-- @param #bool bright
|
||||
|
||||
--------------------------------
|
||||
-- callbackType getter and setter.
|
||||
-- @function [parent=#Widget] setCallbackType
|
||||
-- @param self
|
||||
-- @param #string callbackType
|
||||
|
||||
--------------------------------
|
||||
-- Return whether the widget is swallowing touch or not<br>
|
||||
-- since v3.3
|
||||
|
|
|
@ -5,6 +5,55 @@
|
|||
|
||||
|
||||
|
||||
int lua_cocos2dx_csloader_CSLoader_setJsonPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:setJsonPath");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setJsonPath(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:setJsonPath",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_createNodeFromJson(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -55,7 +104,7 @@ int lua_cocos2dx_csloader_CSLoader_createNodeFromJson(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_createNodeFromProtocolBuffers(lua_State* tolua_S)
|
||||
int lua_cocos2dx_csloader_CSLoader_createNodeWithFlatBuffersFile(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
|
@ -75,7 +124,7 @@ int lua_cocos2dx_csloader_CSLoader_createNodeFromProtocolBuffers(lua_State* tolu
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_createNodeFromProtocolBuffers'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_createNodeWithFlatBuffersFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -85,166 +134,22 @@ int lua_cocos2dx_csloader_CSLoader_createNodeFromProtocolBuffers(lua_State* tolu
|
|||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:createNodeFromProtocolBuffers");
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:createNodeWithFlatBuffersFile");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_createNodeFromProtocolBuffers'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_createNodeWithFlatBuffersFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::Node* ret = cobj->createNodeFromProtocolBuffers(arg0);
|
||||
cocos2d::Node* ret = cobj->createNodeWithFlatBuffersFile(arg0);
|
||||
object_to_luaval<cocos2d::Node>(tolua_S, "cc.Node",(cocos2d::Node*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:createNodeFromProtocolBuffers",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:createNodeWithFlatBuffersFile",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_createNodeFromProtocolBuffers'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_init(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_init'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_init'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->init();
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:init",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_init'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_setRecordXMLPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_setRecordXMLPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
bool arg0;
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.CSLoader:setRecordXMLPath");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_setRecordXMLPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setRecordXMLPath(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:setRecordXMLPath",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_setRecordXMLPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_setJsonPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:setJsonPath");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setJsonPath(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:setJsonPath",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_createNodeWithFlatBuffersFile'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -299,6 +204,157 @@ int lua_cocos2dx_csloader_CSLoader_loadNodeWithFile(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_bindCallback(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_bindCallback'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 4)
|
||||
{
|
||||
std::string arg0;
|
||||
std::string arg1;
|
||||
cocos2d::ui::Widget* arg2;
|
||||
cocos2d::Node* arg3;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:bindCallback");
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.CSLoader:bindCallback");
|
||||
|
||||
ok &= luaval_to_object<cocos2d::ui::Widget>(tolua_S, 4, "ccui.Widget",&arg2);
|
||||
|
||||
ok &= luaval_to_object<cocos2d::Node>(tolua_S, 5, "cc.Node",&arg3);
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_bindCallback'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->bindCallback(arg0, arg1, arg2, arg3);
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:bindCallback",argc, 4);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_bindCallback'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_purge(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_purge'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_purge'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->purge();
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:purge",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_purge'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_init(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_init'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_init'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->init();
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:init",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_init'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_loadNodeWithContent(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -349,244 +405,6 @@ int lua_cocos2dx_csloader_CSLoader_loadNodeWithContent(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_isRecordProtocolBuffersPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_isRecordProtocolBuffersPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_isRecordProtocolBuffersPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->isRecordProtocolBuffersPath();
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:isRecordProtocolBuffersPath",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_isRecordProtocolBuffersPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_isRecordXMLPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_isRecordXMLPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_isRecordXMLPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->isRecordXMLPath();
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:isRecordXMLPath",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_isRecordXMLPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_getProtocolBuffersPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_getProtocolBuffersPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_getProtocolBuffersPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
std::string ret = cobj->getProtocolBuffersPath();
|
||||
tolua_pushcppstring(tolua_S,ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:getProtocolBuffersPath",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_getProtocolBuffersPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_getXMLPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_getXMLPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_getXMLPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
std::string ret = cobj->getXMLPath();
|
||||
tolua_pushcppstring(tolua_S,ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:getXMLPath",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_getXMLPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_createNodeFromXML(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_createNodeFromXML'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:createNodeFromXML");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_createNodeFromXML'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::Node* ret = cobj->createNodeFromXML(arg0);
|
||||
object_to_luaval<cocos2d::Node>(tolua_S, "cc.Node",(cocos2d::Node*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:createNodeFromXML",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_createNodeFromXML'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_isRecordJsonPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -634,55 +452,6 @@ int lua_cocos2dx_csloader_CSLoader_isRecordJsonPath(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_setRecordProtocolBuffersPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_setRecordProtocolBuffersPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
bool arg0;
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.CSLoader:setRecordProtocolBuffersPath");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_setRecordProtocolBuffersPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setRecordProtocolBuffersPath(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:setRecordProtocolBuffersPath",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_setRecordProtocolBuffersPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_getJsonPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -779,150 +548,6 @@ int lua_cocos2dx_csloader_CSLoader_setRecordJsonPath(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_setProtocolBuffersPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_setProtocolBuffersPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:setProtocolBuffersPath");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_setProtocolBuffersPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setProtocolBuffersPath(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:setProtocolBuffersPath",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_setProtocolBuffersPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_purge(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_purge'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_purge'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->purge();
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:purge",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_purge'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_setXMLPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_setXMLPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:setXMLPath");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_setXMLPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setXMLPath(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:setXMLPath",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_setXMLPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_destroyInstance(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -1074,25 +699,17 @@ int lua_register_cocos2dx_csloader_CSLoader(lua_State* tolua_S)
|
|||
|
||||
tolua_beginmodule(tolua_S,"CSLoader");
|
||||
tolua_function(tolua_S,"new",lua_cocos2dx_csloader_CSLoader_constructor);
|
||||
tolua_function(tolua_S,"createNodeFromJson",lua_cocos2dx_csloader_CSLoader_createNodeFromJson);
|
||||
tolua_function(tolua_S,"createNodeFromProtocolBuffers",lua_cocos2dx_csloader_CSLoader_createNodeFromProtocolBuffers);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_csloader_CSLoader_init);
|
||||
tolua_function(tolua_S,"setRecordXMLPath",lua_cocos2dx_csloader_CSLoader_setRecordXMLPath);
|
||||
tolua_function(tolua_S,"setJsonPath",lua_cocos2dx_csloader_CSLoader_setJsonPath);
|
||||
tolua_function(tolua_S,"createNodeFromJson",lua_cocos2dx_csloader_CSLoader_createNodeFromJson);
|
||||
tolua_function(tolua_S,"createNodeWithFlatBuffersFile",lua_cocos2dx_csloader_CSLoader_createNodeWithFlatBuffersFile);
|
||||
tolua_function(tolua_S,"loadNodeWithFile",lua_cocos2dx_csloader_CSLoader_loadNodeWithFile);
|
||||
tolua_function(tolua_S,"bindCallback",lua_cocos2dx_csloader_CSLoader_bindCallback);
|
||||
tolua_function(tolua_S,"purge",lua_cocos2dx_csloader_CSLoader_purge);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_csloader_CSLoader_init);
|
||||
tolua_function(tolua_S,"loadNodeWithContent",lua_cocos2dx_csloader_CSLoader_loadNodeWithContent);
|
||||
tolua_function(tolua_S,"isRecordProtocolBuffersPath",lua_cocos2dx_csloader_CSLoader_isRecordProtocolBuffersPath);
|
||||
tolua_function(tolua_S,"isRecordXMLPath",lua_cocos2dx_csloader_CSLoader_isRecordXMLPath);
|
||||
tolua_function(tolua_S,"getProtocolBuffersPath",lua_cocos2dx_csloader_CSLoader_getProtocolBuffersPath);
|
||||
tolua_function(tolua_S,"getXMLPath",lua_cocos2dx_csloader_CSLoader_getXMLPath);
|
||||
tolua_function(tolua_S,"createNodeFromXML",lua_cocos2dx_csloader_CSLoader_createNodeFromXML);
|
||||
tolua_function(tolua_S,"isRecordJsonPath",lua_cocos2dx_csloader_CSLoader_isRecordJsonPath);
|
||||
tolua_function(tolua_S,"setRecordProtocolBuffersPath",lua_cocos2dx_csloader_CSLoader_setRecordProtocolBuffersPath);
|
||||
tolua_function(tolua_S,"getJsonPath",lua_cocos2dx_csloader_CSLoader_getJsonPath);
|
||||
tolua_function(tolua_S,"setRecordJsonPath",lua_cocos2dx_csloader_CSLoader_setRecordJsonPath);
|
||||
tolua_function(tolua_S,"setProtocolBuffersPath",lua_cocos2dx_csloader_CSLoader_setProtocolBuffersPath);
|
||||
tolua_function(tolua_S,"purge",lua_cocos2dx_csloader_CSLoader_purge);
|
||||
tolua_function(tolua_S,"setXMLPath",lua_cocos2dx_csloader_CSLoader_setXMLPath);
|
||||
tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_csloader_CSLoader_destroyInstance);
|
||||
tolua_function(tolua_S,"createNode", lua_cocos2dx_csloader_CSLoader_createNode);
|
||||
tolua_function(tolua_S,"getInstance", lua_cocos2dx_csloader_CSLoader_getInstance);
|
||||
|
|
|
@ -23,14 +23,6 @@ int register_all_cocos2dx_csloader(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15210,7 +15210,7 @@ int lua_cocos2dx_studio_ActionTimelineCache_createActionFromJson(lua_State* tolu
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_createActionFromProtocolBuffers(lua_State* tolua_S)
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_createActionWithFlatBuffersFile(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineCache* cobj = nullptr;
|
||||
|
@ -15230,7 +15230,7 @@ int lua_cocos2dx_studio_ActionTimelineCache_createActionFromProtocolBuffers(lua_
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionFromProtocolBuffers'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionWithFlatBuffersFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -15240,27 +15240,27 @@ int lua_cocos2dx_studio_ActionTimelineCache_createActionFromProtocolBuffers(lua_
|
|||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimelineCache:createActionFromProtocolBuffers");
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimelineCache:createActionWithFlatBuffersFile");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionFromProtocolBuffers'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionWithFlatBuffersFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->createActionFromProtocolBuffers(arg0);
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->createActionWithFlatBuffersFile(arg0);
|
||||
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineCache:createActionFromProtocolBuffers",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineCache:createActionWithFlatBuffersFile",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionFromProtocolBuffers'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionWithFlatBuffersFile'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_createActionFromXML(lua_State* tolua_S)
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFlatBuffersFile(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineCache* cobj = nullptr;
|
||||
|
@ -15280,7 +15280,7 @@ int lua_cocos2dx_studio_ActionTimelineCache_createActionFromXML(lua_State* tolua
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionFromXML'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFlatBuffersFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -15290,122 +15290,22 @@ int lua_cocos2dx_studio_ActionTimelineCache_createActionFromXML(lua_State* tolua
|
|||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimelineCache:createActionFromXML");
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimelineCache:loadAnimationActionWithFlatBuffersFile");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionFromXML'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFlatBuffersFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->createActionFromXML(arg0);
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->loadAnimationActionWithFlatBuffersFile(arg0);
|
||||
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineCache:createActionFromXML",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineCache:loadAnimationActionWithFlatBuffersFile",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionFromXML'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromProtocolBuffers(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineCache* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineCache",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimelineCache*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromProtocolBuffers'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimelineCache:loadAnimationActionWithFileFromProtocolBuffers");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromProtocolBuffers'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->loadAnimationActionWithFileFromProtocolBuffers(arg0);
|
||||
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineCache:loadAnimationActionWithFileFromProtocolBuffers",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromProtocolBuffers'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromXML(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineCache* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineCache",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimelineCache*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromXML'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimelineCache:loadAnimationActionWithFileFromXML");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromXML'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->loadAnimationActionWithFileFromXML(arg0);
|
||||
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineCache:loadAnimationActionWithFileFromXML",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromXML'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFlatBuffersFile'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -15736,10 +15636,8 @@ int lua_register_cocos2dx_studio_ActionTimelineCache(lua_State* tolua_S)
|
|||
|
||||
tolua_beginmodule(tolua_S,"ActionTimelineCache");
|
||||
tolua_function(tolua_S,"createActionFromJson",lua_cocos2dx_studio_ActionTimelineCache_createActionFromJson);
|
||||
tolua_function(tolua_S,"createActionFromProtocolBuffers",lua_cocos2dx_studio_ActionTimelineCache_createActionFromProtocolBuffers);
|
||||
tolua_function(tolua_S,"createActionFromXML",lua_cocos2dx_studio_ActionTimelineCache_createActionFromXML);
|
||||
tolua_function(tolua_S,"loadAnimationActionWithFileFromProtocolBuffers",lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromProtocolBuffers);
|
||||
tolua_function(tolua_S,"loadAnimationActionWithFileFromXML",lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFileFromXML);
|
||||
tolua_function(tolua_S,"createActionWithFlatBuffersFile",lua_cocos2dx_studio_ActionTimelineCache_createActionWithFlatBuffersFile);
|
||||
tolua_function(tolua_S,"loadAnimationActionWithFlatBuffersFile",lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFlatBuffersFile);
|
||||
tolua_function(tolua_S,"purge",lua_cocos2dx_studio_ActionTimelineCache_purge);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_studio_ActionTimelineCache_init);
|
||||
tolua_function(tolua_S,"loadAnimationActionWithFile",lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile);
|
||||
|
|
|
@ -484,8 +484,6 @@ int register_all_cocos2dx_studio(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1059,6 +1059,55 @@ int lua_cocos2dx_ui_Widget_setFlippedX(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_setCallbackName(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Widget* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setCallbackName'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Widget:setCallbackName");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_setCallbackName'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setCallbackName(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:setCallbackName",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setCallbackName'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -1633,7 +1682,7 @@ int lua_cocos2dx_ui_Widget_getLayoutParameter(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_hitTest(lua_State* tolua_S)
|
||||
int lua_cocos2dx_ui_Widget_addCCSEventListener(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Widget* cobj = nullptr;
|
||||
|
@ -1653,7 +1702,7 @@ int lua_cocos2dx_ui_Widget_hitTest(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_hitTest'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_addCCSEventListener'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -1661,24 +1710,27 @@ int lua_cocos2dx_ui_Widget_hitTest(lua_State* tolua_S)
|
|||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Vec2 arg0;
|
||||
std::function<void (cocos2d::Ref *, int)> arg0;
|
||||
|
||||
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.Widget:hitTest");
|
||||
do {
|
||||
// Lambda binding for lua is not supported.
|
||||
assert(false);
|
||||
} while(0)
|
||||
;
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_hitTest'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_addCCSEventListener'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->hitTest(arg0);
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
cobj->addCCSEventListener(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:hitTest",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:addCCSEventListener",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_hitTest'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_addCCSEventListener'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -2067,6 +2119,53 @@ int lua_cocos2dx_ui_Widget_isTouchEnabled(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_getCallbackName(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Widget* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getCallbackName'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_getCallbackName'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
const std::string& ret = cobj->getCallbackName();
|
||||
tolua_pushcppstring(tolua_S,ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:getCallbackName",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getCallbackName'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_getActionTag(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -2931,6 +3030,56 @@ int lua_cocos2dx_ui_Widget_getCurrentFocusedWidget(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_hitTest(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Widget* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_hitTest'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Vec2 arg0;
|
||||
|
||||
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.Widget:hitTest");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_hitTest'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->hitTest(arg0);
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:hitTest",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_hitTest'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_requestFocus(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -3120,6 +3269,53 @@ int lua_cocos2dx_ui_Widget_getSizeType(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_getCallbackType(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Widget* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getCallbackType'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_getCallbackType'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
const std::string& ret = cobj->getCallbackType();
|
||||
tolua_pushcppstring(tolua_S,ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:getCallbackType",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getCallbackType'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_addTouchEventListener(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -3562,6 +3758,55 @@ int lua_cocos2dx_ui_Widget_setBright(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_setCallbackType(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Widget* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setCallbackType'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Widget:setCallbackType");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_setCallbackType'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setCallbackType(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:setCallbackType",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setCallbackType'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Widget_isSwallowTouches(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -3732,6 +3977,7 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getCustomSize",lua_cocos2dx_ui_Widget_getCustomSize);
|
||||
tolua_function(tolua_S,"getLeftBoundary",lua_cocos2dx_ui_Widget_getLeftBoundary);
|
||||
tolua_function(tolua_S,"setFlippedX",lua_cocos2dx_ui_Widget_setFlippedX);
|
||||
tolua_function(tolua_S,"setCallbackName",lua_cocos2dx_ui_Widget_setCallbackName);
|
||||
tolua_function(tolua_S,"getVirtualRenderer",lua_cocos2dx_ui_Widget_getVirtualRenderer);
|
||||
tolua_function(tolua_S,"setPropagateTouchEvents",lua_cocos2dx_ui_Widget_setPropagateTouchEvents);
|
||||
tolua_function(tolua_S,"getSizePercent",lua_cocos2dx_ui_Widget_getSizePercent);
|
||||
|
@ -3744,7 +3990,7 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getVirtualRendererSize",lua_cocos2dx_ui_Widget_getVirtualRendererSize);
|
||||
tolua_function(tolua_S,"isHighlighted",lua_cocos2dx_ui_Widget_isHighlighted);
|
||||
tolua_function(tolua_S,"getLayoutParameter",lua_cocos2dx_ui_Widget_getLayoutParameter);
|
||||
tolua_function(tolua_S,"hitTest",lua_cocos2dx_ui_Widget_hitTest);
|
||||
tolua_function(tolua_S,"addCCSEventListener",lua_cocos2dx_ui_Widget_addCCSEventListener);
|
||||
tolua_function(tolua_S,"getPositionType",lua_cocos2dx_ui_Widget_getPositionType);
|
||||
tolua_function(tolua_S,"getTopBoundary",lua_cocos2dx_ui_Widget_getTopBoundary);
|
||||
tolua_function(tolua_S,"ignoreContentAdaptWithSize",lua_cocos2dx_ui_Widget_ignoreContentAdaptWithSize);
|
||||
|
@ -3753,6 +3999,7 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"isFocused",lua_cocos2dx_ui_Widget_isFocused);
|
||||
tolua_function(tolua_S,"getTouchBeganPosition",lua_cocos2dx_ui_Widget_getTouchBeganPosition);
|
||||
tolua_function(tolua_S,"isTouchEnabled",lua_cocos2dx_ui_Widget_isTouchEnabled);
|
||||
tolua_function(tolua_S,"getCallbackName",lua_cocos2dx_ui_Widget_getCallbackName);
|
||||
tolua_function(tolua_S,"getActionTag",lua_cocos2dx_ui_Widget_getActionTag);
|
||||
tolua_function(tolua_S,"getWorldPosition",lua_cocos2dx_ui_Widget_getWorldPosition);
|
||||
tolua_function(tolua_S,"isFocusEnabled",lua_cocos2dx_ui_Widget_isFocusEnabled);
|
||||
|
@ -3771,10 +4018,12 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"setUnifySizeEnabled",lua_cocos2dx_ui_Widget_setUnifySizeEnabled);
|
||||
tolua_function(tolua_S,"isPropagateTouchEvents",lua_cocos2dx_ui_Widget_isPropagateTouchEvents);
|
||||
tolua_function(tolua_S,"getCurrentFocusedWidget",lua_cocos2dx_ui_Widget_getCurrentFocusedWidget);
|
||||
tolua_function(tolua_S,"hitTest",lua_cocos2dx_ui_Widget_hitTest);
|
||||
tolua_function(tolua_S,"requestFocus",lua_cocos2dx_ui_Widget_requestFocus);
|
||||
tolua_function(tolua_S,"updateSizeAndPosition",lua_cocos2dx_ui_Widget_updateSizeAndPosition);
|
||||
tolua_function(tolua_S,"getTouchMovePosition",lua_cocos2dx_ui_Widget_getTouchMovePosition);
|
||||
tolua_function(tolua_S,"getSizeType",lua_cocos2dx_ui_Widget_getSizeType);
|
||||
tolua_function(tolua_S,"getCallbackType",lua_cocos2dx_ui_Widget_getCallbackType);
|
||||
tolua_function(tolua_S,"addTouchEventListener",lua_cocos2dx_ui_Widget_addTouchEventListener);
|
||||
tolua_function(tolua_S,"getTouchEndPosition",lua_cocos2dx_ui_Widget_getTouchEndPosition);
|
||||
tolua_function(tolua_S,"getPositionPercent",lua_cocos2dx_ui_Widget_getPositionPercent);
|
||||
|
@ -3784,6 +4033,7 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"isClippingParentContainsPoint",lua_cocos2dx_ui_Widget_isClippingParentContainsPoint);
|
||||
tolua_function(tolua_S,"setSizeType",lua_cocos2dx_ui_Widget_setSizeType);
|
||||
tolua_function(tolua_S,"setBright",lua_cocos2dx_ui_Widget_setBright);
|
||||
tolua_function(tolua_S,"setCallbackType",lua_cocos2dx_ui_Widget_setCallbackType);
|
||||
tolua_function(tolua_S,"isSwallowTouches",lua_cocos2dx_ui_Widget_isSwallowTouches);
|
||||
tolua_function(tolua_S,"enableDpadNavigation", lua_cocos2dx_ui_Widget_enableDpadNavigation);
|
||||
tolua_function(tolua_S,"create", lua_cocos2dx_ui_Widget_create);
|
||||
|
|
|
@ -477,6 +477,11 @@ int register_all_cocos2dx_ui(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version":"v3-deps-27",
|
||||
"version":"v3-deps-28",
|
||||
"zip_file_size":"87419231",
|
||||
"repo_name":"cocos2d-x-3rd-party-libs-bin",
|
||||
"repo_parent":"https://github.com/cocos2d/",
|
||||
|
|
|
@ -603,24 +603,31 @@
|
|||
"cocos/editor-support/cocostudio/CCUtilMath.cpp",
|
||||
"cocos/editor-support/cocostudio/CCUtilMath.h",
|
||||
"cocos/editor-support/cocostudio/CMakeLists.txt",
|
||||
"cocos/editor-support/cocostudio/CSParseBinary.pb.cc",
|
||||
"cocos/editor-support/cocostudio/CSParseBinary.pb.h",
|
||||
"cocos/editor-support/cocostudio/CSParseBinary_generated.h",
|
||||
"cocos/editor-support/cocostudio/CocoLoader.cpp",
|
||||
"cocos/editor-support/cocostudio/CocoLoader.h",
|
||||
"cocos/editor-support/cocostudio/CocoStudio.h",
|
||||
"cocos/editor-support/cocostudio/CocosStudioExport.h",
|
||||
"cocos/editor-support/cocostudio/DictionaryHelper.cpp",
|
||||
"cocos/editor-support/cocostudio/DictionaryHelper.h",
|
||||
"cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp",
|
||||
"cocos/editor-support/cocostudio/FlatBuffersSerialize.h",
|
||||
"cocos/editor-support/cocostudio/TriggerBase.cpp",
|
||||
"cocos/editor-support/cocostudio/TriggerBase.h",
|
||||
"cocos/editor-support/cocostudio/TriggerMng.cpp",
|
||||
"cocos/editor-support/cocostudio/TriggerMng.h",
|
||||
"cocos/editor-support/cocostudio/TriggerObj.cpp",
|
||||
"cocos/editor-support/cocostudio/TriggerObj.h",
|
||||
"cocos/editor-support/cocostudio/WidgetCallBackHandlerProtocol.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetCallBackHandlerProtocol.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp",
|
||||
|
@ -629,12 +636,26 @@
|
|||
"cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/NodeReaderDefine.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/NodeReaderDefine.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/NodeReaderProtocol.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/NodeReaderProtocol.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.h",
|
||||
"cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp",
|
||||
|
@ -1483,6 +1504,18 @@
|
|||
"external/curl/prebuilt/wp_8.1/win32/ssleay32.lib",
|
||||
"external/edtaa3func/edtaa3func.cpp",
|
||||
"external/edtaa3func/edtaa3func.h",
|
||||
"external/flatbuffers/Android.mk",
|
||||
"external/flatbuffers/CMakeLists.txt",
|
||||
"external/flatbuffers/flatbuffers.h",
|
||||
"external/flatbuffers/flatc.cpp",
|
||||
"external/flatbuffers/idl.h",
|
||||
"external/flatbuffers/idl_gen_cpp.cpp",
|
||||
"external/flatbuffers/idl_gen_fbs.cpp",
|
||||
"external/flatbuffers/idl_gen_general.cpp",
|
||||
"external/flatbuffers/idl_gen_go.cpp",
|
||||
"external/flatbuffers/idl_gen_text.cpp",
|
||||
"external/flatbuffers/idl_parser.cpp",
|
||||
"external/flatbuffers/util.h",
|
||||
"external/freetype2/include/android/freetype2/freetype/config/ftconfig.h",
|
||||
"external/freetype2/include/android/freetype2/freetype/config/ftheader.h",
|
||||
"external/freetype2/include/android/freetype2/freetype/config/ftmodule.h",
|
||||
|
@ -2398,53 +2431,6 @@
|
|||
"external/png/prebuilt/wp8/Win32/libpng.lib",
|
||||
"external/png/prebuilt/wp_8.1/arm/libpng.lib",
|
||||
"external/png/prebuilt/wp_8.1/win32/libpng.lib",
|
||||
"external/protobuf-lite/Android.mk",
|
||||
"external/protobuf-lite/CMakeLists.txt",
|
||||
"external/protobuf-lite/src/google/protobuf/config.h",
|
||||
"external/protobuf-lite/src/google/protobuf/extension_set.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/extension_set.h",
|
||||
"external/protobuf-lite/src/google/protobuf/generated_message_util.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/generated_message_util.h",
|
||||
"external/protobuf-lite/src/google/protobuf/io/coded_stream.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/io/coded_stream.h",
|
||||
"external/protobuf-lite/src/google/protobuf/io/coded_stream_inl.h",
|
||||
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream.h",
|
||||
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream_impl.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream_impl.h",
|
||||
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream_impl_lite.h",
|
||||
"external/protobuf-lite/src/google/protobuf/message_lite.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/message_lite.h",
|
||||
"external/protobuf-lite/src/google/protobuf/repeated_field.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/repeated_field.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_macosx.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_pnacl.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/common.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/common.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/hash.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/map-util.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/once.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/once.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/platform_macros.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/stl_util.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/stringprintf.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/stringprintf.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/template_util.h",
|
||||
"external/protobuf-lite/src/google/protobuf/stubs/type_traits.h",
|
||||
"external/protobuf-lite/src/google/protobuf/wire_format_lite.cc",
|
||||
"external/protobuf-lite/src/google/protobuf/wire_format_lite.h",
|
||||
"external/protobuf-lite/src/google/protobuf/wire_format_lite_inl.h",
|
||||
"external/protobuf-lite/win32/config.h",
|
||||
"external/sqlite3/Android.mk",
|
||||
"external/sqlite3/include/sqlite3.h",
|
||||
"external/sqlite3/include/sqlite3ext.h",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "CCLuaEngine.h"
|
||||
#include "SimpleAudioEngine.h"
|
||||
#include "cocos2d.h"
|
||||
#include "CodeIDESupport.h"
|
||||
#include "Runtime.h"
|
||||
#include "ConfigParser.h"
|
||||
#include "lua_module_register.h"
|
||||
|
@ -18,6 +19,13 @@ AppDelegate::AppDelegate()
|
|||
AppDelegate::~AppDelegate()
|
||||
{
|
||||
SimpleAudioEngine::end();
|
||||
|
||||
#if (COCOS2D_DEBUG > 0 && CC_CODE_IDE_DEBUG_SUPPORT > 0)
|
||||
// NOTE:Please don't remove this call if you want to debug with Cocos Code IDE
|
||||
endRuntime();
|
||||
#endif
|
||||
|
||||
ConfigParser::purge();
|
||||
}
|
||||
|
||||
//if you want a different context,just modify the value of glContextAttrs
|
||||
|
@ -33,7 +41,7 @@ void AppDelegate::initGLContextAttrs()
|
|||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
#if (COCOS2D_DEBUG > 0)
|
||||
#if (COCOS2D_DEBUG > 0 && CC_CODE_IDE_DEBUG_SUPPORT > 0)
|
||||
// NOTE:Please don't remove this call if you want to debug with Cocos Code IDE
|
||||
initRuntime();
|
||||
#endif
|
||||
|
@ -44,7 +52,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
if(!glview) {
|
||||
Size viewSize = ConfigParser::getInstance()->getInitViewSize();
|
||||
string title = ConfigParser::getInstance()->getInitViewName();
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) && (COCOS2D_DEBUG > 0 && CC_CODE_IDE_DEBUG_SUPPORT > 0)
|
||||
extern void createSimulator(const char* viewName, float width, float height, bool isLandscape = true, float frameZoomFactor = 1.0f);
|
||||
bool isLanscape = ConfigParser::getInstance()->isLanscape();
|
||||
createSimulator(title.c_str(),viewSize.width,viewSize.height, isLanscape);
|
||||
|
@ -69,7 +77,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
//LuaStack* stack = engine->getLuaStack();
|
||||
//register_custom_function(stack->getLuaState());
|
||||
|
||||
#if (COCOS2D_DEBUG > 0)
|
||||
#if (COCOS2D_DEBUG > 0 && CC_CODE_IDE_DEBUG_SUPPORT > 0)
|
||||
// NOTE:Please don't remove this call if you want to debug with Cocos Code IDE
|
||||
startRuntime();
|
||||
#else
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __CODE_IDE_SUPPORT_H__
|
||||
#define __CODE_IDE_SUPPORT_H__
|
||||
|
||||
// define 1 to open Cocos Code IDE support, 0 to disable
|
||||
#define CC_CODE_IDE_DEBUG_SUPPORT 1
|
||||
|
||||
#endif /* __CODE_IDE_SUPPORT_H__ */
|
|
@ -4,6 +4,7 @@
|
|||
#include "json/stringbuffer.h"
|
||||
#include "json/writer.h"
|
||||
#include "ConfigParser.h"
|
||||
#include "FileServer.h"
|
||||
|
||||
#define CONFIG_FILE "config.json"
|
||||
#define CONSOLE_PORT 6010
|
||||
|
@ -12,21 +13,40 @@
|
|||
#define WIN_HEIGHT 640
|
||||
|
||||
// ConfigParser
|
||||
ConfigParser *ConfigParser::s_sharedInstance = NULL;
|
||||
ConfigParser *ConfigParser::s_sharedConfigParserInstance = NULL;
|
||||
ConfigParser *ConfigParser::getInstance(void)
|
||||
{
|
||||
if (!s_sharedInstance)
|
||||
if (!s_sharedConfigParserInstance)
|
||||
{
|
||||
s_sharedInstance = new ConfigParser();
|
||||
s_sharedInstance->readConfig();
|
||||
s_sharedConfigParserInstance = new ConfigParser();
|
||||
s_sharedConfigParserInstance->readConfig();
|
||||
}
|
||||
return s_sharedInstance;
|
||||
return s_sharedConfigParserInstance;
|
||||
}
|
||||
|
||||
void ConfigParser::purge()
|
||||
{
|
||||
CC_SAFE_DELETE(s_sharedConfigParserInstance);
|
||||
}
|
||||
|
||||
void ConfigParser::readConfig()
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
// add writable path to search path temporarily for reading config file
|
||||
vector<std::string> searchPathArray = FileUtils::getInstance()->getSearchPaths();
|
||||
searchPathArray.insert(searchPathArray.begin(), FileServer::getShareInstance()->getWritePath());
|
||||
FileUtils::getInstance()->setSearchPaths(searchPathArray);
|
||||
#endif
|
||||
|
||||
// read config file
|
||||
string fullPathFile = FileUtils::getInstance()->fullPathForFilename(CONFIG_FILE);
|
||||
string fileContent = FileUtils::getInstance()->getStringFromFile(fullPathFile);
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
// revert search path
|
||||
searchPathArray.erase(searchPathArray.end() - 1);
|
||||
FileUtils::getInstance()->setSearchPaths(searchPathArray);
|
||||
#endif
|
||||
|
||||
if(fileContent.empty())
|
||||
return;
|
||||
|
@ -49,7 +69,7 @@ void ConfigParser::readConfig()
|
|||
{
|
||||
float tmpvalue = _initViewSize.height;
|
||||
_initViewSize.height = _initViewSize.width;
|
||||
_initViewSize.width = tmpvalue;
|
||||
_initViewSize.width = tmpvalue;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,7 +108,7 @@ void ConfigParser::readConfig()
|
|||
const rapidjson::Value& ArrayScreenSize = _docRootjson["simulator_screen_size"];
|
||||
if (ArrayScreenSize.IsArray())
|
||||
{
|
||||
for (int i = 0; i<ArrayScreenSize.Size(); i++)
|
||||
for (int i = 0; i < ArrayScreenSize.Size(); i++)
|
||||
{
|
||||
const rapidjson::Value& objectScreenSize = ArrayScreenSize[i];
|
||||
if (objectScreenSize.HasMember("title") && objectScreenSize.HasMember("width") && objectScreenSize.HasMember("height"))
|
||||
|
|
|
@ -27,6 +27,7 @@ class ConfigParser
|
|||
{
|
||||
public:
|
||||
static ConfigParser *getInstance(void);
|
||||
static void purge();
|
||||
|
||||
// predefined screen size
|
||||
int getScreenSizeCount(void);
|
||||
|
@ -43,7 +44,7 @@ public:
|
|||
private:
|
||||
void readConfig();
|
||||
ConfigParser(void);
|
||||
static ConfigParser *s_sharedInstance;
|
||||
static ConfigParser *s_sharedConfigParserInstance;
|
||||
ScreenSizeArray _screenSizeArray;
|
||||
cocos2d::Size _initViewSize;
|
||||
string _viewName;
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
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 "ConnectWaitLayer.h"
|
||||
#include "Runtime.h"
|
||||
#include "FileServer.h"
|
||||
#include "ConfigParser.h"
|
||||
#include "VisibleRect.h"
|
||||
#include "ResData.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
ConnectWaitLayer::ConnectWaitLayer()
|
||||
{
|
||||
int designWidth = 1280;
|
||||
int designHeight = 800;
|
||||
_imagebg = new Image();
|
||||
|
||||
if (ConfigParser::getInstance()->isLanscape())
|
||||
{
|
||||
_imagebg->initWithImageData(__landscapePngData, sizeof(__landscapePngData));
|
||||
Director::getInstance()->getOpenGLView()->setDesignResolutionSize(designWidth, designHeight, ResolutionPolicy::EXACT_FIT);
|
||||
} else
|
||||
{
|
||||
_imagebg->initWithImageData(__portraitPngData, sizeof(__portraitPngData));
|
||||
Director::getInstance()->getOpenGLView()->setDesignResolutionSize(designHeight, designWidth, ResolutionPolicy::FIXED_HEIGHT);
|
||||
}
|
||||
Texture2D* texturebg = Director::getInstance()->getTextureCache()->addImage(_imagebg, "play_background");
|
||||
auto background = Sprite::createWithTexture(texturebg);
|
||||
background->setAnchorPoint(Vec2(0.5, 0.5));
|
||||
background->setPosition(VisibleRect::center());
|
||||
addChild(background, 9000);
|
||||
|
||||
// variable of below is"play" button position.
|
||||
int portraitX = 400;
|
||||
int portraitY = 500;
|
||||
int lanscaptX = 902;
|
||||
int lanscaptY = 400;
|
||||
_imageplay = new Image();
|
||||
_imageplay->initWithImageData(__playEnablePngData, sizeof(__playEnablePngData));
|
||||
Texture2D* textureplay = Director::getInstance()->getTextureCache()->addImage(_imageplay, "play_enable");
|
||||
auto playSprite = Sprite::createWithTexture(textureplay);
|
||||
addChild(playSprite, 9999);
|
||||
|
||||
_imageShine = new Image();
|
||||
_imageShine->initWithImageData(__shinePngData, sizeof(__shinePngData));
|
||||
Texture2D* textureShine = Director::getInstance()->getTextureCache()->addImage(_imageShine, "shine");
|
||||
auto shineSprite = Sprite::createWithTexture(textureShine);
|
||||
shineSprite->setOpacity(0);
|
||||
Vector<FiniteTimeAction*> arrayOfActions;
|
||||
arrayOfActions.pushBack(DelayTime::create(0.4f));
|
||||
arrayOfActions.pushBack(FadeTo::create(0.8f, 200));
|
||||
arrayOfActions.pushBack(FadeTo::create(0.8f, 255));
|
||||
arrayOfActions.pushBack(FadeTo::create(0.8f, 200));
|
||||
arrayOfActions.pushBack(FadeTo::create(0.8f, 0));
|
||||
arrayOfActions.pushBack(DelayTime::create(0.4f));
|
||||
shineSprite->runAction(RepeatForever::create(Sequence::create(arrayOfActions)));
|
||||
addChild(shineSprite, 9998);
|
||||
|
||||
std::string strip = getIPAddress();
|
||||
char szIPAddress[64] = {0};
|
||||
sprintf(szIPAddress, "IP: %s", strip.c_str());
|
||||
auto IPlabel = Label::createWithSystemFont(szIPAddress, "", 72);
|
||||
IPlabel->setAnchorPoint(Vec2(0, 0));
|
||||
int spaceSizex = 72;
|
||||
int spaceSizey = 200;
|
||||
IPlabel->setPosition(Point(VisibleRect::leftTop().x + spaceSizex, VisibleRect::top().y - spaceSizey));
|
||||
addChild(IPlabel, 9001);
|
||||
|
||||
std::string transferTip = "waiting for file transfer ...";
|
||||
if (CC_PLATFORM_WIN32 == CC_TARGET_PLATFORM || CC_PLATFORM_MAC == CC_TARGET_PLATFORM)
|
||||
{
|
||||
transferTip = "waiting for debugger to connect ...";
|
||||
}
|
||||
|
||||
char szVersion[256] = {0};
|
||||
sprintf(szVersion, "runtimeVersion:%s \nengineVersion:%s", getRuntimeVersion(), cocos2dVersion());
|
||||
Label* verLable = Label::createWithSystemFont(szVersion, "", 24);
|
||||
verLable->setAnchorPoint(Vec2(0, 0));
|
||||
int width = verLable->getBoundingBox().size.width;
|
||||
verLable->setPosition(Point(VisibleRect::right().x - width, VisibleRect::rightBottom().y));
|
||||
verLable->setAlignment(TextHAlignment::LEFT);
|
||||
addChild(verLable, 9002);
|
||||
_labelUploadFile = Label::createWithSystemFont(transferTip, "", 36);
|
||||
_labelUploadFile->setAnchorPoint(Vec2(0, 0));
|
||||
_labelUploadFile->setPosition(Point(VisibleRect::leftTop().x + spaceSizex, IPlabel->getPositionY()- spaceSizex));
|
||||
_labelUploadFile->setAlignment(TextHAlignment::LEFT);
|
||||
addChild(_labelUploadFile, 9003);
|
||||
|
||||
if (ConfigParser::getInstance()->isLanscape())
|
||||
{
|
||||
playSprite->setPosition(lanscaptX, lanscaptY);
|
||||
shineSprite->setPosition(lanscaptX, lanscaptY);
|
||||
}
|
||||
else
|
||||
{
|
||||
playSprite->setPosition(portraitX, portraitY);
|
||||
shineSprite->setPosition(portraitX, portraitY);
|
||||
}
|
||||
|
||||
auto listener = EventListenerTouchOneByOne::create();
|
||||
listener->onTouchBegan = [](Touch* touch, Event *event)->bool{
|
||||
auto target = static_cast<Sprite*>(event->getCurrentTarget());
|
||||
Vec2 point = target->convertToNodeSpace(Director::getInstance()->convertToGL(touch->getLocationInView()));
|
||||
auto rect = Rect(0, 0, target->getContentSize().width, target->getContentSize().height);
|
||||
if (!rect.containsPoint(point)) return false;
|
||||
target->stopAllActions();
|
||||
target->runAction(Sequence::createWithTwoActions(ScaleBy::create(0.05f, 0.9f), ScaleTo::create(0.125f, 1)));
|
||||
return true;
|
||||
};
|
||||
listener->onTouchEnded = [](Touch* touch, Event *event){
|
||||
auto target = static_cast<Sprite*>(event->getCurrentTarget());
|
||||
Vec2 point = target->convertToNodeSpace(Director::getInstance()->convertToGL(touch->getLocationInView()));
|
||||
auto rect = Rect(0, 0, target->getContentSize().width, target->getContentSize().height);
|
||||
if (!rect.containsPoint(point)) return;
|
||||
startScript("");
|
||||
};
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, playSprite);
|
||||
|
||||
this->scheduleUpdate();
|
||||
}
|
||||
|
||||
ConnectWaitLayer::~ConnectWaitLayer()
|
||||
{
|
||||
CC_SAFE_DELETE(_imagebg);
|
||||
CC_SAFE_DELETE(_imageplay);
|
||||
CC_SAFE_DELETE(_imageShine);
|
||||
}
|
||||
|
||||
// clean up: ignore stdin, stdout and stderr
|
||||
void ConnectWaitLayer::update(float fDelta)
|
||||
{
|
||||
std::string transferTip = FileServer::getShareInstance()->getTransingFileName();
|
||||
if (transferTip.empty()){
|
||||
return;
|
||||
}
|
||||
_labelUploadFile->setString(transferTip);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
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 _CONNECT_WAIT_LAYER__H_
|
||||
#define _CONNECT_WAIT_LAYER__H_
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
class ConnectWaitLayer: public cocos2d::Layer
|
||||
{
|
||||
public:
|
||||
ConnectWaitLayer();
|
||||
~ConnectWaitLayer();
|
||||
void update(float fDelta);
|
||||
|
||||
private:
|
||||
cocos2d::Image* _imagebg;
|
||||
cocos2d::Image* _imageplay;
|
||||
cocos2d::Image* _imageShine;
|
||||
|
||||
cocos2d::Label* _labelUploadFile;
|
||||
};
|
||||
|
||||
#endif // _CONNECT_WAIT_LAYER__H_
|
||||
|
|
@ -0,0 +1,315 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
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 "Runtime.h"
|
||||
#include "ConfigParser.h"
|
||||
#include "ConsoleCommand.h"
|
||||
#include "json/document.h"
|
||||
#include "json/filestream.h"
|
||||
#include "json/stringbuffer.h"
|
||||
#include "CCLuaEngine.h"
|
||||
|
||||
#include "cocos2d.h"
|
||||
using namespace cocos2d;
|
||||
|
||||
static void resetLuaModule(const string& fileName)
|
||||
{
|
||||
if (fileName.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto engine = LuaEngine::getInstance();
|
||||
LuaStack* luaStack = engine->getLuaStack();
|
||||
lua_State* stack = luaStack->getLuaState();
|
||||
lua_getglobal(stack, "package"); /* L: package */
|
||||
lua_getfield(stack, -1, "loaded"); /* L: package loaded */
|
||||
lua_pushnil(stack); /* L: lotable ?-.. nil */
|
||||
while (0 != lua_next(stack, -2)) /* L: lotable ?-.. key value */
|
||||
{
|
||||
//CCLOG("%s - %s \n", tolua_tostring(stack, -2, ""), lua_typename(stack, lua_type(stack, -1)));
|
||||
std::string key = tolua_tostring(stack, -2, "");
|
||||
std::string tableKey = key;
|
||||
size_t found = tableKey.rfind(".lua");
|
||||
if (found != std::string::npos)
|
||||
tableKey = tableKey.substr(0, found);
|
||||
tableKey = replaceAll(tableKey, ".", "/");
|
||||
tableKey = replaceAll(tableKey, "\\", "/");
|
||||
tableKey.append(".lua");
|
||||
found = fileName.rfind(tableKey);
|
||||
if (0 == found || (found != std::string::npos && fileName.at(found - 1) == '/'))
|
||||
{
|
||||
lua_pushstring(stack, key.c_str());
|
||||
lua_pushnil(stack);
|
||||
if (lua_istable(stack, -5))
|
||||
{
|
||||
lua_settable(stack, -5);
|
||||
}
|
||||
}
|
||||
lua_pop(stack, 1);
|
||||
}
|
||||
lua_pop(stack, 2);
|
||||
}
|
||||
|
||||
bool reloadScript(const string& file)
|
||||
{
|
||||
auto director = Director::getInstance();
|
||||
FontFNT::purgeCachedData();
|
||||
if (director->getOpenGLView())
|
||||
{
|
||||
SpriteFrameCache::getInstance()->removeSpriteFrames();
|
||||
director->getTextureCache()->removeAllTextures();
|
||||
}
|
||||
FileUtils::getInstance()->purgeCachedEntries();
|
||||
string modulefile = file;
|
||||
|
||||
if (! modulefile.empty())
|
||||
{
|
||||
resetLuaModule(modulefile);
|
||||
}
|
||||
else
|
||||
{
|
||||
modulefile = ConfigParser::getInstance()->getEntryFile().c_str();
|
||||
}
|
||||
|
||||
auto engine = LuaEngine::getInstance();
|
||||
LuaStack* luaStack = engine->getLuaStack();
|
||||
std::string require = "require \'" + modulefile + "\'";
|
||||
return luaStack->executeString(require.c_str());
|
||||
}
|
||||
|
||||
ConsoleCommand* ConsoleCommand::s_sharedConsoleCommand = nullptr;
|
||||
ConsoleCommand* ConsoleCommand::getShareInstance()
|
||||
{
|
||||
if (s_sharedConsoleCommand == nullptr)
|
||||
{
|
||||
s_sharedConsoleCommand = new ConsoleCommand();
|
||||
}
|
||||
return s_sharedConsoleCommand;
|
||||
}
|
||||
|
||||
void ConsoleCommand::purge()
|
||||
{
|
||||
if (s_sharedConsoleCommand != nullptr)
|
||||
{
|
||||
delete s_sharedConsoleCommand;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleCommand::init()
|
||||
{
|
||||
cocos2d::Console *_console = Director::getInstance()->getConsole();
|
||||
static struct Console::Command commands[] =
|
||||
{
|
||||
{"sendrequest","send command to runtime.Args[json format]",std::bind(&ConsoleCommand::onSendCommand, this, std::placeholders::_1, std::placeholders::_2)},
|
||||
};
|
||||
for (int i = 0;i< sizeof(commands) / sizeof(Console::Command);i++)
|
||||
{
|
||||
_console->addCommand(commands[i]);
|
||||
}
|
||||
#if(CC_PLATFORM_MAC == CC_TARGET_PLATFORM || CC_PLATFORM_WIN32 == CC_TARGET_PLATFORM)
|
||||
_console->listenOnTCP(ConfigParser::getInstance()->getConsolePort());
|
||||
#else
|
||||
_console->listenOnTCP(6010);
|
||||
#endif
|
||||
|
||||
_fileserver = FileServer::getShareInstance();
|
||||
#if(CC_PLATFORM_MAC == CC_TARGET_PLATFORM || CC_PLATFORM_WIN32 == CC_TARGET_PLATFORM)
|
||||
_fileserver->listenOnTCP(ConfigParser::getInstance()->getUploadPort());
|
||||
#else
|
||||
_fileserver->listenOnTCP(6020);
|
||||
#endif
|
||||
_fileserver->readResFileFinfo();
|
||||
}
|
||||
|
||||
void ConsoleCommand::onSendCommand(int fd, const std::string &args)
|
||||
{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=](){
|
||||
rapidjson::Document dArgParse;
|
||||
dArgParse.Parse<0>(args.c_str());
|
||||
if (dArgParse.HasMember("cmd"))
|
||||
{
|
||||
string strcmd = dArgParse["cmd"].GetString();
|
||||
|
||||
rapidjson::Document dReplyParse;
|
||||
dReplyParse.SetObject();
|
||||
dReplyParse.AddMember("cmd",strcmd.c_str(),dReplyParse.GetAllocator());
|
||||
if (dArgParse.HasMember("seq"))
|
||||
{
|
||||
dReplyParse.AddMember("seq",dArgParse["seq"],dReplyParse.GetAllocator());
|
||||
}
|
||||
|
||||
if(strcmp(strcmd.c_str(), "start-logic") == 0)
|
||||
{
|
||||
char szDebugArg[1024] = {0};
|
||||
sprintf(szDebugArg, "require('debugger')(%s,'%s')",dArgParse["debugcfg"].GetString(), "");
|
||||
startScript(szDebugArg);
|
||||
dReplyParse.AddMember("code", 0, dReplyParse.GetAllocator());
|
||||
|
||||
} else if(strcmp(strcmd.c_str(), "reload") == 0)
|
||||
{
|
||||
if (dArgParse.HasMember("modulefiles"))
|
||||
{
|
||||
rapidjson::Value bodyvalue(rapidjson::kObjectType);
|
||||
const rapidjson::Value& objectfiles = dArgParse["modulefiles"];
|
||||
for (rapidjson::SizeType i = 0; i < objectfiles.Size(); i++)
|
||||
{
|
||||
if (!reloadScript(objectfiles[i].GetString()))
|
||||
{
|
||||
bodyvalue.AddMember(objectfiles[i].GetString(), 1, dReplyParse.GetAllocator());
|
||||
}
|
||||
}
|
||||
if (0 == objectfiles.Size())
|
||||
{
|
||||
reloadScript("");
|
||||
}
|
||||
dReplyParse.AddMember("body", bodyvalue, dReplyParse.GetAllocator());
|
||||
}
|
||||
dReplyParse.AddMember("code", 0, dReplyParse.GetAllocator());
|
||||
} else if(strcmp(strcmd.c_str(), "getversion") == 0)
|
||||
{
|
||||
rapidjson::Value bodyvalue(rapidjson::kObjectType);
|
||||
bodyvalue.AddMember("version", getRuntimeVersion(), dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("body", bodyvalue, dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("code", 0, dReplyParse.GetAllocator());
|
||||
} else if(strcmp(strcmd.c_str(), "getfileinfo") == 0)
|
||||
{
|
||||
rapidjson::Value bodyvalue(rapidjson::kObjectType);
|
||||
rapidjson::Document* filecfgjson = _fileserver->getFileCfgJson();
|
||||
for (auto it = filecfgjson->MemberonBegin(); it != filecfgjson->MemberonEnd(); ++it)
|
||||
{
|
||||
bodyvalue.AddMember(it->name.GetString(), it->value.GetString(), dReplyParse.GetAllocator());
|
||||
}
|
||||
dReplyParse.AddMember("body", bodyvalue, dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("code", 0, dReplyParse.GetAllocator());
|
||||
|
||||
} else if (strcmp(strcmd.c_str(), "getEntryfile") == 0)
|
||||
{
|
||||
rapidjson::Value bodyvalue(rapidjson::kObjectType);
|
||||
rapidjson::Value entryFileValue(rapidjson::kStringType);
|
||||
entryFileValue.SetString(ConfigParser::getInstance()->getEntryFile().c_str(), dReplyParse.GetAllocator());
|
||||
bodyvalue.AddMember("entryfile", entryFileValue, dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("body", bodyvalue,dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("code", 0, dReplyParse.GetAllocator());
|
||||
} else if(strcmp(strcmd.c_str(), "getIP") == 0)
|
||||
{
|
||||
rapidjson::Value bodyvalue(rapidjson::kObjectType);
|
||||
rapidjson::Value IPValue(rapidjson::kStringType);
|
||||
IPValue.SetString(getIPAddress().c_str(), dReplyParse.GetAllocator());
|
||||
bodyvalue.AddMember("IP", IPValue,dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("body", bodyvalue,dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("code", 0, dReplyParse.GetAllocator());
|
||||
|
||||
} else if(strcmp(strcmd.c_str(), "remove") == 0)
|
||||
{
|
||||
if (dArgParse.HasMember("files"))
|
||||
{
|
||||
rapidjson::Value bodyvalue(rapidjson::kObjectType);
|
||||
const rapidjson::Value& objectfiles = dArgParse["files"];
|
||||
const char* filename = NULL;
|
||||
for (rapidjson::SizeType i = 0; i < objectfiles.Size(); i++)
|
||||
{
|
||||
filename = objectfiles[i].GetString();
|
||||
|
||||
// remove file from disk
|
||||
string filepath(_fileserver->getWritePath() + "/" + filename);
|
||||
if (FileUtils::getInstance()->isFileExist(filepath))
|
||||
{
|
||||
if(remove(filepath.c_str()) != 0)
|
||||
{
|
||||
// remove failed
|
||||
bodyvalue.AddMember(filename, 2, dReplyParse.GetAllocator());
|
||||
}
|
||||
} else
|
||||
{
|
||||
// file not exist
|
||||
bodyvalue.AddMember(filename, 1, dReplyParse.GetAllocator());
|
||||
}
|
||||
|
||||
// file remove success, remove it from record
|
||||
if (! FileUtils::getInstance()->isFileExist(filepath))
|
||||
_fileserver->removeResFileInfo(filename);
|
||||
}
|
||||
|
||||
dReplyParse.AddMember("body", bodyvalue, dReplyParse.GetAllocator());
|
||||
}
|
||||
|
||||
dReplyParse.AddMember("code",0,dReplyParse.GetAllocator());
|
||||
} else if(strcmp(strcmd.c_str(), "shutdownapp") == 0)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
extern void shutDownApp();
|
||||
shutDownApp();
|
||||
#else
|
||||
exit(0);
|
||||
#endif
|
||||
} else if(strcmp(strcmd.c_str(), "getplatform") == 0)
|
||||
{
|
||||
string platform="UNKNOW";
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
platform = "WIN32";
|
||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
platform = "MAC";
|
||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
platform = "IOS";
|
||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
platform = "ANDROID";
|
||||
#endif
|
||||
rapidjson::Value bodyvalue(rapidjson::kObjectType);
|
||||
rapidjson::Value platformValue(rapidjson::kStringType);
|
||||
platformValue.SetString(platform.c_str(), dReplyParse.GetAllocator());
|
||||
bodyvalue.AddMember("platform", platformValue, dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("body", bodyvalue, dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("code", 0, dReplyParse.GetAllocator());
|
||||
} else if(strcmp(strcmd.c_str(), "usewritablepath") == 0)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
// only iOS and Android need to open using write path by Code IDE
|
||||
FileServer::getShareInstance()->setIsUsingWritePath(true);
|
||||
|
||||
std::vector<std::string> searchPathArray = FileUtils::getInstance()->getSearchPaths();
|
||||
searchPathArray.insert(searchPathArray.begin(), FileServer::getShareInstance()->getWritePath());
|
||||
FileUtils::getInstance()->setSearchPaths(searchPathArray);
|
||||
#endif
|
||||
|
||||
dReplyParse.AddMember("code", 0, dReplyParse.GetAllocator());
|
||||
}
|
||||
|
||||
rapidjson::StringBuffer buffer;
|
||||
rapidjson::Writer< rapidjson::StringBuffer > writer(buffer);
|
||||
dReplyParse.Accept(writer);
|
||||
string msgContent = buffer.GetString();
|
||||
char msgLength[64] = {0x1, 0};
|
||||
sprintf(msgLength + 1, "%d:", msgContent.size());
|
||||
|
||||
string msg(msgLength + msgContent);
|
||||
|
||||
sendBuf(fd, msg.c_str(), msg.size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ConsoleCommand::~ConsoleCommand()
|
||||
{
|
||||
Director::getInstance()->getConsole()->stop();
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
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 _CONSOLE_COMMAND__H_
|
||||
#define _CONSOLE_COMMAND__H_
|
||||
|
||||
#include "FileServer.h"
|
||||
|
||||
class ConsoleCommand
|
||||
{
|
||||
static ConsoleCommand *s_sharedConsoleCommand;
|
||||
|
||||
public:
|
||||
static ConsoleCommand* getShareInstance();
|
||||
static void purge();
|
||||
|
||||
void init();
|
||||
void onSendCommand(int fd, const std::string &args);
|
||||
private:
|
||||
~ConsoleCommand();
|
||||
FileServer* _fileserver;
|
||||
};
|
||||
|
||||
#endif // _CONSOLE_COMMAND__H_
|
||||
|
|
@ -0,0 +1,545 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
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 "FileServer.h"
|
||||
#include "Runtime.h"
|
||||
#include "zlib.h"
|
||||
|
||||
// header files for directory operation
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
//1M size
|
||||
#define MAXPROTOLENGTH 1048576
|
||||
|
||||
#define PROTO_START "RuntimeSend:"
|
||||
|
||||
FileServer* FileServer::s_sharedFileServer = nullptr;
|
||||
FileServer* FileServer::getShareInstance()
|
||||
{
|
||||
if (s_sharedFileServer == nullptr)
|
||||
{
|
||||
s_sharedFileServer = new FileServer;
|
||||
}
|
||||
return s_sharedFileServer;
|
||||
}
|
||||
|
||||
void FileServer::purge()
|
||||
{
|
||||
CC_SAFE_DELETE(s_sharedFileServer);
|
||||
}
|
||||
|
||||
void FileServer::readResFileFinfo()
|
||||
{
|
||||
std::string filecfg = _writePath + "/fileinfo_debug.json";
|
||||
FILE * pFile = fopen (filecfg.c_str() , "r");
|
||||
if(pFile)
|
||||
{
|
||||
rapidjson::FileStream inputStream(pFile);
|
||||
_filecfgjson.ParseStream<0>(inputStream);
|
||||
fclose(pFile);
|
||||
}
|
||||
if(! _filecfgjson.IsObject()){
|
||||
_filecfgjson.SetObject();
|
||||
}
|
||||
|
||||
//save file info to disk every five second
|
||||
Director::getInstance()->getScheduler()->schedule([&](float){
|
||||
rapidjson::StringBuffer buffer;
|
||||
rapidjson::Writer< rapidjson::StringBuffer > writer(buffer);
|
||||
_filecfgjson.Accept(writer);
|
||||
const char* str = buffer.GetString();
|
||||
std::string filecfg = _writePath + "/fileinfo_debug.json";
|
||||
FILE * pFile = fopen(filecfg.c_str(), "w");
|
||||
if (!pFile) return ;
|
||||
fwrite(str, sizeof(char), strlen(str), pFile);
|
||||
fclose(pFile);
|
||||
},this, 5.0f, false, "fileinfo");
|
||||
}
|
||||
|
||||
void FileServer::addResFileInfo(const char* filename, uint64_t u64)
|
||||
{
|
||||
if(_filecfgjson.HasMember(filename)){
|
||||
_filecfgjson.RemoveMember(filename);
|
||||
}
|
||||
char filetime[512]= {0};
|
||||
sprintf(filetime, "%llu", u64);
|
||||
rapidjson::Value filetimeValue(rapidjson::kStringType);
|
||||
filetimeValue.SetString(filetime, _filecfgjson.GetAllocator());
|
||||
rapidjson::Value filenameValue(rapidjson::kStringType);
|
||||
filenameValue.SetString(filename,_filecfgjson.GetAllocator());
|
||||
_filecfgjson.AddMember(filenameValue.GetString(), filetimeValue, _filecfgjson.GetAllocator());
|
||||
}
|
||||
|
||||
void FileServer::removeResFileInfo(const char *filename)
|
||||
{
|
||||
if (_filecfgjson.HasMember(filename)) {
|
||||
_filecfgjson.RemoveMember(filename);
|
||||
}
|
||||
}
|
||||
|
||||
std::string FileServer::getTransingFileName()
|
||||
{
|
||||
_fileNameMutex.lock();
|
||||
std::string filename = _strFileName;
|
||||
_fileNameMutex.unlock();
|
||||
return filename;
|
||||
}
|
||||
|
||||
void FileServer::setTransingFileName(const std::string &filename)
|
||||
{
|
||||
_fileNameMutex.lock();
|
||||
_strFileName = filename;
|
||||
_fileNameMutex.unlock();
|
||||
}
|
||||
|
||||
bool FileServer::listenOnTCP(int port)
|
||||
{
|
||||
int listenfd, n;
|
||||
const int on = 1;
|
||||
struct addrinfo hints, *res, *ressave;
|
||||
char serv[30];
|
||||
|
||||
snprintf(serv, sizeof(serv)-1, "%d", port );
|
||||
serv[sizeof(serv)-1]=0;
|
||||
|
||||
bzero(&hints, sizeof(struct addrinfo));
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
hints.ai_family = AF_INET; // AF_UNSPEC: Do we need IPv6 ?
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
WSADATA wsaData;
|
||||
n = WSAStartup(MAKEWORD(2, 2),&wsaData);
|
||||
#endif
|
||||
|
||||
if ( (n = getaddrinfo(NULL, serv, &hints, &res)) != 0) {
|
||||
fprintf(stderr,"net_listen error for %s: %s", serv, gai_strerror(n));
|
||||
return false;
|
||||
}
|
||||
|
||||
ressave = res;
|
||||
do {
|
||||
listenfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
if (listenfd < 0)
|
||||
continue; /* error, try next one */
|
||||
|
||||
setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on));
|
||||
//setsockopt(listenfd, IPPROTO_TCP, TCP_NODELAY, (const char*)&on, sizeof(on));
|
||||
if (::bind(listenfd, res->ai_addr, res->ai_addrlen) == 0)
|
||||
break; /* success */
|
||||
|
||||
/* bind error, close and try next one */
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
closesocket(listenfd);
|
||||
#else
|
||||
close(listenfd);
|
||||
#endif
|
||||
} while ((res = res->ai_next) != NULL);
|
||||
|
||||
if (res == NULL)
|
||||
{
|
||||
perror("net_listen:");
|
||||
freeaddrinfo(ressave);
|
||||
return false;
|
||||
}
|
||||
|
||||
listen(listenfd, 1);
|
||||
|
||||
if (res->ai_family == AF_INET)
|
||||
{
|
||||
char buf[INET_ADDRSTRLEN] = "";
|
||||
struct sockaddr_in *sin = (struct sockaddr_in*) res->ai_addr;
|
||||
if( inet_ntop(res->ai_family, &sin->sin_addr, buf, sizeof(buf)) != NULL )
|
||||
cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin_port));
|
||||
else
|
||||
perror("inet_ntop");
|
||||
} else if (res->ai_family == AF_INET6)
|
||||
{
|
||||
char buf[INET6_ADDRSTRLEN] = "";
|
||||
struct sockaddr_in6 *sin = (struct sockaddr_in6*) res->ai_addr;
|
||||
if( inet_ntop(res->ai_family, &sin->sin6_addr, buf, sizeof(buf)) != NULL )
|
||||
cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin6_port));
|
||||
else
|
||||
perror("inet_ntop");
|
||||
}
|
||||
freeaddrinfo(ressave);
|
||||
_listenfd = listenfd;
|
||||
_receiveThread = std::thread(std::bind( &FileServer::loopReceiveFile, this));
|
||||
_writeThread = std::thread(std::bind(&FileServer::loopWriteFile, this));
|
||||
_responseThread = std::thread(std::bind(&FileServer::loopResponse, this));
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileServer::stop()
|
||||
{
|
||||
_receiveEndThread = true;
|
||||
_writeEndThread = true;
|
||||
_responseEndThread = true;
|
||||
|
||||
if(_receiveRunning)
|
||||
{
|
||||
_receiveThread.join();
|
||||
}
|
||||
|
||||
if (_writeRunning)
|
||||
{
|
||||
_writeThread.join();
|
||||
}
|
||||
|
||||
if (_responseRunning)
|
||||
{
|
||||
_responseThread.join();
|
||||
}
|
||||
}
|
||||
|
||||
FileServer::FileServer() :
|
||||
_listenfd(-1),
|
||||
_receiveRunning(false),
|
||||
_receiveEndThread(false),
|
||||
_writeRunning(false),
|
||||
_writeEndThread(false),
|
||||
_responseRunning(false),
|
||||
_responseEndThread(false)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
// need to be opened by Code IDE
|
||||
_isUsingWritePath = false;
|
||||
#else
|
||||
_isUsingWritePath = true;
|
||||
#endif
|
||||
|
||||
_writePath = FileUtils::getInstance()->getWritablePath();
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
std::string getCurAppName(void);
|
||||
_writePath += getCurAppName();
|
||||
_writePath += "/";
|
||||
#endif
|
||||
|
||||
_writePath += "debugruntime/";
|
||||
|
||||
_writePath = replaceAll(_writePath, "\\", "/");
|
||||
if (_writePath.at(_writePath.length() - 1) != '/'){
|
||||
_writePath.append("/");
|
||||
}
|
||||
}
|
||||
|
||||
FileServer::~FileServer()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
void FileServer::loopReceiveFile()
|
||||
{
|
||||
struct sockaddr client;
|
||||
socklen_t client_len;
|
||||
|
||||
/* new client */
|
||||
client_len = sizeof(client);
|
||||
int fd = accept(_listenfd, (struct sockaddr *)&client, &client_len );
|
||||
char *protoBuf = new char[MAXPROTOLENGTH];
|
||||
|
||||
while(!_receiveEndThread) {
|
||||
|
||||
// recv start flag
|
||||
char startflag[13] = {0};
|
||||
recvBuf(fd, startflag, sizeof(startflag) - 1);
|
||||
if (strcmp(startflag, PROTO_START) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// recv proto num
|
||||
union
|
||||
{
|
||||
char char_type[3];
|
||||
unsigned short uint16_type;
|
||||
}protonum;
|
||||
recvBuf(fd, protonum.char_type, sizeof(protonum.char_type) - 1);
|
||||
//recv protobuf length
|
||||
union
|
||||
{
|
||||
char char_type[3];
|
||||
unsigned short uint16_type;
|
||||
}protolength;
|
||||
recvBuf(fd, protolength.char_type, sizeof(protolength.char_type) - 1);
|
||||
|
||||
//recv variable length
|
||||
memset(protoBuf, 0, MAXPROTOLENGTH);
|
||||
recvBuf(fd, protoBuf, protolength.uint16_type);
|
||||
|
||||
RecvBufStruct recvDataBuf;
|
||||
recvDataBuf.fd = fd;
|
||||
recvDataBuf.fileProto.ParseFromString(protoBuf);
|
||||
if (1 == recvDataBuf.fileProto.package_seq())
|
||||
{
|
||||
_recvErrorFile = "";
|
||||
} else
|
||||
{
|
||||
// recv error
|
||||
if (_recvErrorFile == recvDataBuf.fileProto.file_name())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
unsigned long contentSize = recvDataBuf.fileProto.content_size();
|
||||
if (contentSize == 0)
|
||||
{
|
||||
recvDataBuf.contentBuf="";
|
||||
_recvBufListMutex.lock();
|
||||
_recvBufList.push_back(recvDataBuf);
|
||||
_recvBufListMutex.unlock();
|
||||
}else if(contentSize > 0)
|
||||
{
|
||||
//recv body data
|
||||
Bytef *contentbuf = new Bytef[contentSize+1];
|
||||
memset(contentbuf, 0, contentSize+1);
|
||||
unsigned long recvTotalLen = contentSize;
|
||||
while (recvTotalLen != 0){
|
||||
unsigned long recvLen = MAXPROTOLENGTH;
|
||||
if(recvTotalLen < MAXPROTOLENGTH)
|
||||
recvLen = recvTotalLen;
|
||||
memset(protoBuf, 0, MAXPROTOLENGTH);
|
||||
unsigned long result = recv(fd, protoBuf, recvLen,0);
|
||||
if (result <= 0)
|
||||
{
|
||||
usleep(1);
|
||||
continue;
|
||||
}
|
||||
memcpy(contentbuf + contentSize - recvTotalLen, protoBuf, result);
|
||||
recvTotalLen -= result;
|
||||
}
|
||||
|
||||
if (recvDataBuf.fileProto.compress_type() == runtime::FileSendProtos_CompressType::FileSendProtos_CompressType_ZIP){
|
||||
unsigned long uncompressSize = recvDataBuf.fileProto.uncompress_size();
|
||||
Bytef *buff = new Bytef[uncompressSize * sizeof(Bytef)];
|
||||
memset(buff, 0, uncompressSize * sizeof(Bytef));
|
||||
int err = ::uncompress(buff, &uncompressSize,contentbuf, contentSize * sizeof(Bytef));
|
||||
if (err != Z_OK){
|
||||
CC_SAFE_DELETE_ARRAY(buff);
|
||||
CC_SAFE_DELETE_ARRAY(contentbuf);
|
||||
addResponse(recvDataBuf.fd, recvDataBuf.fileProto.file_name(), runtime::FileSendComplete::RESULTTYPE::FileSendComplete_RESULTTYPE_UNCOMPRESS_ERROR, err);
|
||||
continue;
|
||||
}
|
||||
CC_SAFE_DELETE_ARRAY(contentbuf);
|
||||
contentbuf = buff;
|
||||
contentSize = uncompressSize;
|
||||
}
|
||||
recvDataBuf.contentBuf.assign((const char*)contentbuf, contentSize);
|
||||
CC_SAFE_DELETE_ARRAY(contentbuf);
|
||||
|
||||
_recvBufListMutex.lock();
|
||||
_recvBufList.push_back(recvDataBuf);
|
||||
_recvBufListMutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
_receiveRunning = false;
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(protoBuf);
|
||||
}
|
||||
|
||||
void FileServer::loopWriteFile()
|
||||
{
|
||||
_writeRunning = true;
|
||||
while(!_writeEndThread)
|
||||
{
|
||||
_recvBufListMutex.lock();
|
||||
size_t recvSize = _recvBufList.size();
|
||||
_recvBufListMutex.unlock();
|
||||
if(0 == recvSize)
|
||||
{
|
||||
usleep(500);
|
||||
continue;
|
||||
}
|
||||
|
||||
_recvBufListMutex.lock();
|
||||
RecvBufStruct recvDataBuf = _recvBufList.front();
|
||||
_recvBufList.pop_front();
|
||||
_recvBufListMutex.unlock();
|
||||
std::string filename = recvDataBuf.fileProto.file_name();
|
||||
std::string fullfilename = _writePath;
|
||||
fullfilename += filename;
|
||||
_fileNameMutex.lock();
|
||||
_strFileName = filename;
|
||||
_fileNameMutex.unlock();
|
||||
//cocos2d::log("WriteFile:: fullfilename = %s",filename.c_str());
|
||||
createDir(fullfilename.substr(0, fullfilename.find_last_of("/")).c_str());
|
||||
|
||||
FILE *fp= nullptr;
|
||||
if (1 == recvDataBuf.fileProto.package_seq())
|
||||
{
|
||||
_writeErrorFile ="";
|
||||
fp = fopen(fullfilename.c_str(), "wb");
|
||||
} else
|
||||
{
|
||||
if (_writeErrorFile == filename)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
fp=fopen(fullfilename.c_str(), "ab");
|
||||
}
|
||||
if (nullptr == fp)
|
||||
{
|
||||
addResponse(recvDataBuf.fd, filename, runtime::FileSendComplete::RESULTTYPE::FileSendComplete_RESULTTYPE_FOPEN_ERROR, errno);
|
||||
continue;
|
||||
}
|
||||
if (fp)
|
||||
{
|
||||
if (recvDataBuf.contentBuf.size() > 0 && 0 == fwrite(recvDataBuf.contentBuf.c_str(), sizeof(char), recvDataBuf.contentBuf.size(), fp))
|
||||
{
|
||||
addResponse(recvDataBuf.fd, filename, runtime::FileSendComplete::RESULTTYPE::FileSendComplete_RESULTTYPE_FWRITE_ERROR, errno);
|
||||
fclose(fp);
|
||||
continue;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
if (1 == recvDataBuf.fileProto.package_seq())
|
||||
{
|
||||
//record new file modify
|
||||
addResFileInfo(filename.c_str(), recvDataBuf.fileProto.modified_time());
|
||||
addResponse(recvDataBuf.fd, filename, runtime::FileSendComplete::RESULTTYPE::FileSendComplete_RESULTTYPE_SUCCESS, 0);
|
||||
}
|
||||
}
|
||||
|
||||
_writeRunning = false;
|
||||
}
|
||||
|
||||
void FileServer::addResponse(int fd, std::string filename, int errortype, int errornum)
|
||||
{
|
||||
switch (errortype)
|
||||
{
|
||||
case runtime::FileSendComplete::RESULTTYPE::FileSendComplete_RESULTTYPE_UNCOMPRESS_ERROR:
|
||||
case runtime::FileSendComplete::RESULTTYPE::FileSendComplete_RESULTTYPE_RECV_ERROR:
|
||||
_recvErrorFile = filename;
|
||||
break;
|
||||
case runtime::FileSendComplete::RESULTTYPE::FileSendComplete_RESULTTYPE_FOPEN_ERROR:
|
||||
case runtime::FileSendComplete::RESULTTYPE::FileSendComplete_RESULTTYPE_FWRITE_ERROR:
|
||||
_writeErrorFile = filename;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ResponseStruct responseBuf;
|
||||
responseBuf.fd = fd;
|
||||
responseBuf.fileResponseProto.set_file_name(filename.c_str());
|
||||
responseBuf.fileResponseProto.set_result((::runtime::FileSendComplete_RESULTTYPE)errortype);
|
||||
responseBuf.fileResponseProto.set_error_num(errornum);
|
||||
|
||||
// push Response struct
|
||||
_responseBufListMutex.lock();
|
||||
_responseBufList.push_back(responseBuf);
|
||||
_responseBufListMutex.unlock();
|
||||
}
|
||||
|
||||
void FileServer::loopResponse()
|
||||
{
|
||||
_responseRunning = true;
|
||||
while(!_responseEndThread) {
|
||||
_responseBufListMutex.lock();
|
||||
size_t responseSize = _responseBufList.size();
|
||||
_responseBufListMutex.unlock();
|
||||
if(0 == responseSize)
|
||||
{
|
||||
usleep(500);
|
||||
/* error */
|
||||
continue;
|
||||
}
|
||||
|
||||
_responseBufListMutex.lock();
|
||||
ResponseStruct responseBuf = _responseBufList.front();
|
||||
_responseBufList.pop_front();
|
||||
_responseBufListMutex.unlock();
|
||||
//send response
|
||||
std::string responseString;
|
||||
runtime::FileSendComplete fileSendProtoComplete;
|
||||
fileSendProtoComplete.set_file_name(responseBuf.fileResponseProto.file_name());
|
||||
fileSendProtoComplete.set_result(responseBuf.fileResponseProto.result());
|
||||
fileSendProtoComplete.set_error_num(responseBuf.fileResponseProto.error_num());
|
||||
fileSendProtoComplete.SerializeToString(&responseString);
|
||||
char dataBuf[1024] = {0};
|
||||
struct ResponseHeaderStruct
|
||||
{
|
||||
char startFlag[12];
|
||||
unsigned short protoNum;
|
||||
unsigned short protoBufLen;
|
||||
};
|
||||
ResponseHeaderStruct responseHeader;
|
||||
strcpy(responseHeader.startFlag, PROTO_START);
|
||||
responseHeader.protoNum = PROTONUM::FILESENDCOMPLETE;
|
||||
responseHeader.protoBufLen = (unsigned short) responseString.size();
|
||||
memcpy(dataBuf, &responseHeader, sizeof(responseHeader));
|
||||
memcpy(dataBuf + sizeof(responseHeader), responseString.c_str(), responseString.size());
|
||||
|
||||
sendBuf(responseBuf.fd, dataBuf, sizeof(responseHeader) + responseString.size());
|
||||
cocos2d::log("responseFile:%s,result:%d", fileSendProtoComplete.file_name().c_str(), fileSendProtoComplete.result());
|
||||
}
|
||||
|
||||
_responseRunning = false;
|
||||
}
|
||||
|
||||
bool createDir(const char *sPathName)
|
||||
{
|
||||
char DirName[256]={0};
|
||||
strcpy(DirName, sPathName);
|
||||
size_t i, len = strlen(DirName);
|
||||
if(DirName[len - 1] != '/')
|
||||
{
|
||||
strcat(DirName, "/");
|
||||
}
|
||||
|
||||
len = strlen(DirName);
|
||||
for(i = 1; i < len; i++)
|
||||
{
|
||||
if(DirName[i] == '/')
|
||||
{
|
||||
DirName[i] = 0;
|
||||
#ifdef _WIN32
|
||||
if(_access(DirName, NULL) != 0)
|
||||
{
|
||||
if(_mkdir(DirName/*, 0755*/) == -1)
|
||||
#else
|
||||
if (access(DirName, NULL) != 0)
|
||||
{
|
||||
if(mkdir(DirName, 0755) == -1)
|
||||
#endif
|
||||
{
|
||||
perror("mkdir error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
DirName[i] = '/';
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
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 _FILE_SERVER__H_
|
||||
#define _FILE_SERVER__H_
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "json/document.h"
|
||||
#include "json/filestream.h"
|
||||
#include "json/stringbuffer.h"
|
||||
#include "json/writer.h"
|
||||
#include "Protos.pb.h"
|
||||
#include <string>
|
||||
|
||||
// header files for socket
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <WS2tcpip.h>
|
||||
|
||||
#define bzero(a, b) memset(a, 0, b);
|
||||
|
||||
#else
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define usleep(t) Sleep(t)
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
class FileServer
|
||||
{
|
||||
static FileServer *s_sharedFileServer;
|
||||
public:
|
||||
static FileServer* getShareInstance();
|
||||
static void purge();
|
||||
|
||||
bool listenOnTCP(int port);
|
||||
void stop();
|
||||
|
||||
void readResFileFinfo();
|
||||
void addResFileInfo(const char* filename,uint64_t u64);
|
||||
void removeResFileInfo(const char *filename);
|
||||
rapidjson::Document* getFileCfgJson() { return &_filecfgjson; }
|
||||
bool getIsUsingWritePath() { return _isUsingWritePath; }
|
||||
void setIsUsingWritePath(bool use) { _isUsingWritePath = use; }
|
||||
std::string getWritePath() { return _writePath; }
|
||||
std::string getTransingFileName();
|
||||
void setTransingFileName(const std::string& filename);
|
||||
protected:
|
||||
FileServer();
|
||||
~FileServer();
|
||||
private:
|
||||
void loopReceiveFile();
|
||||
void loopWriteFile();
|
||||
void loopResponse();
|
||||
void addResponse(int fd, std::string filename,int errortype,int errornum);
|
||||
enum PROTONUM
|
||||
{
|
||||
FILEPROTO = 1,
|
||||
FILESENDCOMPLETE = 2,
|
||||
DIRPROTO = 3,
|
||||
DIRSENDCOMPLETE = 4
|
||||
};
|
||||
|
||||
struct RecvBufStruct
|
||||
{
|
||||
runtime::FileSendProtos fileProto;
|
||||
std::string contentBuf;
|
||||
int fd;
|
||||
};
|
||||
|
||||
struct ResponseStruct
|
||||
{
|
||||
runtime::FileSendComplete fileResponseProto;
|
||||
int fd;
|
||||
};
|
||||
|
||||
// file descriptor: socket, console, etc.
|
||||
int _listenfd;
|
||||
std::thread _responseThread;
|
||||
std::thread _receiveThread;
|
||||
std::thread _writeThread;
|
||||
bool _receiveRunning;
|
||||
bool _receiveEndThread;
|
||||
bool _writeRunning;
|
||||
bool _writeEndThread;
|
||||
bool _responseRunning;
|
||||
bool _responseEndThread;
|
||||
|
||||
std::list<RecvBufStruct> _recvBufList;
|
||||
std::list<ResponseStruct> _responseBufList;
|
||||
std::mutex _recvBufListMutex;
|
||||
std::mutex _responseBufListMutex;
|
||||
|
||||
rapidjson::Document _filecfgjson;
|
||||
|
||||
std::string _strFileName;
|
||||
std::mutex _fileNameMutex;
|
||||
|
||||
std::string _recvErrorFile;
|
||||
std::string _writeErrorFile;
|
||||
|
||||
bool _isUsingWritePath;
|
||||
std::string _writePath;
|
||||
};
|
||||
|
||||
bool createDir(const char *sPathName);
|
||||
|
||||
#endif // _FILE_SERVER__H_
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -25,8 +25,25 @@ THE SOFTWARE.
|
|||
#ifndef _RUNTIME__H_
|
||||
#define _RUNTIME__H_
|
||||
|
||||
#include <string>
|
||||
|
||||
void recvBuf(int fd, char *pbuf, unsigned long bufsize);
|
||||
|
||||
void sendBuf(int fd, const char *pbuf, unsigned long bufsize);
|
||||
|
||||
std::string& replaceAll(std::string& str, const std::string& old_value, const std::string& new_value);
|
||||
|
||||
std::string getIPAddress();
|
||||
|
||||
const char* getRuntimeVersion();
|
||||
|
||||
void startScript(std::string strDebugArg);
|
||||
|
||||
void initRuntime();
|
||||
|
||||
void startRuntime();
|
||||
|
||||
void endRuntime();
|
||||
|
||||
#endif // _RUNTIME__H_
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ LOCAL_MODULE := cocos2dlua_shared
|
|||
|
||||
LOCAL_MODULE_FILENAME := libcocos2dlua
|
||||
|
||||
LOCAL_SRC_FILES := hellolua/main.cpp \
|
||||
hellolua/Runtime_android.cpp \
|
||||
LOCAL_SRC_FILES := \
|
||||
../../Classes/protobuf-lite/google/protobuf/io/coded_stream.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/stubs/common.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/extension_set.cc \
|
||||
|
@ -20,18 +19,22 @@ hellolua/Runtime_android.cpp \
|
|||
../../Classes/protobuf-lite/google/protobuf/io/zero_copy_stream.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/io/zero_copy_stream_impl_lite.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/stubs/stringprintf.cc \
|
||||
../../Classes/runtime/ConnectWaitLayer.cpp \
|
||||
../../Classes/runtime/ConsoleCommand.cpp \
|
||||
../../Classes/runtime/FileServer.cpp \
|
||||
../../Classes/runtime/Landscape_png.cpp \
|
||||
../../Classes/runtime/lua_debugger.c \
|
||||
../../Classes/runtime/PlayDisable_png.cpp \
|
||||
../../Classes/runtime/PlayEnable_png.cpp \
|
||||
../../Classes/runtime/Portrait_png.cpp \
|
||||
../../Classes/runtime/Shine_png.cpp \
|
||||
../../Classes/runtime/Runtime.cpp \
|
||||
../../Classes/runtime/Protos.pb.cc \
|
||||
../../Classes/runtime/lua_debugger.c \
|
||||
../../Classes/runtime/Runtime.cpp \
|
||||
../../Classes/runtime/Shine_png.cpp \
|
||||
../../Classes/VisibleRect.cpp \
|
||||
../../Classes/AppDelegate.cpp \
|
||||
../../Classes/ConfigParser.cpp
|
||||
|
||||
../../Classes/ConfigParser.cpp \
|
||||
hellolua/Runtime_android.cpp \
|
||||
hellolua/main.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/../../Classes/protobuf-lite \
|
||||
|
|
|
@ -77,6 +77,12 @@
|
|||
50D7C97017EBBEEC005D0B91 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50D7C96F17EBBEEC005D0B91 /* IOKit.framework */; };
|
||||
521A8E7019F0C3D200D177D7 /* Default-667h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 521A8E6E19F0C3D200D177D7 /* Default-667h@2x.png */; };
|
||||
521A8E7119F0C3D200D177D7 /* Default-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 521A8E6F19F0C3D200D177D7 /* Default-736h@3x.png */; };
|
||||
AB6CB6F21A1F275E009C2562 /* ConnectWaitLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB6CB6EC1A1F275E009C2562 /* ConnectWaitLayer.cpp */; };
|
||||
AB6CB6F31A1F275E009C2562 /* ConnectWaitLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB6CB6EC1A1F275E009C2562 /* ConnectWaitLayer.cpp */; };
|
||||
AB6CB6F41A1F275E009C2562 /* ConsoleCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB6CB6EE1A1F275E009C2562 /* ConsoleCommand.cpp */; };
|
||||
AB6CB6F51A1F275E009C2562 /* ConsoleCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB6CB6EE1A1F275E009C2562 /* ConsoleCommand.cpp */; };
|
||||
AB6CB6F61A1F275E009C2562 /* FileServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB6CB6F01A1F275E009C2562 /* FileServer.cpp */; };
|
||||
AB6CB6F71A1F275E009C2562 /* FileServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB6CB6F01A1F275E009C2562 /* FileServer.cpp */; };
|
||||
C00FD4921938512100C6382D /* Landscape_png.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C00FD48A1938512100C6382D /* Landscape_png.cpp */; };
|
||||
C00FD4931938512100C6382D /* Landscape_png.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C00FD48A1938512100C6382D /* Landscape_png.cpp */; };
|
||||
C00FD4941938512100C6382D /* PlayDisable_png.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C00FD48B1938512100C6382D /* PlayDisable_png.cpp */; };
|
||||
|
@ -256,6 +262,12 @@
|
|||
50D7C96F17EBBEEC005D0B91 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
||||
521A8E6E19F0C3D200D177D7 /* Default-667h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h@2x.png"; sourceTree = "<group>"; };
|
||||
521A8E6F19F0C3D200D177D7 /* Default-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h@3x.png"; sourceTree = "<group>"; };
|
||||
AB6CB6EC1A1F275E009C2562 /* ConnectWaitLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectWaitLayer.cpp; sourceTree = "<group>"; };
|
||||
AB6CB6ED1A1F275E009C2562 /* ConnectWaitLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConnectWaitLayer.h; sourceTree = "<group>"; };
|
||||
AB6CB6EE1A1F275E009C2562 /* ConsoleCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsoleCommand.cpp; sourceTree = "<group>"; };
|
||||
AB6CB6EF1A1F275E009C2562 /* ConsoleCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleCommand.h; sourceTree = "<group>"; };
|
||||
AB6CB6F01A1F275E009C2562 /* FileServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileServer.cpp; sourceTree = "<group>"; };
|
||||
AB6CB6F11A1F275E009C2562 /* FileServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileServer.h; sourceTree = "<group>"; };
|
||||
C00FD48A1938512100C6382D /* Landscape_png.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Landscape_png.cpp; sourceTree = "<group>"; };
|
||||
C00FD48B1938512100C6382D /* PlayDisable_png.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayDisable_png.cpp; sourceTree = "<group>"; };
|
||||
C00FD48C1938512100C6382D /* PlayEnable_png.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayEnable_png.cpp; sourceTree = "<group>"; };
|
||||
|
@ -478,6 +490,12 @@
|
|||
C00FD4891938512100C6382D /* runtime */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AB6CB6EC1A1F275E009C2562 /* ConnectWaitLayer.cpp */,
|
||||
AB6CB6ED1A1F275E009C2562 /* ConnectWaitLayer.h */,
|
||||
AB6CB6EE1A1F275E009C2562 /* ConsoleCommand.cpp */,
|
||||
AB6CB6EF1A1F275E009C2562 /* ConsoleCommand.h */,
|
||||
AB6CB6F01A1F275E009C2562 /* FileServer.cpp */,
|
||||
AB6CB6F11A1F275E009C2562 /* FileServer.h */,
|
||||
15AA9646199B6D4600725633 /* lua_debugger.c */,
|
||||
15AA9647199B6D4600725633 /* lua_debugger.h */,
|
||||
3EB5152E1952865D006966AA /* protobuf-lite */,
|
||||
|
@ -759,10 +777,12 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AB6CB6F31A1F275E009C2562 /* ConnectWaitLayer.cpp in Sources */,
|
||||
C07828FA18B4D72E00BD2287 /* SimulatorApp.mm in Sources */,
|
||||
5023813317EBBCE400990C9B /* AppDelegate.cpp in Sources */,
|
||||
C00FD4971938512100C6382D /* PlayEnable_png.cpp in Sources */,
|
||||
C00FD4951938512100C6382D /* PlayDisable_png.cpp in Sources */,
|
||||
AB6CB6F51A1F275E009C2562 /* ConsoleCommand.cpp in Sources */,
|
||||
C033B51D191B337200D06937 /* VisibleRect.cpp in Sources */,
|
||||
C00FD49D1938512100C6382D /* Shine_png.cpp in Sources */,
|
||||
3EB515691952865D006966AA /* common.cc in Sources */,
|
||||
|
@ -782,6 +802,7 @@
|
|||
3EB5155B1952865D006966AA /* generated_message_util.cc in Sources */,
|
||||
C0619CD81896894800872C26 /* Runtime_ios-mac.mm in Sources */,
|
||||
3EB5152D19528284006966AA /* Protos.pb.cc in Sources */,
|
||||
AB6CB6F71A1F275E009C2562 /* FileServer.cpp in Sources */,
|
||||
C00FD4931938512100C6382D /* Landscape_png.cpp in Sources */,
|
||||
3EB5155F1952865D006966AA /* zero_copy_stream.cc in Sources */,
|
||||
3EB515671952865D006966AA /* atomicops_internals_x86_msvc.cc in Sources */,
|
||||
|
@ -809,16 +830,19 @@
|
|||
C00FD4941938512100C6382D /* PlayDisable_png.cpp in Sources */,
|
||||
C00FD49C1938512100C6382D /* Shine_png.cpp in Sources */,
|
||||
3EB5156E1952865D006966AA /* wire_format_lite.cc in Sources */,
|
||||
AB6CB6F21A1F275E009C2562 /* ConnectWaitLayer.cpp in Sources */,
|
||||
3EB515581952865D006966AA /* extension_set.cc in Sources */,
|
||||
5023812417EBBCAC00990C9B /* main.m in Sources */,
|
||||
3EB5156C1952865D006966AA /* stringprintf.cc in Sources */,
|
||||
3EB515681952865D006966AA /* common.cc in Sources */,
|
||||
C033B51C191B337200D06937 /* VisibleRect.cpp in Sources */,
|
||||
3EB5155A1952865D006966AA /* generated_message_util.cc in Sources */,
|
||||
AB6CB6F61A1F275E009C2562 /* FileServer.cpp in Sources */,
|
||||
3EB5155E1952865D006966AA /* zero_copy_stream.cc in Sources */,
|
||||
3EB5155C1952865D006966AA /* coded_stream.cc in Sources */,
|
||||
C0619CD71896894800872C26 /* Runtime_ios-mac.mm in Sources */,
|
||||
5023811817EBBCAC00990C9B /* AppController.mm in Sources */,
|
||||
AB6CB6F41A1F275E009C2562 /* ConsoleCommand.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -81,14 +81,9 @@ std::string getCurAppName(void)
|
|||
{
|
||||
NSArray *args = [[NSProcessInfo processInfo] arguments];
|
||||
|
||||
if (args!=nullptr && [args count]>=2) {
|
||||
extern std::string g_resourcePath;
|
||||
g_resourcePath = [[args objectAtIndex:1]UTF8String];
|
||||
if (g_resourcePath.at(0) != '/') {
|
||||
g_resourcePath="";
|
||||
}
|
||||
if (args != nullptr && [args count] >= 2) {
|
||||
}
|
||||
g_nsAppDelegate =self;
|
||||
g_nsAppDelegate = self;
|
||||
AppDelegate app;
|
||||
Application::getInstance()->run();
|
||||
// After run, application needs to be terminated immediately.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
|
@ -203,6 +203,9 @@ copy "$(ProjectDir)..\..\..\config.json" "$(LocalDebuggerWorkingDirectory)\confi
|
|||
<ClInclude Include="..\Classes\protobuf-lite\google\protobuf\stubs\type_traits.h" />
|
||||
<ClInclude Include="..\Classes\protobuf-lite\google\protobuf\wire_format_lite.h" />
|
||||
<ClInclude Include="..\Classes\protobuf-lite\google\protobuf\wire_format_lite_inl.h" />
|
||||
<ClInclude Include="..\Classes\runtime\ConnectWaitLayer.h" />
|
||||
<ClInclude Include="..\Classes\runtime\ConsoleCommand.h" />
|
||||
<ClInclude Include="..\Classes\runtime\FileServer.h" />
|
||||
<ClInclude Include="..\Classes\runtime\lua_debugger.h" />
|
||||
<ClInclude Include="..\Classes\runtime\Protos.pb.h" />
|
||||
<ClInclude Include="..\Classes\runtime\ResData.h" />
|
||||
|
@ -227,6 +230,9 @@ copy "$(ProjectDir)..\..\..\config.json" "$(LocalDebuggerWorkingDirectory)\confi
|
|||
<ClCompile Include="..\Classes\protobuf-lite\google\protobuf\stubs\once.cc" />
|
||||
<ClCompile Include="..\Classes\protobuf-lite\google\protobuf\stubs\stringprintf.cc" />
|
||||
<ClCompile Include="..\Classes\protobuf-lite\google\protobuf\wire_format_lite.cc" />
|
||||
<ClCompile Include="..\Classes\runtime\ConnectWaitLayer.cpp" />
|
||||
<ClCompile Include="..\Classes\runtime\ConsoleCommand.cpp" />
|
||||
<ClCompile Include="..\Classes\runtime\FileServer.cpp" />
|
||||
<ClCompile Include="..\Classes\runtime\Landscape_png.cpp" />
|
||||
<ClCompile Include="..\Classes\runtime\lua_debugger.c" />
|
||||
<ClCompile Include="..\Classes\runtime\PlayDisable_png.cpp" />
|
||||
|
@ -254,4 +260,4 @@ copy "$(ProjectDir)..\..\..\config.json" "$(LocalDebuggerWorkingDirectory)\confi
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -109,6 +109,15 @@
|
|||
<ClInclude Include="..\Classes\runtime\lua_debugger.h">
|
||||
<Filter>Classes\runtime</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\runtime\ConnectWaitLayer.h">
|
||||
<Filter>Classes\runtime</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\runtime\ConsoleCommand.h">
|
||||
<Filter>Classes\runtime</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\runtime\FileServer.h">
|
||||
<Filter>Classes\runtime</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Classes\AppDelegate.cpp">
|
||||
|
@ -189,6 +198,15 @@
|
|||
<ClCompile Include="..\Classes\runtime\lua_debugger.c">
|
||||
<Filter>Classes\runtime</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\runtime\ConnectWaitLayer.cpp">
|
||||
<Filter>Classes\runtime</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\runtime\ConsoleCommand.cpp">
|
||||
<Filter>Classes\runtime</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\runtime\FileServer.cpp">
|
||||
<Filter>Classes\runtime</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="game.rc">
|
||||
|
|
|
@ -24,8 +24,6 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
|||
int iLen = 2*wcslen(szArgList[1]);
|
||||
char* chRtn = new char[iLen+1];
|
||||
wcstombs(chRtn,szArgList[1],iLen+1);
|
||||
extern std::string g_resourcePath;
|
||||
g_resourcePath = chRtn;
|
||||
delete [] chRtn;
|
||||
}
|
||||
LocalFree(szArgList);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 62aa5ed9cb84f5d2784ae3332a29fc5a900cfb3f
|
||||
Subproject commit 3b956b46cc683f81d69811b3016810c1a93ad5f1
|
|
@ -77,9 +77,16 @@ def main():
|
|||
|
||||
if platform == 'win32':
|
||||
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s' % cur_platform))
|
||||
if not os.path.exists(x86_llvm_path):
|
||||
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s' % cur_platform))
|
||||
else:
|
||||
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s-%s' % (cur_platform, 'x86')))
|
||||
if not os.path.exists(x86_llvm_path):
|
||||
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s-%s' % (cur_platform, 'x86')))
|
||||
|
||||
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
|
||||
if not os.path.exists(x64_llvm_path):
|
||||
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
|
||||
|
||||
if os.path.isdir(x86_llvm_path):
|
||||
llvm_path = x86_llvm_path
|
||||
|
|
Loading…
Reference in New Issue