当前位置: 首页>>代码示例>>C++>>正文


C++ CCNodeLoaderLibrary类代码示例

本文整理汇总了C++中CCNodeLoaderLibrary的典型用法代码示例。如果您正苦于以下问题:C++ CCNodeLoaderLibrary类的具体用法?C++ CCNodeLoaderLibrary怎么用?C++ CCNodeLoaderLibrary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CCNodeLoaderLibrary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);
	
    // デザインサイズの設定
    pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);

    CCSize frameSize = pEGLView->getFrameSize();

    std::vector<std::string> searchPath;

    if (frameSize.height > largeResource.size.height)
    {
        // iPad Retina用リソースを使用
        searchPath.push_back(xlargeResource.directory);
        pDirector->setContentScaleFactor(MIN(xlargeResource.size.height / designResolutionSize.height, xlargeResource.size.width / designResolutionSize.width));
    }
    else if (frameSize.height > smallResource.size.height)
    {
        // iPad用リソースを使用
        searchPath.push_back(largeResource.directory);
        pDirector->setContentScaleFactor(MIN(largeResource.size.height / designResolutionSize.height, largeResource.size.width / designResolutionSize.width));
    }
    else
    {
        // iPhone用リソースを使用
        searchPath.push_back(smallResource.directory);
        pDirector->setContentScaleFactor(MIN(smallResource.size.height / designResolutionSize.height, smallResource.size.width / designResolutionSize.width));
    }

    // リソースディレクトリを指定
    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);

    // turn on display FPS
    pDirector->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);

    // CocosBuilderのファイルを読み込みゲーム画面を生成する
    CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
    ccNodeLoaderLibrary->registerCCNodeLoader("GameLayer", GameLayerLoader::loader());
    CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary);
    CCNode* node = ccbReader->readNodeGraphFromFile("GameLayer.ccbi");
    ((GameLayer*)node)->setAnimationManager(ccbReader->getAnimationManager());

    // シーンを用意し、ゲーム画面を設置する
    CCScene* pScene = CCScene::create();
    if (node != NULL)
        pScene->addChild(node);
    ccbReader->release();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:shun-tak,项目名称:cocos2d-x-programming-guide,代码行数:60,代码来源:AppDelegate.cpp

示例2: GetMenuLoadingLayer

CMenuLoading* CMenuLoading::GetMenuLoadingLayer(cocos2d::CCScene* _pScene, int _iLevel, int _difficult, bool _bShop)
{
	AppDelegate::AudioStopBgm();
	CMenuLoading* pLayer = new CMenuLoading;
	pLayer->autorelease();
	pLayer->m_pScene		= _pScene;
	pLayer->m_iLevel		= _iLevel;
	pLayer->m_iDifficult	= _difficult;
	pLayer->m_bShop			= _bShop;

	CMainMenu::SetStatus(-1);

	CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
	ccNodeLoaderLibrary->registerCCNodeLoader("ccbLoadingMenu", ccbGameLoadingMenuLoader::loader());
	cocos2d::extension::CCBReader* ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
	pLayer->m_pNode = ccbReader->readNodeGraphFromFile("10.ccbi"/*, this*/);
	pLayer->m_pNode->setPosition(ccp(0,0));
	((ccbGameLoadingMenu*)pLayer->m_pNode)->setAnimationManager(ccbReader->getAnimationManager());
	((ccbGameLoadingMenu*)pLayer->m_pNode)->Appear();
	ccbReader->release();
	SetScale(pLayer->m_pNode);
	_pScene->addChild(pLayer->m_pNode, 21, 4);

	//SetScale(pLayer);
	_pScene->addChild(pLayer, 20, 3);

	CCLayerColor* pLayerColor = CCLayerColor::create(ccc4(20,20,20,255), 800, 480);
	SetScale(pLayerColor);
	_pScene->addChild(pLayerColor, 19, 2);
	//AppDelegate::AudioPlayEffect("MS/Sound/EfLoadingOpen.mp3");
	return pLayer;
}
开发者ID:bo-jwolf,项目名称:project,代码行数:32,代码来源:MenuLoading.cpp

示例3: openTest

void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * pCCNodeName, CCNodeLoader * pCCNodeLoader) {
    /* Create an autorelease CCNodeLoaderLibrary. */
    CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();

    ccNodeLoaderLibrary->registerCCNodeLoader("TestHeaderLayer", TestHeaderLayerLoader::loader());
    if(pCCNodeName != NULL && pCCNodeLoader != NULL) {
        ccNodeLoaderLibrary->registerCCNodeLoader(pCCNodeName, pCCNodeLoader);
    }

    /* Create an autorelease CCBReader. */
    cocos2d::extension::CCBReader * ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
    ccbReader->autorelease();

    /* Read a ccbi file. */
    // Load the scene from the ccbi-file, setting this class as
    // the owner will cause lblTestTitle to be set by the CCBReader.
    // lblTestTitle is in the TestHeader.ccbi, which is referenced
    // from each of the test scenes.
    CCNode * node = ccbReader->readNodeGraphFromFile(pCCBFileName, this);

    this->mTestTitleLabelTTF->setString(pCCBFileName);

    CCScene * scene = CCScene::create();
    if(node != NULL) {
        scene->addChild(node);
    }

    /* Push the new scene with a fancy transition. */
    ccColor3B transitionColor;
    transitionColor.r = 0;
    transitionColor.g = 0;
    transitionColor.b = 0;
    
    CCDirector::sharedDirector()->pushScene(CCTransitionFade::create(0.5f, scene, transitionColor));
}
开发者ID:vedi,项目名称:cocos2d-x,代码行数:35,代码来源:HelloCocosBuilderLayer.cpp

示例4: js_CocosBuilder_create

JSBool js_CocosBuilder_create(JSContext *cx, uint32_t argc, jsval *vp)
{
    
    CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
    
    ccNodeLoaderLibrary->registerCCNodeLoader("", JSLayerLoader::loader());
    
    cocos2d::extension::CCBReader * ret = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
    ret->autorelease();
    
    jsval jsret;
    if (ret) {
        js_proxy_t *proxy;
        JS_GET_PROXY(proxy, ret);
        if (proxy) {
            jsret = OBJECT_TO_JSVAL(proxy->obj);
        } else {
            // create a new js obj of that class
            proxy = js_get_or_create_proxy<cocos2d::extension::CCBReader>(cx, ret);
            jsret = OBJECT_TO_JSVAL(proxy->obj);
        }
    } else {
        jsret = JSVAL_NULL;
    }
    JS_SET_RVAL(cx, vp, jsret);
    return JS_TRUE;
    
}
开发者ID:CodeSnooker,项目名称:cocos2d-x,代码行数:28,代码来源:js_bindings_ccbreader.cpp

示例5:

CCNodeLoaderLibrary * CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary() {
    CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::library();
    
    ccNodeLoaderLibrary->registerDefaultCCNodeLoaders();

    return ccNodeLoaderLibrary;
}
开发者ID:0309,项目名称:cocos2d-x,代码行数:7,代码来源:CCNodeLoaderLibrary.cpp

示例6: getMainScene

CCScene* MainScene::getMainScene() {
    CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();

    ccNodeLoaderLibrary->registerCCNodeLoader("MainScene", MainSceneLoader::loader());

    CCBReader *ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);

    return ccbReader->createSceneWithNodeGraphFromFile("ccb/MainScreen.ccbi");
}
开发者ID:KayLeung,项目名称:cocos2dx-store-example,代码行数:9,代码来源:MainScene.cpp

示例7: showFlower

void BaseBug::showFlower(){
    CCString filename = "flower-0.ccbi";
    CCNodeLoaderLibrary* loaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
    loaderLibrary->registerCCNodeLoader("CCParticleSystemQuad", CCParticleSystemQuadLoader::loader());
    cocos2d::extension::CCBReader* ccbReader = new cocos2d::extension::CCBReader(loaderLibrary);
    CCNode* node = ccbReader->readNodeGraphFromFile(filename.m_sString.c_str());
    CCParticleSystemQuad* emitter = (CCParticleSystemQuad*) node;
    this->addChild(emitter);
}
开发者ID:laogong5i0,项目名称:MiniGame,代码行数:9,代码来源:BaseBug.cpp

示例8: loadCustomParts

//---------------------------------------
//	カスタムクラスのパーツの取得(クラス名指定あり)
//---------------------------------------
CCNode* SceneChanger::loadCustomParts(const char* className, const char* fileName, CCNodeLoader* loader) {
    CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
    ccNodeLoaderLibrary->registerCCNodeLoader(className, loader);
    CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary);
    CCString* file = CCString::createWithFormat("%s.ccbi", fileName);
    CCNode* node = ccbReader->readNodeGraphFromFile(file->getCString());
    ccbReader->release();
    return node;
}
开发者ID:renowan,项目名称:Benkyo,代码行数:12,代码来源:SceneChanger.cpp

示例9: getStoreBScene

CCScene* StoreBScene::getStoreBScene() {
    CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();

    ccNodeLoaderLibrary->registerCCNodeLoader("StoreBScene", StoreBSceneLoader::loader());

    CCBReader *ccbReader = new CCBReader(ccNodeLoaderLibrary);
    ccbReader->retain();
    CCScene *pScene = ccbReader->createSceneWithNodeGraphFromFile("ccb/StoreBScene.ccbi");
    ccbReader->release();
    return pScene;
}
开发者ID:asmodehn,项目名称:cocos2dx-store-example,代码行数:11,代码来源:StoreBScene.cpp

示例10: LoadFromCCBI

// load ccnode from ccbi
CCNode* CCBLoaderManager::LoadFromCCBI(CCNodeLoader* loader, const char* className, const char* ccbFileName)
{
	CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
	ccNodeLoaderLibrary->registerCCNodeLoader(className, loader);
	CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary);
	std::string path = "ccbi/";
	path.append(ccbFileName);
	CCNode* node = ccbReader->readNodeGraphFromFile(path.c_str());
    delete ccbReader;
	return node;
}
开发者ID:JamShan,项目名称:xcode_jifengyongzhezhuan,代码行数:12,代码来源:CCBLoaderManager.cpp

示例11: createCCBreader

CCBReader* CCBProxy::createCCBreader()
{
    CCNodeLoaderLibrary *ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
    
    ccNodeLoaderLibrary->registerCCNodeLoader("", CCBLayerLoader::loader());
    
    CCBReader * pCCBReader = new CCBReader(ccNodeLoaderLibrary);
    pCCBReader->autorelease();
    
    return pCCBReader;
}
开发者ID:sdsgit,项目名称:cocos2d-x,代码行数:11,代码来源:CCBProxy.cpp

示例12: node

FruitObject* FruitObject::node(const char *ccbName,int color)
{
    CCNodeLoaderLibrary *nodeLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
    nodeLibrary->registerCCNodeLoader("FruitObject", FruitObjectLoader::loader());
    CCBReader *ccbReader = new CCBReader(nodeLibrary);
    FruitObject *node1 = (FruitObject *)ccbReader->readNodeGraphFromFile(ccbName);
    node1->color = color;
    node1->choose = false;
    
//    ccbReader->release();
    return node1;
}
开发者ID:shinsuo,项目名称:PracCococs2dX,代码行数:12,代码来源:FruitObject.cpp

示例13: GameLoadingSecond

void CGameControler::GameLoadingSecond()
{
	CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
	ccNodeLoaderLibrary->registerCCNodeLoader("ccbControlMenu", ccbControlMenuLoader::loader());
	cocos2d::extension::CCBReader* ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
	m_pMenuNode = ccbReader->readNodeGraphFromFile("6.ccbi"/*, this*/);
	m_pMenuNode->setPosition(ccp(0,0));
	//SetScale(m_pMenuNode);
	((ccbControlMenu*)m_pMenuNode)->setAnimationManager(ccbReader->getAnimationManager(), m_unLevel);
	ccbReader->release();
	addChild(m_pMenuNode, 4, 50);
}
开发者ID:bo-jwolf,项目名称:Graduation,代码行数:12,代码来源:GameControler.cpp

示例14: loaderBug

void BaseBug::loaderBug(CCPoint point){
    CCBAnimationManager* pAnimationManager = NULL;
    CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
    ccNodeLoaderLibrary->registerCCNodeLoader("BaseBugCCBI", BaseBugCCBILoader::loader());
    
    cocos2d::extension::CCBReader* ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
    CCNode* node = ccbReader->readNodeGraphFromFile(m_fileName.m_sString.c_str(), this, &pAnimationManager);
    ccbReader->autorelease();
    m_bug = (BaseBugCCBI*)node;
    m_bug->setAnimationManager(pAnimationManager);
    this->addChild(m_bug);
    
    
}
开发者ID:laogong5i0,项目名称:MiniGame,代码行数:14,代码来源:BaseBug.cpp

示例15: bomb

Bomb* Bomb::bomb()
{
    CCNodeLoaderLibrary *nodeLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
    nodeLibrary->registerCCNodeLoader("Bomb", BombLoader::loader());
    CCBReader *ccbReader = new CCBReader(nodeLibrary);
    Bomb *node = (Bomb *)ccbReader->readNodeGraphFromFile("ccb/bomb");
    ccbReader->getAnimationManager()->setAnimationCompletedCallback(node, callfunc_selector(Bomb::test));
    ccbReader->release();
    
//    CCBAnimationManager * ccbManager = (CCBAnimationManager *)node->getUserObject();
//    ccbManager->setAnimationCompletedCallback(node, callfunc_selector(Bomb::test));
    
    return node;
}
开发者ID:shinsuo,项目名称:PracCococs2dX,代码行数:14,代码来源:Bomb.cpp


注:本文中的CCNodeLoaderLibrary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。