mirror of https://github.com/axmolengine/axmol.git
e606027b59 | ||
---|---|---|
.. | ||
CCAccelerometer.pkg | ||
CCAccelerometerDelegate.pkg | ||
CCAction.pkg | ||
CCActionCamera.pkg | ||
CCActionEase.pkg | ||
CCActionGrid.pkg | ||
CCActionGrid3D.pkg | ||
CCActionInstant.pkg | ||
CCActionInterval.pkg | ||
CCActionManager.pkg | ||
CCActionPageTurn3D.pkg | ||
CCActionProgressTimer.pkg | ||
CCActionTiledGrid.pkg | ||
CCAffineTransform.pkg | ||
CCAnimation.pkg | ||
CCAnimationCache.pkg | ||
CCApplication.pkg | ||
CCArray.pkg | ||
CCAtlasNode.pkg | ||
CCAutoreleasePool.pkg | ||
CCCamera.pkg | ||
CCCommon.pkg | ||
CCData.pkg | ||
CCDirector.pkg | ||
CCDrawingPrimitives.pkg | ||
CCEGLView.pkg | ||
CCGL.pkg | ||
CCGeometry.pkg | ||
CCIMEDelegate.pkg | ||
CCIMEDispatcher.pkg | ||
CCKeypadDelegate.pkg | ||
CCKeypadDispatcher.pkg | ||
CCLabelAtlas.pkg | ||
CCLabelBMFont.pkg | ||
CCLabelTTF.pkg | ||
CCLayer.pkg | ||
CCMenu.pkg | ||
CCMenuItem.pkg | ||
CCMotionStreak.pkg | ||
CCMutableArray.pkg | ||
CCMutableDictionary.pkg | ||
CCNode.pkg | ||
CCObject.pkg | ||
CCParallaxNode.pkg | ||
CCPointExtension.pkg | ||
CCProgressTimer.pkg | ||
CCProtocols.pkg | ||
CCRenderTexture.pkg | ||
CCRibbon.pkg | ||
CCScene.pkg | ||
CCScheduler.pkg | ||
CCSet.pkg | ||
CCSprite.pkg | ||
CCSpriteBatchNode.pkg | ||
CCSpriteFrame.pkg | ||
CCSpriteFrameCache.pkg | ||
CCSpriteSheet.pkg | ||
CCString.pkg | ||
CCTMXLayer.pkg | ||
CCTMXObjectGroup.pkg | ||
CCTMXTiledMap.pkg | ||
CCTMXXMLParser.pkg | ||
CCTextFieldTTF.pkg | ||
CCTexture2D.pkg | ||
CCTextureAtlas.pkg | ||
CCTextureCache.pkg | ||
CCTileMapAtlas.pkg | ||
CCTouch.pkg | ||
CCTouchDelegateProtocol.pkg | ||
CCTouchDispatcher.pkg | ||
CCTransition.pkg | ||
CCTransitionPageTurn.pkg | ||
CCTransitionRadial.pkg | ||
CCUserDefault.pkg | ||
Cocos2d.pkg | ||
README | ||
ccConfig.pkg | ||
ccTypes.pkg | ||
selector_protocol.pkg |
README
1. The usage of tolua++ You can use the command to generate the LuaCocos2d.cpp: tolua++.exe -tCocos2d -o LuaCocos2d.cpp Cocos2d.pkg 2. Modify the generated file After you run the command, the generated file under the directory the same as tolua++.exe. cocos2dx/lua_support/LuaCocos2d.cpp is generate by this way. But here are some differents between them, because tolua++.exe generates some error codes about the template. The errors are: ------------------------------------------------------------------------------------------- genereated code | correct code | ------------------------------------------------------------------------------------------- CCMutableArray<cocos2d::CCSpriteFrame*> | cocos2d::CCMutableArray<CCSpriteFrame*> | ------------------------------------------------------------------------------------------- CCMutableArray<cocos2d::CCFiniteTimeAction*> | cocos2d::CCMutableArray<CCFiniteTimeAction*>| -------------------------------------------------------------------------------------------- CCMutableArray<cocos2d::CCObject*> | cocos2d::CCMutableArray<CCObject*> | -------------------------------------------------------------------------------------------- Manually add tolua_get_cocos2d__CCLayer___CCNode__, otherwise layer.__CCNode__:fun call will failed /* get function: __CCNode__ of class cocos2d::CCLayer */ #ifndef TOLUA_DISABLE_tolua_get_cocos2d__CCLayer___CCNode__ static int tolua_get_cocos2d__CCLayer___CCNode__(lua_State* tolua_S) { cocos2d::CCLayer* self = (cocos2d::CCLayer*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__CCNode__'",NULL); #endif #ifdef __cplusplus tolua_pushusertype(tolua_S,(void*)static_cast<cocos2d::CCNode*>(self), "cocos2d::CCNode"); #else tolua_pushusertype(tolua_S,(void*)((cocos2d::CCNode*)self), "cocos2d::CCNode"); #endif return 1; } #endif //#ifndef TOLUA_DISABLE tolua_variable(tolua_S,"__CCNode__",tolua_get_cocos2d__CCLayer___CCNode__,NULL); 3. The regular to write .pkg 1) enum keeps the same 2) remove CC_DLL for the class defines, pay attention to multi inherites 3) remove inline keyword for declaration and implementation 4) remove public protect and private 5) remove the decalration of class member variable 6) keep static keyword 7) remove memeber functions that declared as private or protected