试用cocosbuilder

 Connecting with cocos2d-x

https://github.com/cocos2d/CocosBuilder/blob/develop/Documentation/4c.%20Connecting%20with%20cocos2d-x.md


如何获取cocosbuilder中的组件?

 

onAssignCCBMemberVariable回调成员变量

CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mBurstSprite", CCSprite *, this->mBurstSprite);
    CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mTestTitleLabelTTF", CCLabelTTF *, this->mTestTitleLabelTTF);

自定义属性

onAssignCCBCustomProperty回调成员变量
bool HelloCocosBuilderLayer::onAssignCCBCustomProperty(CCObject* pTarget, const char* pMemberVariableName, cocos2d::extension::CCBValue* pCCBValue)
{
    bool bRet = false;
    if (pTarget == this)
    {
        if (0 == strcmp(pMemberVariableName, "mCustomPropertyInt"))
        {
            this->mCustomPropertyInt = pCCBValue->getIntValue();
            CCLog("mCustomPropertyInt = %d", mCustomPropertyInt);
            bRet = true;
        }
        else if ( 0 == strcmp(pMemberVariableName, "mCustomPropertyFloat"))
        {
            this->mCustomPropertyFloat = pCCBValue->getFloatValue();
            CCLog("mCustomPropertyFloat = %f", mCustomPropertyFloat);
            bRet = true;
        }
        else if ( 0  == strcmp(pMemberVariableName, "mCustomPropertyBoolean"))
        {
            this->mCustomPropertyBoolean = pCCBValue->getBoolValue();
            CCLog("mCustomPropertyBoolean = %d", mCustomPropertyBoolean);
            bRet = true;
        }
        else if ( 0  == strcmp(pMemberVariableName, "mCustomPropertyString"))
        {
            this->mCustomPropertyString = pCCBValue->getStringValue();
            CCLog("mCustomPropertyString = %s", mCustomPropertyString.c_str());
            bRet = true;
        }
        
    }

    return bRet;
}


示例:

主页:

http://cocosbuilder.com/

源码:

https://github.com/cocos2d/CocosBuilder

cocos2d网站的分页:

http://www.cocos2d-iphone.org/forum/forum/16

作者做的使用例子:

http://code.zynga.com/2012/10/creating-a-game-with-cocosbuilder/

触控的一篇blog

http://blog.chukong-inc.com/index.php/2012/02/15/cocosbuiler%E4%BD%BF%E7%94%A8%E7%AE%80%E4%BB%8B%E5%BF%83%E5%BE%97/


问题:

1.只有MAC版本

2.关联自定义类后可以自定义属性?
http://cn.cocos2d-x.org/bbs/forum.php?mod=viewthread&tid=8794&extra=page%3D2
如果可以绑定类的话就可以实现:
    2.1 继承一个CCNode的播放声音模块
    2.2 继承一个CCNode的对话框模块
这样就可以基本满足cinematic的声音对话的要求。

3.v2.1支持bone动画,能支持plist动画么?
可以使用2的关联属性定义自己的CCSprite来播放动画。

4.直接拖入单图的话,引擎会自动扩展成2的幂,内存浪费,
使用plist里面集成在一张大图上的某个module。

5.如何解决屏幕尺寸适配问题?
所以位置和高宽 缩放都用相对值

你可能感兴趣的:(Module,扩展,引擎)