CCBReader* CCBProxy::createCCBReader() { CCNodeLoaderLibrary *ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary(); CCBReader * pCCBReader = new CCBReader(ccNodeLoaderLibrary); pCCBReader->autorelease(); return pCCBReader; }
CCBReader* CCBProxy::createCCBreader() { CCNodeLoaderLibrary *ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary(); ccNodeLoaderLibrary->registerCCNodeLoader("", CCBLayerLoader::loader()); CCBReader * pCCBReader = new CCBReader(ccNodeLoaderLibrary); pCCBReader->autorelease(); return pCCBReader; }
CCBReader* CCBProxy::createCCBReader() { NodeLoaderLibrary *ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance(); ccNodeLoaderLibrary->registerNodeLoader("", CCBLayerLoader::loader()); CCBReader * pCCBReader = new CCBReader(ccNodeLoaderLibrary); pCCBReader->autorelease(); return pCCBReader; }
//void MapMenu1Layer::tableCB( CCObject* pObject ) //{ // CCMenuItemImage *mi = (CCMenuItemImage*)pObject; // int tag = mi->getTag(); // switch (tag) { // case 1: // m_table1->setVisible(true); // m_table2->setVisible(false); // break; // case 2: // m_table1->setVisible(false); // m_table2->setVisible(true); // break; // default: // break; // } //} void MapMenu1Layer::loadCCBFile(int i) { CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary()->registerCCNodeLoader( "ReviewLayer", ReviewLayerLoader::loader()); CCBReader* reader = new CCBReader( CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary() ); reader->autorelease(); char str[255]; sprintf(str,"wkszReview/ReviewLayer%d.ccbi",i); CCNode* node = reader->readNodeGraphFromFile(str); this->getParent()->addChild(node); this->closeCB(NULL); }
MenuScene *MenuSceneLoader::load() { CCNodeLoaderLibrary *lib = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary(); lib->registerCCNodeLoader("MenuScene", MenuSceneLoader::loader()); CCBReader *reader = new CCBReader(lib); reader->autorelease(); CCNode *node = reader->readNodeGraphFromFile("MenuScene.ccbi"); return (MenuScene*)node; }
bool CPKDlg::init() { CCLayer::init(); m_pLeftPhoto = m_pRightPhoto = NULL ; m_pDelegate = NULL ; CCNodeLoaderLibrary* plib = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary(); CCBReader* pReader = new CCBReader(plib); CCNode* pnode = pReader->readNodeGraphFromFile("PkDlg.ccbi",this); pnode->setPosition(ccpMult(ccpFromSize(getContentSize()), 0.5)) ; addChild(pnode) ; m_pAnimate = pReader->getAnimationManager() ; m_pAnimate->setDelegate(this); pReader->autorelease() ; return true ; }
CCNode *CCBManage::loadCCB(const char * pCCBFileName, CCLayer * pCCLayer, const char * pCCNodeName, CCNodeLoader * pCCNodeLoader) { /* Create an autorelease CCNodeLoaderLibrary. */ CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary(); if(pCCNodeName != NULL && pCCNodeLoader != NULL) { ccNodeLoaderLibrary->registerCCNodeLoader(pCCNodeName, pCCNodeLoader); } /* Create an autorelease CCBReader. */ CCBReader *ccbReader = new 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. return ccbReader->readNodeGraphFromFile(pCCBFileName, pCCLayer); }
void NBGCCBReader::readCCB(const char * ccbiName) { releaseMembers(); /* Create an autorelease NodeLoaderLibrary. */ NodeLoaderLibrary* ccNodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary(); /* Create an autorelease CCBReader. */ CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary); ccbReader->setCCBRootPath(CCBRESOURCES_BASE_PATH); ccbReader->autorelease(); /* Read a ccbi file. */ m_pCCBNode = ccbReader->readNodeGraphFromFile(ccbiName, this); if (m_pCCBNode != nullptr) { m_pAnimationManager = ccbReader->getAnimationManager(); m_pAnimationManager->setDelegate(this); } CC_SAFE_RETAIN(m_pCCBNode); CC_SAFE_RETAIN(m_pAnimationManager); }
bool CSpriteObject::setSpriteFromCcbi(const char* name) { // Create auto-release node loader CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary(); // Create a CCBReader, auto release. CCBReader * ccbReader = new CCBReader(ccNodeLoaderLibrary); ccbReader->autorelease(); // Read a ccbi file, return a CCNode instance. setInnerSprite(dynamic_cast<CCSprite*>(ccbReader->readNodeGraphFromFile(name, this))); if (NULL == getInnerSprite()) { return false; } ccbReader->getAnimationManager()->setDelegate(this); setCCBReader(ccbReader); return true; }
bool js_CocosBuilder_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance(); ccNodeLoaderLibrary->registerNodeLoader("", JSLayerLoader::loader()); CCBReader * ret = new (std::nothrow) CCBReader(ccNodeLoaderLibrary); ret->autorelease(); jsval jsret; if (ret) { // create a new js obj of that class JS::RootedObject jsobj(cx, js_get_or_create_jsobject<cocosbuilder::CCBReader>(cx, ret)); jsret = OBJECT_TO_JSVAL(jsobj); } else { jsret = JSVAL_NULL; } args.rval().set(jsret); return true; }