Update lua bindings for Spine and related test case

This commit is contained in:
samuele3hu 2014-10-16 20:23:58 +08:00
parent 8b5f6ae52a
commit 079df20541
8 changed files with 330 additions and 140 deletions

View File

@ -796,6 +796,26 @@
15AE1C1819AAE2C700C27E9E /* CCPhysicsSprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD71EEF180E27CF00808F54 /* CCPhysicsSprite.h */; };
15AE1C1919AAE30900C27E9E /* libwebsockets.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AAF5387180E35AC000584C8 /* libwebsockets.a */; };
15AE1C1A19AAE3C800C27E9E /* libwebsockets.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AAF5384180E35A3000584C8 /* libwebsockets.a */; };
15B13E3C19EFB3A9008A1ADC /* AssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3219EFB3A9008A1ADC /* AssetsManagerEx.cpp */; };
15B13E3D19EFB3A9008A1ADC /* AssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3219EFB3A9008A1ADC /* AssetsManagerEx.cpp */; };
15B13E3E19EFB3A9008A1ADC /* AssetsManagerEx.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3319EFB3A9008A1ADC /* AssetsManagerEx.h */; };
15B13E3F19EFB3A9008A1ADC /* AssetsManagerEx.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3319EFB3A9008A1ADC /* AssetsManagerEx.h */; };
15B13E4019EFB3A9008A1ADC /* CCEventAssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3419EFB3A9008A1ADC /* CCEventAssetsManagerEx.cpp */; };
15B13E4119EFB3A9008A1ADC /* CCEventAssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3419EFB3A9008A1ADC /* CCEventAssetsManagerEx.cpp */; };
15B13E4219EFB3A9008A1ADC /* CCEventAssetsManagerEx.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3519EFB3A9008A1ADC /* CCEventAssetsManagerEx.h */; };
15B13E4319EFB3A9008A1ADC /* CCEventAssetsManagerEx.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3519EFB3A9008A1ADC /* CCEventAssetsManagerEx.h */; };
15B13E4419EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3619EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.cpp */; };
15B13E4519EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3619EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.cpp */; };
15B13E4619EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3719EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.h */; };
15B13E4719EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3719EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.h */; };
15B13E4819EFB3A9008A1ADC /* Downloader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3819EFB3A9008A1ADC /* Downloader.cpp */; };
15B13E4919EFB3A9008A1ADC /* Downloader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3819EFB3A9008A1ADC /* Downloader.cpp */; };
15B13E4A19EFB3A9008A1ADC /* Downloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3919EFB3A9008A1ADC /* Downloader.h */; };
15B13E4B19EFB3A9008A1ADC /* Downloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3919EFB3A9008A1ADC /* Downloader.h */; };
15B13E4C19EFB3A9008A1ADC /* Manifest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3A19EFB3A9008A1ADC /* Manifest.cpp */; };
15B13E4D19EFB3A9008A1ADC /* Manifest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B13E3A19EFB3A9008A1ADC /* Manifest.cpp */; };
15B13E4E19EFB3A9008A1ADC /* Manifest.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3B19EFB3A9008A1ADC /* Manifest.h */; };
15B13E4F19EFB3A9008A1ADC /* Manifest.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B13E3B19EFB3A9008A1ADC /* Manifest.h */; };
15EFA211198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */; };
15EFA212198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */; };
15EFA213198A2BB5000C57D3 /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */; };
@ -1995,6 +2015,16 @@
15AE180319AAD2F700C27E9E /* CCSprite3DMaterial.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSprite3DMaterial.cpp; sourceTree = "<group>"; };
15AE180419AAD2F700C27E9E /* CCSprite3DMaterial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSprite3DMaterial.h; sourceTree = "<group>"; };
15AE180519AAD2F700C27E9E /* cocos3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocos3d.h; sourceTree = "<group>"; };
15B13E3219EFB3A9008A1ADC /* AssetsManagerEx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AssetsManagerEx.cpp; sourceTree = "<group>"; };
15B13E3319EFB3A9008A1ADC /* AssetsManagerEx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssetsManagerEx.h; sourceTree = "<group>"; };
15B13E3419EFB3A9008A1ADC /* CCEventAssetsManagerEx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCEventAssetsManagerEx.cpp; sourceTree = "<group>"; };
15B13E3519EFB3A9008A1ADC /* CCEventAssetsManagerEx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEventAssetsManagerEx.h; sourceTree = "<group>"; };
15B13E3619EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCEventListenerAssetsManagerEx.cpp; sourceTree = "<group>"; };
15B13E3719EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEventListenerAssetsManagerEx.h; sourceTree = "<group>"; };
15B13E3819EFB3A9008A1ADC /* Downloader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Downloader.cpp; sourceTree = "<group>"; };
15B13E3919EFB3A9008A1ADC /* Downloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Downloader.h; sourceTree = "<group>"; };
15B13E3A19EFB3A9008A1ADC /* Manifest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Manifest.cpp; sourceTree = "<group>"; };
15B13E3B19EFB3A9008A1ADC /* Manifest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Manifest.h; sourceTree = "<group>"; };
15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCProtectedNode.cpp; sourceTree = "<group>"; };
15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCProtectedNode.h; sourceTree = "<group>"; };
1A01C67618F57BE800EFE3A6 /* CCArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCArray.cpp; sourceTree = "<group>"; };
@ -3810,6 +3840,16 @@
1AAF5350180E305F000584C8 /* assets-manager */ = {
isa = PBXGroup;
children = (
15B13E3219EFB3A9008A1ADC /* AssetsManagerEx.cpp */,
15B13E3319EFB3A9008A1ADC /* AssetsManagerEx.h */,
15B13E3419EFB3A9008A1ADC /* CCEventAssetsManagerEx.cpp */,
15B13E3519EFB3A9008A1ADC /* CCEventAssetsManagerEx.h */,
15B13E3619EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.cpp */,
15B13E3719EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.h */,
15B13E3819EFB3A9008A1ADC /* Downloader.cpp */,
15B13E3919EFB3A9008A1ADC /* Downloader.h */,
15B13E3A19EFB3A9008A1ADC /* Manifest.cpp */,
15B13E3B19EFB3A9008A1ADC /* Manifest.h */,
1AAF5351180E3060000584C8 /* AssetsManager.cpp */,
1AAF5352180E3060000584C8 /* AssetsManager.h */,
);
@ -5104,6 +5144,7 @@
15AE1B5219AADA9900C27E9E /* UIPageView.h in Headers */,
3828C0A719EB8ACA002AB57B /* zero_copy_stream.h in Headers */,
5091A7A319BFABA800AC8789 /* CCPlatformDefine.h in Headers */,
15B13E4619EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.h in Headers */,
5034CA3F191D591100CE6051 /* ccShader_Position_uColor.vert in Headers */,
B29A7DD319EE1B7700872B35 /* Skin.h in Headers */,
50ABBD461925AB0000A911A9 /* CCVertex.h in Headers */,
@ -5117,9 +5158,11 @@
15AE18DD19AAD35000C27E9E /* CocoLoader.h in Headers */,
46A170EB1807CECA005B8026 /* CCPhysicsJoint.h in Headers */,
15AE191E19AAD35000C27E9E /* CCTween.h in Headers */,
15B13E4A19EFB3A9008A1ADC /* Downloader.h in Headers */,
15AE184619AAD2F700C27E9E /* CCSprite3DMaterial.h in Headers */,
50ABBD3E1925AB0000A911A9 /* CCGeometry.h in Headers */,
15AE1A7719AAD40300C27E9E /* b2EdgeAndPolygonContact.h in Headers */,
15B13E3E19EFB3A9008A1ADC /* AssetsManagerEx.h in Headers */,
15AE18F719AAD35000C27E9E /* CCBatchNode.h in Headers */,
15AE181419AAD2F700C27E9E /* CCAnimationCurve.h in Headers */,
50ABBE631925AB6F00A911A9 /* CCEventListenerAcceleration.h in Headers */,
@ -5333,6 +5376,7 @@
50ABBE951925AB6F00A911A9 /* CCProfiling.h in Headers */,
5034CA4B191D591100CE6051 /* ccShader_Label_df_glow.frag in Headers */,
50ABBE4F1925AB6F00A911A9 /* CCEventCustom.h in Headers */,
15B13E4E19EFB3A9008A1ADC /* Manifest.h in Headers */,
50ABBD521925AB0000A911A9 /* Quaternion.h in Headers */,
15AE186219AAD31D00C27E9E /* CDAudioManager.h in Headers */,
15AE18F119AAD35000C27E9E /* CCArmatureAnimation.h in Headers */,
@ -5407,6 +5451,7 @@
5034CA21191D591100CE6051 /* ccShader_PositionTextureColorAlphaTest.frag in Headers */,
15AE1A2419AAD3D500C27E9E /* b2BroadPhase.h in Headers */,
B29A7E3919EE1B7700872B35 /* Animation.h in Headers */,
15B13E4219EFB3A9008A1ADC /* CCEventAssetsManagerEx.h in Headers */,
15AE191019AAD35000C27E9E /* CCInputDelegate.h in Headers */,
15AE184C19AAD30800C27E9E /* SimpleAudioEngine.h in Headers */,
50ABBDA11925AB4100A911A9 /* CCGroupCommand.h in Headers */,
@ -5683,6 +5728,7 @@
DABC9FAC19E7DFA900FA252C /* CCClippingRectangleNode.h in Headers */,
50ABBEC41925AB6F00A911A9 /* CCVector.h in Headers */,
50ABBE501925AB6F00A911A9 /* CCEventCustom.h in Headers */,
15B13E4F19EFB3A9008A1ADC /* Manifest.h in Headers */,
15AE1AD719AAD40300C27E9E /* b2WheelJoint.h in Headers */,
1A570070180BC5A10088DEC7 /* CCActionEase.h in Headers */,
3828C09A19EB8ACA002AB57B /* extension_set.h in Headers */,
@ -5710,6 +5756,7 @@
3828C0DE19EB8ACA002AB57B /* stl_util.h in Headers */,
1A570080180BC5A10088DEC7 /* CCActionInterval.h in Headers */,
15AE192D19AAD35100C27E9E /* CCActionFrame.h in Headers */,
15B13E4719EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.h in Headers */,
15AE192F19AAD35100C27E9E /* CCActionFrameEasing.h in Headers */,
3828C0A819EB8ACA002AB57B /* zero_copy_stream.h in Headers */,
1A570084180BC5A10088DEC7 /* CCActionManager.h in Headers */,
@ -5863,6 +5910,7 @@
1A570213180BCBF40088DEC7 /* CCProgressTimer.h in Headers */,
B37510821823ACA100B3BA6A /* CCPhysicsJointInfo_chipmunk.h in Headers */,
1A570217180BCBF40088DEC7 /* CCRenderTexture.h in Headers */,
15B13E4319EFB3A9008A1ADC /* CCEventAssetsManagerEx.h in Headers */,
15AE1ABB19AAD40300C27E9E /* b2EdgeAndPolygonContact.h in Headers */,
15AE198719AAD36400C27E9E /* WidgetReaderProtocol.h in Headers */,
15AE198619AAD36400C27E9E /* WidgetReader.h in Headers */,
@ -6078,6 +6126,7 @@
3828C0E219EB8ACA002AB57B /* stringprintf.h in Headers */,
50ABBEDA1925AB6F00A911A9 /* ZipUtils.h in Headers */,
50ABBDC01925AB4100A911A9 /* CCTextureCache.h in Headers */,
15B13E3F19EFB3A9008A1ADC /* AssetsManagerEx.h in Headers */,
3EA1073219D7F37700CAB794 /* CCLight.h in Headers */,
B276EF641988D1D500CD400F /* CCVertexIndexBuffer.h in Headers */,
ED9C6A9718599AD8000A5232 /* CCNodeGrid.h in Headers */,
@ -6110,6 +6159,7 @@
50ABBE5C1925AB6F00A911A9 /* CCEventKeyboard.h in Headers */,
B375107D1823ACA100B3BA6A /* CCPhysicsBodyInfo_chipmunk.h in Headers */,
50ABC01C1926664800A911A9 /* CCSAXParser.h in Headers */,
15B13E4B19EFB3A9008A1ADC /* Downloader.h in Headers */,
503DD8F11926736A00CD74DD /* OpenGL_Internal-ios.h in Headers */,
B37510801823ACA100B3BA6A /* CCPhysicsHelper_chipmunk.h in Headers */,
B29A7DF619EE1B7700872B35 /* Skeleton.h in Headers */,
@ -6248,6 +6298,7 @@
50ABBE271925AB6F00A911A9 /* CCAutoreleasePool.cpp in Sources */,
15AE197419AAD35700C27E9E /* CCTimeLine.cpp in Sources */,
15AE188E19AAD33D00C27E9E /* CCLabelTTFLoader.cpp in Sources */,
15B13E4C19EFB3A9008A1ADC /* Manifest.cpp in Sources */,
15AE1A3019AAD3D500C27E9E /* b2ChainShape.cpp in Sources */,
50ABBE8B1925AB6F00A911A9 /* CCNS.cpp in Sources */,
15AE1BD819AAE01E00C27E9E /* CCControlStepper.cpp in Sources */,
@ -6360,6 +6411,7 @@
3828C0A519EB8ACA002AB57B /* zero_copy_stream.cc in Sources */,
50ABBE491925AB6F00A911A9 /* CCEventAcceleration.cpp in Sources */,
1A5701C1180BCB5A0088DEC7 /* CCLabelBMFont.cpp in Sources */,
15B13E4419EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.cpp in Sources */,
15AE182C19AAD2F700C27E9E /* CCMeshVertexIndexData.cpp in Sources */,
15AE1A8C19AAD40300C27E9E /* b2RevoluteJoint.cpp in Sources */,
50ABBD4C1925AB0000A911A9 /* MathUtil.cpp in Sources */,
@ -6415,6 +6467,7 @@
1A570225180BCC1A0088DEC7 /* CCParticleExamples.cpp in Sources */,
1A570229180BCC1A0088DEC7 /* CCParticleSystem.cpp in Sources */,
3828C09B19EB8ACA002AB57B /* generated_message_util.cc in Sources */,
15B13E4019EFB3A9008A1ADC /* CCEventAssetsManagerEx.cpp in Sources */,
1A57022D180BCC1A0088DEC7 /* CCParticleSystemQuad.cpp in Sources */,
1A57027E180BCC900088DEC7 /* CCSprite.cpp in Sources */,
15AE1A7419AAD40300C27E9E /* b2EdgeAndCircleContact.cpp in Sources */,
@ -6571,6 +6624,7 @@
15AE1A3619AAD3D500C27E9E /* b2PolygonShape.cpp in Sources */,
50ABBD9B1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */,
15AE188119AAD33D00C27E9E /* CCBReader.cpp in Sources */,
15B13E3C19EFB3A9008A1ADC /* AssetsManagerEx.cpp in Sources */,
50ABBDB91925AB4100A911A9 /* CCTextureAtlas.cpp in Sources */,
15AE1BE419AAE01E00C27E9E /* CCTableView.cpp in Sources */,
15AE1A3219AAD3D500C27E9E /* b2CircleShape.cpp in Sources */,
@ -6624,6 +6678,7 @@
15AE18EC19AAD35000C27E9E /* CCActionObject.cpp in Sources */,
1A01C68E18F57BE800EFE3A6 /* CCDictionary.cpp in Sources */,
50ABBD381925AB0000A911A9 /* CCAffineTransform.cpp in Sources */,
15B13E4819EFB3A9008A1ADC /* Downloader.cpp in Sources */,
46C02E0718E91123004B7456 /* xxhash.c in Sources */,
15AE1B6B19AADA9900C27E9E /* UIWidget.cpp in Sources */,
50ABBE931925AB6F00A911A9 /* CCProfiling.cpp in Sources */,
@ -6834,6 +6889,7 @@
15AE1A3D19AAD3D500C27E9E /* b2CollideEdge.cpp in Sources */,
1A5701C2180BCB5A0088DEC7 /* CCLabelBMFont.cpp in Sources */,
1A087AE91860400400196EF5 /* edtaa3func.cpp in Sources */,
15B13E4119EFB3A9008A1ADC /* CCEventAssetsManagerEx.cpp in Sources */,
3828C0EA19EB8ACA002AB57B /* wire_format_lite.cc in Sources */,
15AE194219AAD35100C27E9E /* CCColliderDetector.cpp in Sources */,
15AE1A9919AAD40300C27E9E /* b2Math.cpp in Sources */,
@ -6941,6 +6997,7 @@
15AE1BAF19AADFDF00C27E9E /* UILayoutManager.cpp in Sources */,
15AE182119AAD2F700C27E9E /* CCBundleReader.cpp in Sources */,
50ABBD3D1925AB0000A911A9 /* CCGeometry.cpp in Sources */,
15B13E4919EFB3A9008A1ADC /* Downloader.cpp in Sources */,
15AE18D919AAD33D00C27E9E /* CCSpriteLoader.cpp in Sources */,
50ABBECC1925AB6F00A911A9 /* s3tc.cpp in Sources */,
15AE1B7819AADA9A00C27E9E /* UIRichText.cpp in Sources */,
@ -6974,6 +7031,7 @@
15AE1BAB19AADFDF00C27E9E /* UILayout.cpp in Sources */,
1A570355180BD0B00088DEC7 /* ioapi.cpp in Sources */,
1A570359180BD0B00088DEC7 /* unzip.cpp in Sources */,
15B13E4D19EFB3A9008A1ADC /* Manifest.cpp in Sources */,
15AE18BB19AAD33D00C27E9E /* CCControlLoader.cpp in Sources */,
15AE19B819AAD39700C27E9E /* TextFieldReader.cpp in Sources */,
15AE195B19AAD35100C27E9E /* CCSGUIReader.cpp in Sources */,
@ -7005,6 +7063,7 @@
15AE19A819AAD39700C27E9E /* LayoutReader.cpp in Sources */,
1A01C68B18F57BE800EFE3A6 /* CCDeprecated.cpp in Sources */,
15AE195719AAD35100C27E9E /* CCInputDelegate.cpp in Sources */,
15B13E4519EFB3A9008A1ADC /* CCEventListenerAssetsManagerEx.cpp in Sources */,
15AE1B8A19AADA9A00C27E9E /* UIImageView.cpp in Sources */,
50ABBD391925AB0000A911A9 /* CCAffineTransform.cpp in Sources */,
15AE1C1519AAE2C700C27E9E /* CCPhysicsDebugNode.cpp in Sources */,
@ -7047,6 +7106,7 @@
50CB247819D9C5A100687767 /* AudioCache.mm in Sources */,
50ABBD5D1925AB0000A911A9 /* Vec3.cpp in Sources */,
38B8E2D619E66581002D7CE7 /* CSLoader.cpp in Sources */,
15B13E3D19EFB3A9008A1ADC /* AssetsManagerEx.cpp in Sources */,
50ABC0121926664800A911A9 /* CCGLView.cpp in Sources */,
50ABC0021926664800A911A9 /* CCLock-apple.cpp in Sources */,
3828C09819EB8ACA002AB57B /* extension_set.cc in Sources */,

View File

@ -170,6 +170,11 @@ public:
EVENT_CONTROLLER_KEYREPEAT,
EVENT_CONTROLLER_AXIS,
EVENT_SPINE_ANIMATION_START,
EVENT_SPINE_ANIMATION_END,
EVENT_SPINE_ANIMATION_COMPLETE,
EVENT_SPINE_ANIMATION_EVENT,
EVENT_CUSTOM_BEGAN = 10000,
EVENT_CUSTOM_ENDED = 11000,
};

View File

@ -32,73 +32,10 @@
using namespace spine;
USING_NS_CC;
static int SendSpineEventToLua(int nHandler, spine::SkeletonAnimation* node, int trackIndex, spEventType type, spEvent* event, int loopCount)
{
if (nHandler <= 0) {
return 0;
}
if (NULL == ScriptEngineManager::getInstance()->getScriptEngine()) {
return 0;
}
LuaStack *pStack = LuaEngine::getInstance()->getLuaStack();
if (NULL == pStack) {
return 0;
}
lua_State *tolua_s = pStack->getLuaState();
if (NULL == tolua_s) {
return 0;
}
int nRet = 0;
// spTrackEntry* entry = spAnimationState_getCurrent(node->state, trackIndex);
// std::string animationName = (entry && entry->animation) ? entry->animation->name : "";
// 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;
// }
// LuaValueDict spineEvent;
// spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("type", LuaValue::stringValue(eventType)));
// spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("trackIndex", LuaValue::intValue(trackIndex)));
// 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;
}
LuaSkeletonAnimation::LuaSkeletonAnimation (const char* skeletonDataFile, const char* atlasFile, float scale)
: spine::SkeletonAnimation(skeletonDataFile, atlasFile, scale)
{
//this->setAnimationListener(this, animationStateEvent_selector(LuaSkeletonAnimation::animationStateEvent));
}
@ -113,11 +50,3 @@ LuaSkeletonAnimation* LuaSkeletonAnimation::createWithFile (const char* skeleton
node->autorelease();
return node;
}
void LuaSkeletonAnimation::animationStateEvent (spine::SkeletonAnimation* node, int trackIndex, spEventType type, spEvent* event, int loopCount)
{
int nHandler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr::HandlerType::EVENT_SPINE);
if (0 != nHandler) {
SendSpineEventToLua(nHandler, node, trackIndex, type, event, loopCount);
}
}

View File

@ -28,9 +28,6 @@
#include "spine-cocos2dx.h"
class LuaSkeletonAnimation: public spine::SkeletonAnimation {
private:
void animationStateEvent (spine::SkeletonAnimation* node, int trackIndex, spEventType type, spEvent* event, int loopCount);
public:
static LuaSkeletonAnimation* createWithFile (const char* skeletonDataFile, const char* atlasFile, float scale = 1);

View File

@ -142,6 +142,72 @@ tolua_lerror:
return 0;
}
int executeSpineEvent(LuaSkeletonAnimation* skeletonAnimation, int handler, spEventType eventType, int trackIndex , int loopCount = 0, spEvent* event = nullptr )
{
if (nullptr == skeletonAnimation || 0 == handler)
return 0;
LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
if (nullptr == stack)
return 0;
lua_State* L = LuaEngine::getInstance()->getLuaStack()->getLuaState();
if (nullptr == L)
return 0;
int ret = 0;
spTrackEntry* entry = spAnimationState_getCurrent(skeletonAnimation->getState(), trackIndex);
std::string animationName = (entry && entry->animation) ? entry->animation->name : "";
std::string eventTypeName = "";
switch (eventType) {
case spEventType::SP_ANIMATION_START:
{
eventTypeName = "start";
}
break;
case spEventType::SP_ANIMATION_END:
{
eventTypeName = "end";
}
break;
case spEventType::SP_ANIMATION_COMPLETE:
{
eventTypeName = "complete";
}
break;
case spEventType::SP_ANIMATION_EVENT:
{
eventTypeName = "event";
}
break;
default:
break;
}
LuaValueDict spineEvent;
spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("type", LuaValue::stringValue(eventTypeName)));
spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("trackIndex", LuaValue::intValue(trackIndex)));
spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("animation", LuaValue::stringValue(animationName)));
spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("loopCount", LuaValue::intValue(loopCount)));
if (nullptr != 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)));
}
stack->pushLuaValueDict(spineEvent);
ret = stack->executeFunctionByHandler(handler, 1);
return ret;
}
int tolua_Cocos2d_CCSkeletonAnimation_registerSpineEventHandler00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
@ -149,7 +215,8 @@ int tolua_Cocos2d_CCSkeletonAnimation_registerSpineEventHandler00(lua_State* tol
if (
!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
!toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
!tolua_isnumber(tolua_S, 3, 0, &tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
@ -158,7 +225,44 @@ int tolua_Cocos2d_CCSkeletonAnimation_registerSpineEventHandler00(lua_State* tol
LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
if (NULL != self ) {
int handler = ( toluafix_ref_function(tolua_S,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::EVENT_SPINE);
spEventType eventType = (spEventType)(tolua_tonumber(tolua_S, 3, 0));
switch (eventType) {
case spEventType::SP_ANIMATION_START:
{
self->setStartListener([=](int trackIndex){
executeSpineEvent(self, handler, eventType, trackIndex);
});
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::EVENT_SPINE_ANIMATION_START);
}
break;
case spEventType::SP_ANIMATION_END:
{
self->setEndListener([=](int trackIndex){
executeSpineEvent(self, handler, eventType, trackIndex);
});
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::EVENT_SPINE_ANIMATION_END);
}
break;
case spEventType::SP_ANIMATION_COMPLETE:
{
self->setCompleteListener([=](int trackIndex, int loopCount){
executeSpineEvent(self, handler, eventType, trackIndex, loopCount);
});
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::EVENT_SPINE_ANIMATION_COMPLETE);
}
break;
case spEventType::SP_ANIMATION_EVENT:
{
self->setEventListener([=](int trackIndex, spEvent* event){
executeSpineEvent(self, handler, eventType, trackIndex, 0, event);
});
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::EVENT_SPINE_ANIMATION_EVENT);
}
break;
default:
break;
}
}
}
return 0;
@ -175,7 +279,8 @@ int tolua_Cocos2d_CCSkeletonAnimation_unregisterSpineEventHandler00(lua_State* t
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
!tolua_isnumber(tolua_S, 2, 0, &tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
@ -183,7 +288,26 @@ int tolua_Cocos2d_CCSkeletonAnimation_unregisterSpineEventHandler00(lua_State* t
{
LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0);
if (NULL != self ) {
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, ScriptHandlerMgr::HandlerType::EVENT_SPINE);
spEventType eventType = (spEventType)(tolua_tonumber(tolua_S, 2, 0));
ScriptHandlerMgr::HandlerType handlerType = ScriptHandlerMgr::HandlerType::EVENT_SPINE_ANIMATION_START;
switch (eventType) {
case spEventType::SP_ANIMATION_START:
handlerType = ScriptHandlerMgr::HandlerType::EVENT_SPINE_ANIMATION_START;
break;
case spEventType::SP_ANIMATION_END:
handlerType = ScriptHandlerMgr::HandlerType::EVENT_SPINE_ANIMATION_END;
break;
case spEventType::SP_ANIMATION_COMPLETE:
handlerType = ScriptHandlerMgr::HandlerType::EVENT_SPINE_ANIMATION_COMPLETE;
break;
case spEventType::SP_ANIMATION_EVENT:
handlerType = ScriptHandlerMgr::HandlerType::EVENT_SPINE_ANIMATION_EVENT;
break;
default:
break;
}
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, handlerType);
}
}
return 0;
@ -460,6 +584,11 @@ static void extendCCSkeletonAnimation(lua_State* L)
tolua_function(L, "setAnimation", lua_cocos2dx_spine_SkeletonAnimation_setAnimation);
}
lua_pop(L, 1);
/*Because sp.SkeletonAnimation:create creat a LuaSkeletonAnimation object,so we need use LuaSkeletonAnimation typename for g_luaType*/
std::string typeName = typeid(LuaSkeletonAnimation).name();
g_luaType[typeName] = "sp.SkeletonAnimation";
g_typeCast["SkeletonAnimation"] = "sp.SkeletonAnimation";
}
int register_all_cocos2dx_spine_manual(lua_State* L)

View File

@ -273,6 +273,10 @@ cc.Handler.EVENT_CONTROLLER_KEYDOWN = 60
cc.Handler.EVENT_CONTROLLER_KEYUP = 61
cc.Handler.EVENT_CONTROLLER_KEYREPEAT = 62
cc.Handler.EVENT_CONTROLLER_AXIS = 63
cc.Handler.EVENT_SPINE_ANIMATION_START = 64
cc.Handler.EVENT_SPINE_ANIMATION_END = 65
cc.Handler.EVENT_SPINE_ANIMATION_COMPLETE = 66
cc.Handler.EVENT_SPINE_ANIMATION_EVENT = 67
cc.EVENT_UNKNOWN = 0

View File

@ -1,82 +1,148 @@
local SpineTestLayer1 = nil
require "cocos.spine.SpineConstants"
local SpineTestLayerNormal = class("SpineTestLayerNormal",function()
return cc.Layer:create()
end)
--------------------------------------------------------------------
--
-- SpineTestLayer1
--
--------------------------------------------------------------------
function SpineTestLayerNormal:ctor()
SpineTestLayer1 = function()
local ret = cc.Layer:create()
local function onNodeEvent(event)
if event == "enter" then
self:init()
end
end
local s = cc.Director:getInstance():getWinSize()
local spineboy
self:registerScriptHandler(onNodeEvent)
end
local addSpineBoy = function()
spineboy = sp.SkeletonAnimation:create(s_pPathSpineBoyJson, s_pPathSpineBoyAtlas, 0.8)
ret:addChild(spineboy)
spineboy:setPosition(cc.p(s.width/2, 20))
spineboy:setMix("walk", "jump", 0.2)
spineboy:setMix("jump", "walk", 0.4)
spineboy:setTimeScale(0.3)
spineboy:setDebugBones(true)
spineboy:setAnimation(0, 'walk', false)
spineboy:addAnimation(0, 'jump', false)
spineboy:addAnimation(0, 'walk', true)
spineboy:addAnimation(0, 'jump', true, 4)
function SpineTestLayerNormal:init()
local skeletonNode = sp.SkeletonAnimation:create("spine/spineboy.json", "spine/spineboy.atlas", 0.6)
skeletonNode:setScale(0.5)
spineboy:registerSpineEventHandler(function(event)
if event.type == 'start' then
skeletonNode:registerSpineEventHandler(function (event)
print(string.format("[spine] %d start: %s",
event.trackIndex,
event.animation))
elseif event.type == 'end' then
print(string.format("[spine] %d end: %s",
end, sp.EventType.ANIMATION_START)
skeletonNode:registerSpineEventHandler(function (event)
print(string.format("[spine] %d end:",
event.trackIndex))
end, sp.EventType.ANIMATION_END)
skeletonNode:registerSpineEventHandler(function (event)
print(string.format("[spine] %d complete: %d",
event.trackIndex,
event.animation))
elseif event.type == 'complete' then
print(string.format("[spine] %d complete: %s, %d",
event.trackIndex,
event.animation,
event.loopCount))
elseif event.type == 'event' then
print(string.format("[spine] %d event: %s, %s: %d, %f, %s",
end, sp.EventType.ANIMATION_COMPLETE)
skeletonNode:registerSpineEventHandler(function (event)
print(string.format("[spine] %d event: %s, %d, %f, %s",
event.trackIndex,
event.animation,
event.eventData.name,
event.eventData.intValue,
event.eventData.floatValue,
event.eventData.stringValue))
end, sp.EventType.ANIMATION_EVENT)
skeletonNode:setMix("walk", "jump", 0.2)
skeletonNode:setMix("jump", "run", 0.2)
skeletonNode:setAnimation(0, "walk", true)
skeletonNode:addAnimation(0, "jump", false, 3)
skeletonNode:addAnimation(0, "run", true)
local windowSize = cc.Director:getInstance():getWinSize()
skeletonNode:setPosition(cc.p(windowSize.width / 2, 20))
self:addChild(skeletonNode)
local listener = cc.EventListenerTouchOneByOne:create()
listener:registerScriptHandler(function (touch, event)
if not skeletonNode:getDebugBonesEnabled() then
skeletonNode:setDebugBonesEnabled(true)
elseif skeletonNode:getTimeScale() == 1 then
skeletonNode:setTimeScale(0.3)
else
skeletonNode:setTimeScale(1)
skeletonNode:setDebugBonesEnabled(false)
end
end)
spineboy:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeOut:create(1),
cc.FadeIn:create(1),
cc.DelayTime:create(5))))
return true
end,cc.Handler.EVENT_TOUCH_BEGAN )
local eventDispatcher = self:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
end
end
function SpineTestLayerNormal.create( ... )
local layer = SpineTestLayerNormal.new()
Helper.initWithLayer(layer)
Helper.titleLabel:setString("SpineTestLayerNormal Test")
return layer
end
----
local SpineTestLayerFFD = class("SpineTestLayerFFD",function()
return cc.Layer:create()
end)
function SpineTestLayerFFD:ctor()
local function onNodeEvent(event)
if event == "enter" then
cclog("SpineTestLayer1#onEnter")
addSpineBoy()
elseif event == "enterTransitionFinish" then
cclog("SceneTestLayer1#onEnterTransitionDidFinish")
self:init()
end
end
ret:registerScriptHandler(onNodeEvent)
return ret
self:registerScriptHandler(onNodeEvent)
end
function SpineTestLayerFFD:init()
skeletonNode = sp.SkeletonAnimation:create("spine/goblins-ffd.json", "spine/goblins-ffd.atlas", 1.5)
skeletonNode:setAnimation(0, "walk", true)
skeletonNode:setSkin("goblin")
skeletonNode:setScale(0.5)
local windowSize = cc.Director:getInstance():getWinSize()
skeletonNode:setPosition(cc.p(windowSize.width / 2, 20))
self:addChild(skeletonNode)
local listener = cc.EventListenerTouchOneByOne:create()
listener:registerScriptHandler(function (touch, event)
if not skeletonNode:getDebugBonesEnabled() then
skeletonNode:setDebugBonesEnabled(true)
elseif skeletonNode:getTimeScale() == 1 then
skeletonNode:setTimeScale(0.3)
else
skeletonNode:setTimeScale(1)
skeletonNode:setDebugBonesEnabled(false)
end
return true
end,cc.Handler.EVENT_TOUCH_BEGAN )
local eventDispatcher = self:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
end
function SpineTestLayerFFD.create( ... )
local layer = SpineTestLayerFFD.new()
Helper.initWithLayer(layer)
Helper.titleLabel:setString("SpineTestLayerFFD Test")
return layer
end
function SpineTestMain()
cclog("SpineTestMain")
local scene = cc.Scene:create()
local layer = SpineTestLayer1()
scene:addChild(layer, 0)
Helper.createFunctionTable =
{
SpineTestLayerNormal.create,
SpineTestLayerFFD.create,
}
scene:addChild(SpineTestLayerNormal.create(), 0)
scene:addChild(CreateBackMenuItem())
return scene
end

View File

@ -38,7 +38,7 @@ classes = SkeletonRenderer SkeletonAnimation
skip = SkeletonRenderer::[findBone findSlot getAttachment setAttachment update draw createWithData (s|g)etBlendFunc],
*::[update draw drawSkeleton],
SkeletonAnimation::[setAnimationStateData createWithData (s|g)etBlendFunc addAnimation getCurrent setAnimation onAnimationStateEvent onTrackEntryEvent getState]
SkeletonAnimation::[setAnimationStateData createWithData (s|g)etBlendFunc addAnimation getCurrent setAnimation onAnimationStateEvent onTrackEntryEvent getState createWithFile]
rename_functions =