本文整理汇总了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));
}
示例2:
NodeLoaderLibrary * NodeLoaderLibrary::newDefaultNodeLoaderLibrary() {
NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::library();
ccNodeLoaderLibrary->registerDefaultNodeLoaders();
return ccNodeLoaderLibrary;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
示例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"));
}
示例8: CCBReader
CCBReader* CCBProxy::createCCBReader()
{
NodeLoaderLibrary *ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();
ccNodeLoaderLibrary->registerNodeLoader("", CCBLayerLoader::loader());
CCBReader * pCCBReader = new CCBReader(ccNodeLoaderLibrary);
pCCBReader->autorelease();
return pCCBReader;
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}