axmol/tools/tolua++
minggo 914706735f update LuaCocos2d.cpp and pkg files 2011-07-18 17:04:15 +08:00
..
CCAccelerometer.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCAccelerometerDelegate.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCAction.pkg to commit some pkg files 2011-07-08 18:31:02 +08:00
CCActionCamera.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCActionEase.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCActionGrid.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCActionGrid3D.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCActionInstant.pkg to commit some pkg files 2011-07-08 18:31:02 +08:00
CCActionInterval.pkg to commit the rest pkg files 2011-07-11 14:00:55 +08:00
CCActionManager.pkg to commit some pkg files 2011-07-08 18:31:02 +08:00
CCActionPageTurn3D.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCActionProgressTimer.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCActionTiledGrid.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCAffineTransform.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCAnimation.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCAnimationCache.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCApplication.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCArray.pkg to commit some pkg files 2011-07-08 18:31:02 +08:00
CCAtlasNode.pkg to commit some pkg files 2011-07-08 18:31:02 +08:00
CCAutoreleasePool.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCCamera.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCCommon.pkg issue #528: refactor ok on win32 2011-06-20 17:31:38 +08:00
CCData.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCDirector.pkg commit some pkg files 2011-07-08 22:32:54 +08:00
CCDrawingPrimitives.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCEGLView.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCGL.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCGeometry.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCIMEDelegate.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCIMEDispatcher.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCKeypadDelegate.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCKeypadDispatcher.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCLabelAtlas.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCLabelBMFont.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCLabelTTF.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCLayer.pkg commit some pkg files 2011-07-08 22:32:54 +08:00
CCMenu.pkg issue #528: refactor ok on win32 2011-06-20 17:31:38 +08:00
CCMenuItem.pkg fixed #611: add some functions for lua 2011-07-18 10:18:36 +08:00
CCMotionStreak.pkg commit some pkg files 2011-07-08 22:32:54 +08:00
CCMutableArray.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCMutableDictionary.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCNode.pkg fixed #612: export some CCNode methods to lua 2011-07-18 10:28:25 +08:00
CCObject.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCParallaxNode.pkg commit some pkg files 2011-07-08 22:32:54 +08:00
CCPointExtension.pkg commit some pkg files 2011-07-08 22:32:54 +08:00
CCProgressTimer.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCProtocols.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCRenderTexture.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCRibbon.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCScene.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCScheduler.pkg to commit the rest pkg files 2011-07-11 14:00:55 +08:00
CCSet.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCSprite.pkg to commit the rest pkg files 2011-07-11 14:00:55 +08:00
CCSpriteBatchNode.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCSpriteFrame.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCSpriteFrameCache.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCString.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCTMXLayer.pkg to commit the rest pkg files 2011-07-11 14:00:55 +08:00
CCTMXObjectGroup.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCTMXTiledMap.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCTMXXMLParser.pkg to commit the rest pkg files 2011-07-11 14:00:55 +08:00
CCTextFieldTTF.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCTexture2D.pkg to commit the rest pkg files 2011-07-11 14:00:55 +08:00
CCTextureAtlas.pkg to commit the rest pkg files 2011-07-11 14:00:55 +08:00
CCTextureCache.pkg to commit the rest pkg files 2011-07-11 14:00:55 +08:00
CCTileMapAtlas.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCTouch.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCTouchDelegateProtocol.pkg issue #528: refactor ok on win32 2011-06-20 17:31:38 +08:00
CCTouchDispatcher.pkg issue #528: refactor ok on win32 2011-06-20 17:31:38 +08:00
CCTransition.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCTransitionPageTurn.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCTransitionRadial.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
CCUserDefault.pkg add extensions & tools directory 2011-06-14 14:31:25 +08:00
Cocos2d.pkg update LuaCocos2d.cpp and pkg files 2011-07-18 17:04:15 +08:00
README fixed #528, Lua can get the CCTouch array in callback function; Add CCNode parent for CCLayer in LuaCocos2d.cpp, HelloLua can move the farm layer now. 2011-06-24 21:03:33 +08:00
ccConfig.pkg to update lua support 2011-07-12 15:18:14 +08:00
ccTypes.pkg to commit the rest pkg files 2011-07-11 14:00:55 +08:00
selector_protocol.pkg issue #528: refactor ok on win32 2011-06-20 17:31:38 +08:00
tolua++.rar.REMOVED.git-id fixed #589 2011-07-08 15:28:13 +08:00

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