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


C++ NodeLoaderLibrary类代码示例

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


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

示例1: openTest

void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * nodeName, NodeLoader * nodeLoader) {
    /* Create an autorelease NodeLoaderLibrary. */
    NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();

    ccNodeLoaderLibrary->registerNodeLoader("TestHeaderLayer", TestHeaderLayerLoader::loader());
    if(nodeName != nullptr && nodeLoader != nullptr) {
        ccNodeLoaderLibrary->registerNodeLoader(nodeName, nodeLoader);
    }

    /* Create an autorelease CCBReader. */
    cocosbuilder::CCBReader * ccbReader = new cocosbuilder::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.
    auto node = ccbReader->readNodeGraphFromFile(pCCBFileName, this);

    this->mTestTitleLabelTTF->setString(pCCBFileName);

    auto scene = Scene::create();
    if(node != nullptr) {
        scene->addChild(node);
    }

    /* Push the new scene with a fancy transition. */
    Color3B transitionColor;
    transitionColor.r = 0;
    transitionColor.g = 0;
    transitionColor.b = 0;
    
    Director::getInstance()->pushScene(TransitionFade::create(0.5f, scene, transitionColor));
}
开发者ID:AnySDK,项目名称:Sample_Lua,代码行数:35,代码来源:HelloCocosBuilderLayer.cpp

示例2:

NodeLoaderLibrary * NodeLoaderLibrary::newDefaultNodeLoaderLibrary() {
    NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::library();
    
    ccNodeLoaderLibrary->registerDefaultNodeLoaders();

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

示例3: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto eglView = EGLView::getInstance();

    director->setOpenGLView(eglView);
    
    // turn on display FPS
    director->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    director->setAnimationInterval(1.0 / 60);
    
    // create a scene. it's an autorelease object
    auto scene = Scene::create();
#if 0
    NodeLoaderLibrary *pLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
    CCBReader *ccbReader = new CCBReader(pLoaderLibrary);
    pLoaderLibrary->registerNodeLoader("plane_figtht_main", XCMainMenuLoader::loader());
    Node *pMainMenu = ccbReader->readNodeGraphFromFile("ccb/ccbi/plane_fight_main.ccbi");
    dynamic_cast<XCMainMenu*>(pMainMenu)->setAnimationManager(ccbReader->getAnimationManager());
    dynamic_cast<XCMainMenu*>(pMainMenu)->initPlaneMain();
    ccbReader->release();
    scene->addChild(pMainMenu); 
#else
    
#endif
    
    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:jiatuhao,项目名称:coco2dx3.0,代码行数:33,代码来源:AppDelegate.cpp

示例4: createScene

Scene* MainMenu::createScene()
{
    
    auto scene = Scene::create();
    
    
    /* Create an autorelease NodeLoaderLibrary. */
    NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
    ccNodeLoaderLibrary->registerNodeLoader("MainMenu", MainMenuLoader::loader());
    
    /* Create an autorelease CCBReader. */
    cocosbuilder::CCBReader * ccbReader = new cocosbuilder::CCBReader(ccNodeLoaderLibrary);
    ccbReader->autorelease();
    
    /* Read a ccbi file. */
    auto node = ccbReader->readNodeGraphFromFile("MainMenu.ccbi");
    
    
    if(node != NULL) {
        scene->addChild(node);
    }
    
//    ccbReader->release();
    
    return scene;
}
开发者ID:solkar,项目名称:LD29,代码行数:26,代码来源:MainMenu.cpp

示例5: js_CocosBuilder_create

JSBool js_CocosBuilder_create(JSContext *cx, uint32_t argc, jsval *vp)
{
    
	NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();
    
    ccNodeLoaderLibrary->registerNodeLoader("", JSLayerLoader::loader());
    
    CCBReader * ret = new CCBReader(ccNodeLoaderLibrary);
    ret->autorelease();
    
    jsval jsret;
    if (ret) {
        js_proxy_t *proxy = jsb_get_native_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<CCBReader>(cx, ret);
            jsret = OBJECT_TO_JSVAL(proxy->obj);
        }
    } else {
        jsret = JSVAL_NULL;
    }
    JS_SET_RVAL(cx, vp, jsret);
    return JS_TRUE;
    
}
开发者ID:CryQ,项目名称:coclua,代码行数:27,代码来源:js_bindings_ccbreader.cpp

示例6: CCBReader

CCScene* MainScene::getMainScene() {
    NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::sharedNodeLoaderLibrary();

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

    CCBReader *ccbReader = new CCBReader(ccNodeLoaderLibrary);

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

示例7:

SettingsDialog *SettingsDialog::createFromCCB()
{
	NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();

	ccNodeLoaderLibrary->registerNodeLoader("SettingsDialog", SettingsDialogLoader::loader());

	spritebuilder::CCBReader *ccbReader = new spritebuilder::CCBReader(ccNodeLoaderLibrary);

	return dynamic_cast<SettingsDialog*>(ccbReader->readNodeGraphFromFile("SettingsDialog.ccbi"));
}
开发者ID:eiji11,项目名称:clear-graffiti,代码行数:10,代码来源:SettingsDialog.cpp

示例8: CCBReader

CCBReader* CCBProxy::createCCBReader()
{
    NodeLoaderLibrary *ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();
    
    ccNodeLoaderLibrary->registerNodeLoader("", CCBLayerLoader::loader());
    
    CCBReader * pCCBReader = new CCBReader(ccNodeLoaderLibrary);
    pCCBReader->autorelease();
    
    return pCCBReader;
}
开发者ID:Ratel13,项目名称:HXGame,代码行数:11,代码来源:CCBProxy.cpp

示例9:

USE_NS

HowToPlayScene *HowToPlayScene::createFromCCB()
{
	NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();

	ccNodeLoaderLibrary->registerNodeLoader("HowToPlayScene", HowToPlaySceneLoader::loader());

	spritebuilder::CCBReader *ccbReader = new spritebuilder::CCBReader(ccNodeLoaderLibrary);

	return dynamic_cast<HowToPlayScene*>(ccbReader->readNodeGraphFromFile("HowToPlayScene.ccbi"));
}
开发者ID:eiji11,项目名称:clear-graffiti,代码行数:12,代码来源:HowToPlayScene.cpp

示例10:

USE_NS

ShopDialogEntry *ShopDialogEntry::createFromCCB()
{
	NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();

	ccNodeLoaderLibrary->registerNodeLoader("ShopDialogEntry", ShopDialogEntryLoader::loader());

	spritebuilder::CCBReader *ccbReader = new spritebuilder::CCBReader(ccNodeLoaderLibrary);

	return dynamic_cast<ShopDialogEntry*>(ccbReader->readNodeGraphFromFile("ShopDialogEntry.ccbi"));
}
开发者ID:eiji11,项目名称:clear-graffiti,代码行数:12,代码来源:ShopDialogEntry.cpp

示例11:

USE_NS

AboutMenu *AboutMenu::createFromCCB()
{
	NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();

	ccNodeLoaderLibrary->registerNodeLoader("AboutMenu", AboutMenuLoader::loader());

	spritebuilder::CCBReader *ccbReader = new spritebuilder::CCBReader(ccNodeLoaderLibrary);

	return dynamic_cast<AboutMenu*>(ccbReader->readNodeGraphFromFile("AboutMenu.ccbi"));
}
开发者ID:eiji11,项目名称:clear-graffiti,代码行数:12,代码来源:AboutMenu.cpp

示例12: CCLOG

void LiquidScene::tappedPreviousButton(Object* pSender, Control::EventType pControlEventType)
{
    CCLOG("tappedPreviousButton eventType = %d", pControlEventType);
    NodeLoaderLibrary* nodeLoaderLibrary = NodeLoaderLibrary::getInstance();
    nodeLoaderLibrary->registerNodeLoader("OpeningLayer", OpeningLayerLoader::loader());
    CCBReader* ccbReader = new CCBReader(nodeLoaderLibrary);
    Node* node = ccbReader->readNodeGraphFromFile("Opening.ccbi");
    Scene* scene = Scene::create();
    if (node != NULL)
    {
        scene->addChild(node);
    }
    ccbReader->release();
    Director::getInstance()->replaceScene(scene);
}
开发者ID:kosakasakas,项目名称:2DPhys,代码行数:15,代码来源:LiquidScene.cpp

示例13:

CCBLayer *CCBHelper::createCCBLayer(cocosbuilder::NodeLoader * nodeLoader,
									const char *className,
									const char *ccbFileName,
									Object* pOwner)
{
	NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
    ccNodeLoaderLibrary->registerNodeLoader(className, nodeLoader);
	
    /* Create an autorelease CCBReader. */
    cocosbuilder::CCBReader * ccbReader = new cocosbuilder::CCBReader(ccNodeLoaderLibrary);
    
    /* Read a ccbi file. */
    CCBLayer *layer = (CCBLayer *) ccbReader->readNodeGraphFromFile(ccbFileName, pOwner);
    
    ccbReader->release();
	
	return layer;
}
开发者ID:tklee1975,项目名称:ccx3-game,代码行数:18,代码来源:CCBHelper.cpp

示例14: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto eglView = EGLView::getInstance();

    director->setOpenGLView(eglView);

    // turn on display FPS
    director->setDisplayStats(false);

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

    // create a scene. it's an autorelease object
    //auto scene = HelloWorld::createScene();

    // とりあえずiPhone4S以上対応なので解像度系はiphone5で対応
    Resource res  = iphone5;
    std::vector<std::string> searchPath;
    searchPath.push_back(res.directory);
    auto fileutil = FileUtils::getInstance();
    fileutil->setSearchResolutionsOrder(searchPath);
    eglView->setDesignResolutionSize(res.size.width, res.size.height, ResolutionPolicy::FIXED_WIDTH);
    director->setContentScaleFactor(res.scaleFactor);

    // ccbiのロード
    NodeLoaderLibrary* nodeLoaderLibrary = NodeLoaderLibrary::getInstance();
    nodeLoaderLibrary->registerNodeLoader("OpeningLayer", OpeningLayerLoader::loader());
    CCBReader* ccbReader = new CCBReader(nodeLoaderLibrary);
    Node* node = ccbReader->readNodeGraphFromFile("Opening.ccbi");
    Scene* scene = Scene::create();
    if (node != NULL)
    {
        scene->addChild(node);
    }
    ccbReader->release();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:kosakasakas,项目名称:2DPhys,代码行数:42,代码来源:AppDelegate.cpp

示例15: runThisTest

void CocosBuilderTestScene::runThisTest() {
    /* Create an autorelease NodeLoaderLibrary. */
    NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
    
    ccNodeLoaderLibrary->registerNodeLoader("HelloCocosBuilderLayer", HelloCocosBuilderLayerLoader::loader());

    /* Create an autorelease CCBReader. */
    cocosbuilder::CCBReader * ccbReader = new cocosbuilder::CCBReader(ccNodeLoaderLibrary);
    
    /* Read a ccbi file. */
    auto node = ccbReader->readNodeGraphFromFile("ccb/HelloCocosBuilder.ccbi", this);
    
    ccbReader->release();

    if(node != NULL) {
        this->addChild(node);
    }

    Director::getInstance()->replaceScene(this);
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:20,代码来源:CocosBuilderTest.cpp


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