lua compiles ok-need to make it works later

This commit is contained in:
Huabing.Xu 2014-10-15 17:33:58 +08:00
parent 8135b09c98
commit c12f88d63c
5 changed files with 1263 additions and 358 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,22 @@ int register_all_cocos2dx_spine(lua_State* tolua_S);

View File

@ -54,43 +54,43 @@ static int SendSpineEventToLua(int nHandler, spine::SkeletonAnimation* node, int
int nRet = 0; int nRet = 0;
spTrackEntry* entry = spAnimationState_getCurrent(node->state, trackIndex); // spTrackEntry* entry = spAnimationState_getCurrent(node->state, trackIndex);
std::string animationName = (entry && entry->animation) ? entry->animation->name : ""; // std::string animationName = (entry && entry->animation) ? entry->animation->name : "";
std::string eventType = ""; // std::string eventType = "";
//
// switch (type) {
// case ANIMATION_START:
// eventType = "start";
// break;
// case ANIMATION_END:
// eventType = "end";
// break;
// case ANIMATION_COMPLETE:
// eventType = "complete";
// break;
// case ANIMATION_EVENT:
// eventType = "event";
// break;
// }
switch (type) { // LuaValueDict spineEvent;
case ANIMATION_START: // spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("type", LuaValue::stringValue(eventType)));
eventType = "start"; // spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("trackIndex", LuaValue::intValue(trackIndex)));
break; // spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("animation", LuaValue::stringValue(animationName)));
case ANIMATION_END: // spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("loopCount", LuaValue::intValue(loopCount)));
eventType = "end"; //
break; // if (NULL != event) {
case ANIMATION_COMPLETE: // LuaValueDict eventData;
eventType = "complete"; // eventData.insert(eventData.end(), LuaValueDict::value_type("name", LuaValue::stringValue(event->data->name)));
break; // eventData.insert(eventData.end(), LuaValueDict::value_type("intValue", LuaValue::intValue(event->intValue)));
case ANIMATION_EVENT: // eventData.insert(eventData.end(), LuaValueDict::value_type("floatValue", LuaValue::floatValue(event->floatValue)));
eventType = "event"; // eventData.insert(eventData.end(), LuaValueDict::value_type("stringValue", LuaValue::stringValue(event->stringValue)));
break; // spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("eventData", LuaValue::dictValue(eventData)));
} // }
//
LuaValueDict spineEvent; // pStack->pushLuaValueDict(spineEvent);
spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("type", LuaValue::stringValue(eventType))); // nRet = pStack->executeFunctionByHandler(nHandler, 1);
spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("trackIndex", LuaValue::intValue(trackIndex))); // pStack->clean();
spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("animation", LuaValue::stringValue(animationName)));
spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("loopCount", LuaValue::intValue(loopCount)));
if (NULL != event) {
LuaValueDict eventData;
eventData.insert(eventData.end(), LuaValueDict::value_type("name", LuaValue::stringValue(event->data->name)));
eventData.insert(eventData.end(), LuaValueDict::value_type("intValue", LuaValue::intValue(event->intValue)));
eventData.insert(eventData.end(), LuaValueDict::value_type("floatValue", LuaValue::floatValue(event->floatValue)));
eventData.insert(eventData.end(), LuaValueDict::value_type("stringValue", LuaValue::stringValue(event->stringValue)));
spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("eventData", LuaValue::dictValue(eventData)));
}
pStack->pushLuaValueDict(spineEvent);
nRet = pStack->executeFunctionByHandler(nHandler, 1);
pStack->clean();
return nRet; return nRet;
} }
@ -98,7 +98,7 @@ static int SendSpineEventToLua(int nHandler, spine::SkeletonAnimation* node, int
LuaSkeletonAnimation::LuaSkeletonAnimation (const char* skeletonDataFile, const char* atlasFile, float scale) LuaSkeletonAnimation::LuaSkeletonAnimation (const char* skeletonDataFile, const char* atlasFile, float scale)
: spine::SkeletonAnimation(skeletonDataFile, atlasFile, scale) : spine::SkeletonAnimation(skeletonDataFile, atlasFile, scale)
{ {
this->setAnimationListener(this, animationStateEvent_selector(LuaSkeletonAnimation::animationStateEvent)); //this->setAnimationListener(this, animationStateEvent_selector(LuaSkeletonAnimation::animationStateEvent));
} }

View File

@ -196,110 +196,114 @@ tolua_lerror:
static int tolua_Cocos2d_CCSkeletonAnimation_setTimeScale00(lua_State* tolua_S) static int tolua_Cocos2d_CCSkeletonAnimation_setTimeScale00(lua_State* tolua_S)
{ {
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
if (NULL != self ) {
LUA_NUMBER scale = tolua_tonumber(tolua_S, 2, 1);
self->timeScale = scale;
}
}
return 0; return 0;
#ifndef TOLUA_RELEASE //#ifndef TOLUA_RELEASE
tolua_lerror: // tolua_Error tolua_err;
tolua_error(tolua_S,"#ferror in function 'setTimeScale'.",&tolua_err); // if (
return 0; // !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
#endif // !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
// !tolua_isnoobj(tolua_S,3,&tolua_err)
// )
// goto tolua_lerror;
// else
//#endif
// {
// LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
// if (NULL != self ) {
// LUA_NUMBER scale = tolua_tonumber(tolua_S, 2, 1);
// self->timeScale = scale;
// }
// }
// return 0;
//#ifndef TOLUA_RELEASE
//tolua_lerror:
// tolua_error(tolua_S,"#ferror in function 'setTimeScale'.",&tolua_err);
// return 0;
//#endif
} }
static int tolua_Cocos2d_CCSkeletonAnimation_setDebugSlots00(lua_State* tolua_S) static int tolua_Cocos2d_CCSkeletonAnimation_setDebugSlots00(lua_State* tolua_S)
{ {
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
!tolua_isboolean(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
if (NULL != self ) {
bool debugSlots = tolua_toboolean(tolua_S, 2, 1);
self->debugSlots = debugSlots;
}
}
return 0; return 0;
#ifndef TOLUA_RELEASE //#ifndef TOLUA_RELEASE
tolua_lerror: // tolua_Error tolua_err;
tolua_error(tolua_S,"#ferror in function 'setDebugSlots'.",&tolua_err); // if (
return 0; // !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
#endif // !tolua_isboolean(tolua_S,2,0,&tolua_err) ||
// !tolua_isnoobj(tolua_S,3,&tolua_err)
// )
// goto tolua_lerror;
// else
//#endif
// {
// LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
// if (NULL != self ) {
// bool debugSlots = tolua_toboolean(tolua_S, 2, 1);
// self->debugSlots = debugSlots;
// }
// }
// return 0;
//#ifndef TOLUA_RELEASE
//tolua_lerror:
// tolua_error(tolua_S,"#ferror in function 'setDebugSlots'.",&tolua_err);
// return 0;
//#endif
} }
static int tolua_Cocos2d_CCSkeletonAnimation_setDebugBones00(lua_State* tolua_S) static int tolua_Cocos2d_CCSkeletonAnimation_setDebugBones00(lua_State* tolua_S)
{ {
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
!tolua_isboolean(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
if (NULL != self ) {
bool debugBones = tolua_toboolean(tolua_S, 2, 1);
self->debugBones = debugBones;
}
}
return 0; return 0;
#ifndef TOLUA_RELEASE //#ifndef TOLUA_RELEASE
tolua_lerror: // tolua_Error tolua_err;
tolua_error(tolua_S,"#ferror in function 'setDebugBones'.",&tolua_err); // if (
return 0; // !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
#endif // !tolua_isboolean(tolua_S,2,0,&tolua_err) ||
// !tolua_isnoobj(tolua_S,3,&tolua_err)
// )
// goto tolua_lerror;
// else
//#endif
// {
// LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
// if (NULL != self ) {
// bool debugBones = tolua_toboolean(tolua_S, 2, 1);
// self->debugBones = debugBones;
// }
// }
// return 0;
//#ifndef TOLUA_RELEASE
//tolua_lerror:
// tolua_error(tolua_S,"#ferror in function 'setDebugBones'.",&tolua_err);
// return 0;
//#endif
} }
static int tolua_Cocos2d_CCSkeletonAnimation_setPremultipliedAlpha00(lua_State* tolua_S) static int tolua_Cocos2d_CCSkeletonAnimation_setPremultipliedAlpha00(lua_State* tolua_S)
{ {
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
!tolua_isboolean(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
if (NULL != self ) {
bool premultipliedAlpha = tolua_toboolean(tolua_S, 2, 1);
self->premultipliedAlpha = premultipliedAlpha;
}
}
return 0; return 0;
#ifndef TOLUA_RELEASE //#ifndef TOLUA_RELEASE
tolua_lerror: // tolua_Error tolua_err;
tolua_error(tolua_S,"#ferror in function 'setPremultipliedAlpha'.",&tolua_err); // if (
return 0; // !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
#endif // !tolua_isboolean(tolua_S,2,0,&tolua_err) ||
// !tolua_isnoobj(tolua_S,3,&tolua_err)
// )
// goto tolua_lerror;
// else
//#endif
// {
// LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
// if (NULL != self ) {
// bool premultipliedAlpha = tolua_toboolean(tolua_S, 2, 1);
// self->premultipliedAlpha = premultipliedAlpha;
// }
// }
// return 0;
//#ifndef TOLUA_RELEASE
//tolua_lerror:
// tolua_error(tolua_S,"#ferror in function 'setPremultipliedAlpha'.",&tolua_err);
// return 0;
//#endif
} }

View File

@ -27,7 +27,7 @@ headers = %(cocosdir)s/cocos/editor-support/spine/spine-cocos2dx.h
# what classes to produce code for. You can use regular expressions here. When testing the regular # 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*$". # expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = Skeleton SkeletonAnimation classes = SkeletonRenderer SkeletonAnimation
# what should we skip? in the format ClassName::[function function] # 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 # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
@ -36,8 +36,9 @@ classes = Skeleton SkeletonAnimation
# will apply to all class names. This is a convenience wildcard to be able to skip similar named # will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes. # functions from all classes.
skip = Skeleton::[findBone findSlot getAttachment setAttachment update draw createWith.*], skip = SkeletonRenderer::[findBone findSlot getAttachment setAttachment update draw createWithData (s|g)etBlendFunc],
SkeletonAnimation::[addAnimationState setAnimationStateData update createWith.* (s|g)etBlendFunc addAnimation getCurrent setAnimation onAnimationStateEvent] *::[update draw drawSkeleton],
SkeletonAnimation::[setAnimationStateData createWithData (s|g)etBlendFunc addAnimation getCurrent setAnimation onAnimationStateEvent onTrackEntryEvent getState]
rename_functions = rename_functions =