mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' into newRenderer
This commit is contained in:
commit
19b8ba89e2
|
@ -1 +1 @@
|
|||
cd0cfdd8bcc2b31f9e5be7e127a530098b2f9705
|
||||
3590d3bd90fa4e11c382ff2a848b66ea507dede0
|
|
@ -472,7 +472,7 @@ CallFuncN * CallFuncN::clone() const
|
|||
if( _selectorTarget) {
|
||||
a->initWithTarget(_selectorTarget, _callFuncN);
|
||||
}
|
||||
else if( _function ){
|
||||
else if( _functionN ){
|
||||
a->initWithFunction(_functionN);
|
||||
}
|
||||
|
||||
|
|
|
@ -263,8 +263,8 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target);
|
||||
|
||||
/** initializes the action with the std::function<void()>
|
||||
* @js NK
|
||||
* @lua NK
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
bool initWithFunction(const std::function<void()>& func);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit fd61548d4697e68b5f893bdb919ab0667af26096
|
||||
Subproject commit 4920a65f2fd68f694584f220fe8065931561224a
|
|
@ -397,11 +397,15 @@ JSBool ScriptingCore::evalString(const char *string, jsval *outVal, const char *
|
|||
cx = _cx;
|
||||
if (global == NULL)
|
||||
global = _global;
|
||||
|
||||
JSAutoCompartment ac(cx, global);
|
||||
|
||||
JSScript* script = JS_CompileScript(cx, global, string, strlen(string), filename, 1);
|
||||
if (script) {
|
||||
JSAutoCompartment ac(cx, global);
|
||||
if (script)
|
||||
{
|
||||
JSBool evaluatedOK = JS_ExecuteScript(cx, global, script, outVal);
|
||||
if (JS_FALSE == evaluatedOK) {
|
||||
if (JS_FALSE == evaluatedOK)
|
||||
{
|
||||
fprintf(stderr, "(evaluatedOK == JS_FALSE)\n");
|
||||
}
|
||||
return evaluatedOK;
|
||||
|
|
|
@ -114,7 +114,7 @@ void MinXmlHttpRequest::_setRequestHeader(const char* field, const char* value)
|
|||
stringstream value_s;
|
||||
string header;
|
||||
|
||||
map<string, string>::iterator iter = _requestHeader.find(field);
|
||||
auto iter = _requestHeader.find(field);
|
||||
|
||||
// Concatenate values when header exists.
|
||||
if (iter != _requestHeader.end())
|
||||
|
|
|
@ -48,31 +48,35 @@ void ScheduleHandlerDelegate::update(float elapse)
|
|||
}
|
||||
|
||||
|
||||
LuaCallFunc * LuaCallFunc::create(int nHandler)
|
||||
LuaCallFunc * LuaCallFunc::create(const std::function<void(void* ,Node*)>& func)
|
||||
{
|
||||
LuaCallFunc *ret = new LuaCallFunc();
|
||||
if (NULL != ret )
|
||||
{
|
||||
auto ret = new LuaCallFunc();
|
||||
|
||||
if (ret && ret->initWithFunction(func) ) {
|
||||
ret->autorelease();
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)ret, nHandler, ScriptHandlerMgr::HandlerType::CALLFUNC);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void LuaCallFunc::execute()
|
||||
{
|
||||
if (_functionLua)
|
||||
{
|
||||
_functionLua((void*)this,_target);
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_DELETE(ret);
|
||||
return NULL;
|
||||
CallFuncN::execute();
|
||||
}
|
||||
}
|
||||
void LuaCallFunc::execute()
|
||||
|
||||
bool LuaCallFunc::initWithFunction(const std::function<void (void*, Node*)> &func)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr::HandlerType::CALLFUNC);
|
||||
|
||||
if (0 == handler)
|
||||
return ;
|
||||
|
||||
BasicScriptData data((void*)this,(void*)_target);
|
||||
ScriptEvent event(kCallFuncEvent,(void*)&data);
|
||||
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||
_functionLua = func;
|
||||
return true;
|
||||
}
|
||||
|
||||
LuaCallFunc* LuaCallFunc::clone() const
|
||||
|
@ -83,13 +87,18 @@ LuaCallFunc* LuaCallFunc::clone() const
|
|||
return NULL;
|
||||
|
||||
auto ret = new LuaCallFunc();
|
||||
|
||||
if( _functionLua )
|
||||
{
|
||||
ret->initWithFunction(_functionLua);
|
||||
}
|
||||
|
||||
ret->autorelease();
|
||||
|
||||
int newscriptHandler = cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->reallocateScriptHandler(handler);
|
||||
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)ret, newscriptHandler, ScriptHandlerMgr::HandlerType::CALLFUNC);
|
||||
|
||||
ret->autorelease();
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,14 +44,20 @@ private:
|
|||
class LuaCallFunc:public cocos2d::CallFuncN
|
||||
{
|
||||
public:
|
||||
LuaCallFunc()
|
||||
LuaCallFunc():_functionLua(nullptr)
|
||||
{}
|
||||
virtual ~LuaCallFunc()
|
||||
{}
|
||||
|
||||
static LuaCallFunc * create(int nHandler);
|
||||
virtual void execute();
|
||||
static LuaCallFunc* create(const std::function<void(void* self,Node*)>& func);
|
||||
bool initWithFunction(const std::function<void(void* self,Node*)>& func);
|
||||
virtual LuaCallFunc* clone() const;
|
||||
virtual void execute() override;
|
||||
protected:
|
||||
/**
|
||||
*/
|
||||
std::function<void(void* self,Node*)> _functionLua;
|
||||
|
||||
};
|
||||
|
||||
class ScriptHandlerMgr
|
||||
|
|
|
@ -1 +1 @@
|
|||
6f20ef3b233b2dffcfa11fe289879cfc5ee35d51
|
||||
86fa141032de3d513df690fc82b20d2f2b4ab01b
|
|
@ -835,6 +835,15 @@ local function ActionCallFuncND()
|
|||
|
||||
centerSprites(1)
|
||||
|
||||
local function doRemoveFromParentAndCleanup(sender,table)
|
||||
grossini:removeFromParentAndCleanup(table[1])
|
||||
end
|
||||
|
||||
local action = cc.Sequence:create(
|
||||
cc.MoveBy:create(2, cc.p(200,0)),
|
||||
cc.CallFunc:create(doRemoveFromParentAndCleanup,{true}))
|
||||
|
||||
grossini:runAction(action)
|
||||
|
||||
Helper.titleLabel:setString("CallFuncND + auto remove")
|
||||
Helper.subtitleLabel:setString("CallFuncND + removeFromParent. Grossini dissapears in 2s")
|
||||
|
|
|
@ -27,7 +27,7 @@ headers = %(cocosdir)s/cocos/editor-support/cocostudio/CocoStudio.h
|
|||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
||||
classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager InputDelegate ComController ComAudio ComAttribute ComRender ActionManagerEx SceneReader GUIReader BatchNode
|
||||
classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager InputDelegate ComController ComAudio ComAttribute ComRender ActionManagerEx SceneReader GUIReader BatchNode ActionObject BaseData Tween ColliderFilter DisplayManager
|
||||
|
||||
# what should we skip? in the format ClassName::[function function]
|
||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||
|
@ -36,15 +36,21 @@ classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager InputDelegate
|
|||
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
|
||||
# functions from all classes.
|
||||
|
||||
skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*HSV onTouch.* onAcc.* onKey.* onRegisterTouchListener (s|g)etBlendFunc ccTouch.*],
|
||||
skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*HSV onTouch.* onAcc.* onKey.* onRegisterTouchListener (s|g)etBlendFunc (s|g)etUserObject ccTouch.*],
|
||||
InputDelegate::[didAccelerate on.*],
|
||||
GUIReader::[storeFileDesignSize getFileDesignSize],
|
||||
ComAttribute::[getDict],
|
||||
BatchNode::[init draw],
|
||||
Armature::[createBone updateBlendType getBody setBody getShapeList .*BlendFunc],
|
||||
Skin::[getSkinData setSkinData],
|
||||
ArmatureAnimation::[updateHandler updateFrameData frameEvent],
|
||||
ActionManagerEx::[initWithDictionary]
|
||||
ArmatureAnimation::[updateHandler updateFrameData frameEvent (s|g)etAnimationData],
|
||||
ArmatureDataManager::[getTextureDatas],
|
||||
ActionManagerEx::[initWithDictionary],
|
||||
Bone::[getTweenData getBoneData],
|
||||
BaseData::[copy subtract],
|
||||
ColliderFilter::[updateShape],
|
||||
Tween::[(s|g)etMovementBoneData],
|
||||
DisplayManager::[initDisplayList (s|g)etCurrentDecorativeDisplay getDecorativeDisplayByIndex]
|
||||
|
||||
rename_functions = ActionManagerEx::[shareManager=getInstance purgeActionManager=purge],
|
||||
SceneReader::[purgeSceneReader=purge],
|
||||
|
@ -63,7 +69,7 @@ base_classes_to_skip = Object ProcessBase
|
|||
|
||||
# classes that create no constructor
|
||||
# Set is special and we will use a hand-written constructor
|
||||
abstract_classes = ArmatureDataManager ComAttribute InputDelegate ComRender ComAudio InputDelegate ActionManagerEx SceneReader GUIReader BatchNode
|
||||
abstract_classes = ArmatureDataManager ComAttribute InputDelegate ComRender ComAudio InputDelegate ActionManagerEx SceneReader GUIReader BatchNode ColliderFilter
|
||||
|
||||
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
|
||||
script_control_cpp = no
|
||||
|
|
Loading…
Reference in New Issue