mirror of https://github.com/axmolengine/axmol.git
issue #2868:Add ccd lua test samples
This commit is contained in:
parent
e26fe04deb
commit
06c7d3e96d
|
@ -1 +1 @@
|
|||
3ff18018375c71f683a484652678740cc6395eaf
|
||||
bb6b434fc4b6f0865e841fd87dddff603200c029
|
|
@ -161,7 +161,11 @@ void Scene::update(float delta)
|
|||
{
|
||||
Node::update(delta);
|
||||
|
||||
_physicsWorld->update(delta);
|
||||
if (nullptr != _physicsWorld)
|
||||
{
|
||||
_physicsWorld->update(delta);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
namespace cocostudio {
|
||||
|
||||
#define kCCSVersion 1.0
|
||||
class CCSGUIReader : cocos2d::Object
|
||||
class CCSGUIReader : public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
CCSGUIReader();
|
||||
~CCSGUIReader();
|
||||
virtual ~CCSGUIReader();
|
||||
static CCSGUIReader* shareReader();
|
||||
static void purgeCCSGUIReader();
|
||||
|
||||
|
|
|
@ -24,16 +24,12 @@ public:
|
|||
LuaCocoStudioEventListener();
|
||||
virtual ~LuaCocoStudioEventListener();
|
||||
|
||||
virtual void setObjTarget(Object* objTarget);
|
||||
|
||||
static LuaCocoStudioEventListener* create();
|
||||
|
||||
virtual void eventCallbackFunc(Object* sender,int eventType);
|
||||
private:
|
||||
Object* _objTarget;
|
||||
};
|
||||
|
||||
LuaCocoStudioEventListener::LuaCocoStudioEventListener():_objTarget(nullptr)
|
||||
LuaCocoStudioEventListener::LuaCocoStudioEventListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -54,18 +50,13 @@ LuaCocoStudioEventListener* LuaCocoStudioEventListener::create()
|
|||
return listener;
|
||||
}
|
||||
|
||||
void LuaCocoStudioEventListener::setObjTarget(Object* objTarget)
|
||||
{
|
||||
_objTarget = objTarget;
|
||||
}
|
||||
|
||||
void LuaCocoStudioEventListener::eventCallbackFunc(Object* sender,int eventType)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
if (0 != handler)
|
||||
{
|
||||
LuaCocoStudioEventListenerData eventData(_objTarget,eventType);
|
||||
LuaCocoStudioEventListenerData eventData(sender,eventType);
|
||||
BasicScriptData data(this,(void*)&eventData);
|
||||
ScriptEvent scriptEvent(kCocoStudioEventListener,(void*)&data);
|
||||
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
|
@ -93,35 +84,35 @@ static int lua_cocos2dx_UIWidget_addTouchEventListener(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (2 == argc)
|
||||
|
||||
argc = lua_gettop(L) - 1;
|
||||
|
||||
if (1 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) ||
|
||||
!tolua_isusertype(L, 3, "Object", 0, &tolua_err) )
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
|
||||
{
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
LuaCocoStudioEventListener* listern = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listern)
|
||||
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listener)
|
||||
{
|
||||
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||
Object* obj = static_cast<Object*>(tolua_tousertype(L, 3, nullptr));
|
||||
|
||||
listern->setObjTarget(obj);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listern, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
self->addTouchEventListener(listern, toucheventselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
self->setUserObject(listener);
|
||||
self->addTouchEventListener(listener, toucheventselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addTouchEventListener' function of UIWidget has wrong number of arguments: %d, was expecting %d\n", argc, 2);
|
||||
CCLOG("'addTouchEventListener' function of UIWidget has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
|
@ -163,34 +154,32 @@ static int lua_cocos2dx_UICheckBox_addEventListener(lua_State* L)
|
|||
}
|
||||
#endif
|
||||
argc = lua_gettop(L) - 1;
|
||||
if (2 == argc)
|
||||
if (1 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) ||
|
||||
!tolua_isusertype(L, 3, "Object", 0, &tolua_err) )
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
|
||||
{
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
LuaCocoStudioEventListener* listern = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listern)
|
||||
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listener)
|
||||
{
|
||||
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||
Object* obj = static_cast<Object*>(tolua_tousertype(L, 3, nullptr));
|
||||
|
||||
listern->setObjTarget(obj);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listern, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
self->addEventListener(listern, checkboxselectedeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
self->setUserObject(listener);
|
||||
self->addEventListener(listener, checkboxselectedeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addEventListener' function of UICheckBox has wrong number of arguments: %d, was expecting %d\n", argc, 2);
|
||||
CCLOG("'addEventListener' function of UICheckBox has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
|
@ -233,34 +222,32 @@ static int lua_cocos2dx_UISlider_addEventListener(lua_State* L)
|
|||
}
|
||||
#endif
|
||||
argc = lua_gettop(L) - 1;
|
||||
if (2 == argc)
|
||||
if (1 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) ||
|
||||
!tolua_isusertype(L, 3, "Object", 0, &tolua_err) )
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
|
||||
{
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
LuaCocoStudioEventListener* listern = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listern)
|
||||
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listener)
|
||||
{
|
||||
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||
Object* obj = static_cast<Object*>(tolua_tousertype(L, 3, nullptr));
|
||||
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
listern->setObjTarget(obj);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listern, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
self->addEventListener(listern, sliderpercentchangedselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
self->setUserObject(listener);
|
||||
self->addEventListener(listener, sliderpercentchangedselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addEventListener' function of UISlider has wrong number of arguments: %d, was expecting %d\n", argc, 2);
|
||||
CCLOG("'addEventListener' function of UISlider has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -303,34 +290,32 @@ static int lua_cocos2dx_UITextField_addEventListener(lua_State* L)
|
|||
}
|
||||
#endif
|
||||
argc = lua_gettop(L) - 1;
|
||||
if (2 == argc)
|
||||
if (1 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) ||
|
||||
!tolua_isusertype(L, 3, "Object", 0, &tolua_err) )
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
|
||||
{
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
LuaCocoStudioEventListener* listern = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listern)
|
||||
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listener)
|
||||
{
|
||||
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||
Object* obj = static_cast<Object*>(tolua_tousertype(L, 3, nullptr));
|
||||
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
listern->setObjTarget(obj);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listern, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
self->addEventListener(listern, textfieldeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
self->setUserObject(listener);
|
||||
self->addEventListener(listener, textfieldeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addEventListener' function of UITextField has wrong number of arguments: %d, was expecting %d\n", argc, 2);
|
||||
CCLOG("'addEventListener' function of UITextField has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -373,34 +358,32 @@ static int lua_cocos2dx_UIPageView_addEventListener(lua_State* L)
|
|||
}
|
||||
#endif
|
||||
argc = lua_gettop(L) - 1;
|
||||
if (2 == argc)
|
||||
if (1 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) ||
|
||||
!tolua_isusertype(L, 3, "Object", 0, &tolua_err) )
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
|
||||
{
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
LuaCocoStudioEventListener* listern = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listern)
|
||||
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
|
||||
if (nullptr == listener)
|
||||
{
|
||||
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||
Object* obj = static_cast<Object*>(tolua_tousertype(L, 3, nullptr));
|
||||
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
listern->setObjTarget(obj);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listern, handler, ScriptHandlerMgr::HandlerType::EVENT_LISTENER);
|
||||
|
||||
self->addEventListener(listern, pagevieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
self->setUserObject(listener);
|
||||
self->addEventListener(listener, pagevieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addEventListener' function of UIPageView has wrong number of arguments: %d, was expecting %d\n", argc, 2);
|
||||
CCLOG("'addEventListener' function of UIPageView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -635,15 +618,12 @@ public:
|
|||
LuaArmatureWrapper();
|
||||
virtual ~LuaArmatureWrapper();
|
||||
|
||||
virtual void setObjTarget(Object* objTarget);
|
||||
virtual void movementEventCallback(Armature* armature, MovementEventType type,const char* movementID);
|
||||
virtual void frameEventCallback(Bone* bone, const char* frameEventName, int orginFrameIndex, int currentFrameIndex);
|
||||
virtual void addArmatureFileInfoAsyncCallback(float percent);
|
||||
private:
|
||||
Object* _objTarget;
|
||||
};
|
||||
|
||||
LuaArmatureWrapper::LuaArmatureWrapper():_objTarget(nullptr)
|
||||
LuaArmatureWrapper::LuaArmatureWrapper()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -653,11 +633,6 @@ LuaArmatureWrapper::~LuaArmatureWrapper()
|
|||
|
||||
}
|
||||
|
||||
void LuaArmatureWrapper::setObjTarget(Object* objTarget)
|
||||
{
|
||||
_objTarget = objTarget;
|
||||
}
|
||||
|
||||
void LuaArmatureWrapper::movementEventCallback(Armature* armature, MovementEventType type,const char* movementID)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr::HandlerType::ARMATURE_EVENT);
|
||||
|
@ -736,23 +711,20 @@ static int lua_cocos2dx_ArmatureAnimation_setMovementEventCallFunc(lua_State* L)
|
|||
#endif
|
||||
argc = lua_gettop(L) - 1;
|
||||
|
||||
if (2 == argc)
|
||||
if (1 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) ||
|
||||
!tolua_isusertype(L, 3, "Object", 0, &tolua_err) )
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
|
||||
{
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||
Object* obj = static_cast<Object*>(tolua_tousertype(L, 3, nullptr));
|
||||
|
||||
LuaArmatureWrapper* wrapper = new LuaArmatureWrapper();
|
||||
wrapper->autorelease();
|
||||
|
||||
wrapper->setObjTarget(obj);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)wrapper, handler, ScriptHandlerMgr::HandlerType::ARMATURE_EVENT);
|
||||
|
||||
self->setMovementEventCallFunc(wrapper, movementEvent_selector(LuaArmatureWrapper::movementEventCallback));
|
||||
|
@ -760,7 +732,7 @@ static int lua_cocos2dx_ArmatureAnimation_setMovementEventCallFunc(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'setMovementEventCallFunc' function of ArmatureAnimation has wrong number of arguments: %d, was expecting %d\n", argc, 0);
|
||||
CCLOG("'setMovementEventCallFunc' function of ArmatureAnimation has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -794,29 +766,30 @@ static int lua_cocos2dx_ArmatureAnimation_setFrameEventCallFunc(lua_State* L)
|
|||
#endif
|
||||
argc = lua_gettop(L) - 1;
|
||||
|
||||
if (2 == argc)
|
||||
if (1 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) ||
|
||||
!tolua_isusertype(L, 3, "Object", 0, &tolua_err) )
|
||||
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
|
||||
{
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||
Object* obj = static_cast<Object*>(tolua_tousertype(L, 3, nullptr));
|
||||
|
||||
LuaArmatureWrapper* wrapper = new LuaArmatureWrapper();
|
||||
wrapper->autorelease();
|
||||
|
||||
wrapper->setObjTarget(obj);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)wrapper, handler, ScriptHandlerMgr::HandlerType::ARMATURE_EVENT);
|
||||
|
||||
self->setFrameEventCallFunc(wrapper, frameEvent_selector(LuaArmatureWrapper::frameEventCallback));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
CCLOG("'setFrameEventCallFunc' function of ArmatureAnimation has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(L,"#ferror in function 'setFrameEventCallFunc'.",&tolua_err);
|
||||
|
@ -858,38 +831,34 @@ static int lua_cocos2dx_ArmatureDataManager_addArmatureFileInfoAsyncCallFunc(lua
|
|||
#endif
|
||||
argc = lua_gettop(L) - 1;
|
||||
|
||||
if (3 == argc)
|
||||
if (2 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isstring(L, 2, 0, &tolua_err) ||
|
||||
!tolua_isusertype(L, 3, "Object", 0, &tolua_err) ||
|
||||
!toluafix_isfunction(L,4,"LUA_FUNCTION",0,&tolua_err))
|
||||
!toluafix_isfunction(L,3,"LUA_FUNCTION",0,&tolua_err))
|
||||
{
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
const char* configFilePath = tolua_tostring(L, 2, "");
|
||||
Object* obj = static_cast<Object*>(tolua_tousertype(L, 3, nullptr));
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,4,0));
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L, 3, 0));
|
||||
|
||||
LuaArmatureWrapper* wrapper = new LuaArmatureWrapper();
|
||||
wrapper->autorelease();
|
||||
|
||||
wrapper->setObjTarget(obj);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)wrapper, handler, ScriptHandlerMgr::HandlerType::ARMATURE_EVENT);
|
||||
|
||||
self->addArmatureFileInfoAsync(configFilePath, wrapper, schedule_selector(LuaArmatureWrapper::addArmatureFileInfoAsyncCallback));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (5 == argc)
|
||||
else if (4 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if ( !tolua_isstring(L, 2, 0, &tolua_err) ||
|
||||
!tolua_isstring(L, 3, 0, &tolua_err) ||
|
||||
!tolua_isstring(L, 4, 0, &tolua_err) ||
|
||||
!tolua_isusertype(L, 5, "Object", 0, &tolua_err) ||
|
||||
!toluafix_isfunction(L,6,"LUA_FUNCTION",0,&tolua_err))
|
||||
!toluafix_isfunction(L,5,"LUA_FUNCTION",0,&tolua_err))
|
||||
{
|
||||
goto tolua_lerror;
|
||||
}
|
||||
|
@ -898,19 +867,20 @@ static int lua_cocos2dx_ArmatureDataManager_addArmatureFileInfoAsyncCallFunc(lua
|
|||
const char* plistPath = tolua_tostring(L, 3, "");
|
||||
const char* configFilePath = tolua_tostring(L, 4, "");
|
||||
|
||||
Object* obj = static_cast<Object*>(tolua_tousertype(L, 5, nullptr));
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,6,0));
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,5,0));
|
||||
|
||||
LuaArmatureWrapper* wrapper = new LuaArmatureWrapper();
|
||||
wrapper->autorelease();
|
||||
|
||||
wrapper->setObjTarget(obj);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)wrapper, handler, ScriptHandlerMgr::HandlerType::ARMATURE_EVENT);
|
||||
|
||||
self->addArmatureFileInfoAsync(imagePath, plistPath,configFilePath,wrapper, schedule_selector(LuaArmatureWrapper::addArmatureFileInfoAsyncCallback));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addArmatureFileInfoAsync' function of ArmatureDataManager has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(L,"#ferror in function 'addArmatureFileInfoAsync'.",&tolua_err);
|
||||
|
@ -935,7 +905,7 @@ int register_all_cocos2dx_coco_studio_manual(lua_State* L)
|
|||
extendUIWidget(L);
|
||||
extendUICheckBox(L);
|
||||
extendUISlider(L);
|
||||
extendUISlider(L);
|
||||
extendUITextField(L);
|
||||
extendUIPageView(L);
|
||||
// extendUIListView(L);
|
||||
extendLayoutParameter(L);
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
ccs = ccs or {}
|
||||
|
||||
CC_MovementEventType_START = 0
|
||||
CC_MovementEventType_COMPLETE = 1
|
||||
CC_MovementEventType_LOOP_COMPLETE = 2
|
||||
|
||||
ccs.BrightStyle =
|
||||
{
|
||||
none = -1,
|
||||
normal = 0,
|
||||
highlight = 1,
|
||||
}
|
||||
|
||||
ccs.WidgetType =
|
||||
{
|
||||
widget = 0, --control
|
||||
container = 1, --container
|
||||
};
|
||||
|
||||
-- ccs.TextureResType =
|
||||
-- {
|
||||
-- "local" = 0,
|
||||
-- "plist" = 1,
|
||||
-- }
|
||||
|
||||
ccs.TouchEventType =
|
||||
{
|
||||
began = 0,
|
||||
moved = 1,
|
||||
ended = 2,
|
||||
canceled = 3,
|
||||
}
|
||||
|
||||
ccs.SizeType =
|
||||
{
|
||||
absolute = 0,
|
||||
percent = 1,
|
||||
};
|
||||
|
||||
ccs.PositionType = {
|
||||
absolute = 0,
|
||||
percent = 1,
|
||||
};
|
||||
|
||||
ccs.CheckBoxEventType =
|
||||
{
|
||||
selected = 0,
|
||||
unselected = 1,
|
||||
};
|
||||
|
||||
ccs.TextFiledEventType =
|
||||
{
|
||||
attach_with_ime = 0,
|
||||
detach_with_ime = 1,
|
||||
insert_text = 2,
|
||||
delete_backward = 3,
|
||||
};
|
||||
|
||||
ccs.LayoutBackGroundColorType =
|
||||
{
|
||||
none = 0,
|
||||
solid = 1,
|
||||
gradient = 2,
|
||||
};
|
||||
|
||||
ccs.LayoutType =
|
||||
{
|
||||
absolute = 0,
|
||||
linearVertical = 1,
|
||||
linearHorizontal = 2,
|
||||
relative = 3,
|
||||
};
|
||||
|
||||
ccs.UILayoutParameterType =
|
||||
{
|
||||
none = 0,
|
||||
linear = 1,
|
||||
relative = 2,
|
||||
};
|
||||
|
||||
ccs.UILinearGravity =
|
||||
{
|
||||
none = 0,
|
||||
left = 1,
|
||||
top = 2,
|
||||
right = 3,
|
||||
bottom = 4,
|
||||
centerVertical = 5,
|
||||
centerHorizontal = 6,
|
||||
};
|
||||
|
||||
ccs.UIRelativeAlign =
|
||||
{
|
||||
alignNone = 0,
|
||||
alignParentTopLeft = 1,
|
||||
alignParentTopCenterHorizontal = 2,
|
||||
alignParentTopRight = 3,
|
||||
alignParentLeftCenterVertical = 4,
|
||||
centerInParent = 5,
|
||||
alignParentRightCenterVertical = 6,
|
||||
alignParentLeftBottom = 7,
|
||||
alignParentBottomCenterHorizontal = 8,
|
||||
alignParentRightBottom = 9,
|
||||
locationAboveLeftAlign = 10,
|
||||
locationAboveCenter = 11,
|
||||
locationAboveRightAlign = 12,
|
||||
locationLeftOfTopAlign = 13,
|
||||
locationLeftOfCenter = 14,
|
||||
locationLeftOfBottomAlign = 15,
|
||||
locationRightOfTopAlign = 16,
|
||||
locationRightOfCenter = 17,
|
||||
locationRightOfBottomAlign = 18,
|
||||
locationBelowLeftAlign = 19,
|
||||
locationBelowCenter = 20,
|
||||
locationBelowRightAlign = 21,
|
||||
};
|
||||
|
||||
ccs.SliderEventType = {percent_changed = 0};
|
||||
|
||||
ccs.LoadingBarType = { left = 0, right = 1};
|
||||
|
||||
ccs.SCROLLVIEW_DIR = {
|
||||
none = 0,
|
||||
vertical = 1,
|
||||
horizontal = 2,
|
||||
};
|
||||
|
||||
ccs.SCROLLVIEW_MOVE_DIR = {
|
||||
none = 0,
|
||||
up = 1,
|
||||
down = 2,
|
||||
left = 3,
|
||||
right = 4,
|
||||
};
|
||||
|
||||
ccs.ScrollviewEventType = {
|
||||
top = 0,
|
||||
bottom = 1,
|
||||
left = 2,
|
||||
right = 3,
|
||||
};
|
||||
|
||||
ccs.ListViewDirection = {
|
||||
none = 0,
|
||||
vertical = 1,
|
||||
horizontal = 2,
|
||||
};
|
||||
|
||||
ccs.ListViewMoveDirection = {
|
||||
none = 0,
|
||||
up = 1,
|
||||
down = 2,
|
||||
left = 3,
|
||||
right = 4,
|
||||
};
|
||||
|
||||
ccs.ListViewEventType = {
|
||||
init_child = 0,
|
||||
update_child = 1,
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,71 +0,0 @@
|
|||
UIScene = class("UIScene")
|
||||
UIScene.__index = UIScene
|
||||
UIScene._uiLayer= nil
|
||||
UIScene._widget=nil
|
||||
UIScene._sceneTitle=nil
|
||||
UIScene._topDisplayLabel=nil
|
||||
UIScene._bottomDisplayLabel=nil
|
||||
|
||||
function UIScene.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, UIScene)
|
||||
return target
|
||||
end
|
||||
|
||||
function UIScene:init()
|
||||
self._uiLayer = ccs.UILayer:create()
|
||||
self._uiLayer:scheduleUpdate()
|
||||
self:addChild(this._uiLayer)
|
||||
|
||||
self._widget = ccs.UIHelper:getInstance():createWidgetFromJsonFile("res/cocosgui/UITest/UITest.json")
|
||||
self._uiLayer:addWidget(self._widget)
|
||||
|
||||
self._sceneTitle = self._uiLayer:getWidgetByName("UItest")
|
||||
|
||||
local back_label = self._uiLayer:getWidgetByName("back")
|
||||
--back_label:addTouchEventListener(this.toExtensionsMainLayer, this)
|
||||
|
||||
local left_button = self._uiLayer:getWidgetByName("left_Button")
|
||||
--left_button:addTouchEventListener(this.previousCallback ,this)
|
||||
|
||||
local middle_button = self._uiLayer:getWidgetByName("middle_Button")
|
||||
--middle_button.addTouchEventListener(this.restartCallback ,this)
|
||||
|
||||
local right_button = self._uiLayer:getWidgetByName("right_Button")
|
||||
--right_button.addTouchEventListener(this.nextCallback ,this)
|
||||
|
||||
local winSize = cc.Director:getInstance():getWinSize()
|
||||
local scale = winSize.height / 320
|
||||
self._uiLayer:setAnchorPoint(cc.p(0,0))
|
||||
self._uiLayer:setScale(scale)
|
||||
self._uiLayer:setPosition(cc.p((winSize.width - 480 * scale) / 2, (winSize.height - 320 * scale) / 2))
|
||||
|
||||
local widgetSize = self._widget.getRect().size
|
||||
local eventLabel = ccs.UILabel:create()
|
||||
eventLabel:setText("")
|
||||
eventLabel:setFontName("Marker Felt")
|
||||
eventLabel:setFontSize(32)
|
||||
eventLabel:setAnchorPoint(cc.p(0.5, -1))
|
||||
eventLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
|
||||
self._uiLayer:addWidget(eventLabel)
|
||||
self._topDisplayLabel = eventLabel
|
||||
|
||||
local uiLabel = ccs.UILabel:create()
|
||||
uiLabel:setText("")
|
||||
uiLabel:setFontName("Marker Felt")
|
||||
uiLabel:setFontSize(30)
|
||||
uiLabel:setColor(cc.c3b(159, 168, 176))
|
||||
uiLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - uiLabel.getRect().size.height * 1.75))
|
||||
self._uiLayer.addWidget(uiLabel)
|
||||
self._bottomDisplayLabel = uiLabel
|
||||
end
|
||||
|
||||
function UIScene.create()
|
||||
local scene = UIScene.extend(cc.Scene:create())
|
||||
scene:init()
|
||||
return scene
|
||||
end
|
|
@ -4,6 +4,7 @@ require "Cocos2d"
|
|||
require "Cocos2dConstants"
|
||||
require "Opengl"
|
||||
require "OpenglConstants"
|
||||
require "StudioConstants"
|
||||
require "luaScript/helper"
|
||||
require "luaScript/testResource"
|
||||
require "luaScript/VisibleRect"
|
||||
|
|
|
@ -27,7 +27,7 @@ headers = %(cocosdir)s/cocos/editor-support/cocostudio/CocoStudio.h %(cocosdir)s
|
|||
|
||||
# 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 \w+Data$ UIWidget Layout UIRootWidget UIButton UICheckBox UIImageView UILabel UICCLabelAtlas UILabelAtlas UILoadingBar UIScrollView UISlider UICCTextField UITextField UIListView UILabelBMFont UIPageView UIHelper UILayer
|
||||
classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager \w+Data$ UIWidget UILayout UIRootWidget UIButton UICheckBox UIImageView UILabel UICCLabelAtlas UILabelAtlas UILoadingBar UIScrollView UISlider UICCTextField UITextField UIListView UILabelBMFont UIPageView UIHelper UILayer UILayoutParameter CCSGUIReader
|
||||
|
||||
# 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
|
||||
|
@ -44,10 +44,12 @@ skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*
|
|||
Bone::[(s|g)etIgnoreMovementBoneData],
|
||||
UILayer::[getInputManager],
|
||||
UILayoutParameter::[(s|g)etMargin],
|
||||
UIHelper::[init]
|
||||
UIHelper::[init],
|
||||
CCSGUIReader::[setPropsForImageButtonFromJsonDictionary]
|
||||
|
||||
rename_functions = UIHelper::[instance=getInstance],
|
||||
ArmatureDataManager::[sharedArmatureDataManager=getInstance]
|
||||
ArmatureDataManager::[sharedArmatureDataManager=getInstance],
|
||||
CCSGUIReader::[shareReader=getInstance]
|
||||
|
||||
rename_classes =
|
||||
|
||||
|
|
Loading…
Reference in New Issue