本文整理汇总了C++中CCScene类的典型用法代码示例。如果您正苦于以下问题:C++ CCScene类的具体用法?C++ CCScene怎么用?C++ CCScene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCScene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scene
CCScene* EggScrambleModeLayer::scene(int levelNumber)
{
CCScene * scene = NULL;
do
{
// 'scene' is an autorelease object
scene = CCScene::create();
CC_BREAK_IF(! scene);
// 'layer' is an autorelease object
GameLayer *layer = EggScrambleModeLayer::create(levelNumber);
CC_BREAK_IF(! layer);
layer->setName("GameLayer");
// add layer as a child to scene
scene->addChild(layer);
} while (0);
// return the scene
return scene;
}
示例2:
CCScene * MainLayer::scene()
{
CCScene *scene = CCScene::create();
if (scene && scene->init())
{
if (scene)
{
/*-- 背景 --*/
CCLayer *bgLayer = BgLayer::create();
scene->addChild(bgLayer);
MainLayer *layer = MainLayer::create();
scene->addChild(layer);
}
return scene;
}
else
{
CC_SAFE_DELETE(scene);
return NULL;
}
}
示例3: LoadingLayer
//section被选中之后
void LevelManager::sectionSelected(int sectionId,CCPoint sectionPos)
{
m_iLastSectionId = sectionId;
CCUserDefault::sharedUserDefault()->setIntegerForKey(CCString::createWithFormat("Last_season%d_seation", m_iLastSeasonId)->getCString(), m_iLastSectionId);
CCUserDefault::sharedUserDefault()->flush();
//// 隐藏
//SectionSelectorLayer::getCurrentInstance()->setVisible(false);
//MaskLayer::getCurrentInsstance()->setVisible(false);
// SectionSelectorLayer::getCurrentInstance()->removeFromParentAndCleanup(true);
// MaskLayer::getCurrentInsstance()->removeFromParentAndCleanup(true);
CCDirector::sharedDirector()->getRunningScene()->removeAllChildren();
LoadingLayer* layer = new LoadingLayer(Intent_Section2GameIn,m_iLastSeasonId);
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
pScene->addChild(layer);
layer->release();
}
示例4: scene
CCScene* RS_Main::scene(int nGameLevel)
{
CCScene * scene = NULL;
do
{
// 'scene' is an autorelease object
scene = CCScene::create();
CC_BREAK_IF(! scene);
// 'layer' is an autorelease object
RS_Main *layer = RS_Main::create(nGameLevel);
CC_BREAK_IF(! layer);
// add layer as a child to scene
scene->addChild(layer);
} while (0);
// return the scene
return scene;
}
示例5:
CCScene*HelloWorld::scene()
{
// 'scene' is an autorelease object.
CCScene *scene =CCScene::create();
// 'layer' is an autorelease object.
HelloWorld *layer =HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer,1);
GameHUD * gameHUD = GameHUD::sharedHUD();
scene->addChild(gameHUD,2);
DataModel *m = DataModel::getModel();
m->setGameLayer(layer);
m->setGameHUDLayer(gameHUD);
// return the scene
return scene;
}
示例6: baseSwitheScene
CCScene* baseSwitheScene(int layerId)
{
CCScene * pScene = CCScene::create();
CCLayer *payler = NULL;
switch (layerId) {
case 1:
payler = new ViewMainLayer();
break;
case 2:
payler = new ViewListLayer();
break;
default:
break;
}
payler->autorelease();
pScene->addChild(payler);
return pScene;
// CCDirector::sharedDirector()->runWithScene(pScene);
// return;
}
示例7: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
// 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);
// create a scene. it's an autorelease object
CCScene *pScene = new PuzzleScene;
pScene->init();
// run
pDirector->runWithScene(pScene);
return true;
}
示例8: scene
CCScene* MovieMenu::scene()
{
CCScene * scene = NULL;
do
{
// 'scene' is an autorelease object
scene = CCScene::create();
CC_BREAK_IF(! scene);
// 'layer' is an autorelease object
MovieMenu *layer = MovieMenu::create();
CC_BREAK_IF(! layer);
// add layer as a child to scene
scene->addChild(layer);
} while (0);
// return the scene
return scene;
}
示例9: if
void StartMenu::menuCallback(CCObject* pSender)
{
int tag = dynamic_cast<CCNode*>(pSender)->getTag();
if(tag == 0){
CCScene *scene = CCScene::create();
scene->addChild(GameLayer::create());
CCDirector::sharedDirector()->replaceScene(CCTransitionMoveInR::transitionWithDuration(1.2,scene));
}
else if (tag == 1) {
CCScene *scene = Options::scene();
CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(1.2, scene));
}
else if(tag == 2)
{
CCDirector::sharedDirector()->end();
//CCScene *scene = About::scene();
//CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(1.2, scene));
}
}
示例10: scene
cocos2d::CCScene* SwarmGame::scene()
{
CCScene * scene = NULL;
do /* enclose the body in a 'break-able' closure */
{
// 'scene' is an autorelease object
scene = CCScene::node();
CC_BREAK_IF(! scene);
// 'layer' is an autorelease object
SwarmGame* layer = SwarmGame::node();
CC_BREAK_IF(! layer);
// add layer as a child to scene
scene->addChild(layer);
} while (0);
// return the scene
return scene;
}
示例11: Shop_FlyIn
void HSGameShopLayer::setVisible(bool visible)
{
#define HS_Shop_Tag 0x75699
CCLayer::setVisible(visible);
if(visible)
{
Shop_FlyIn(*m_p_shop_frame,m_shop_frame_Position);
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
if (!pScene->getChildByTag(HS_Shop_Tag))
{
pScene->addChild(this,HS_Shop_Tag,HS_Shop_Tag);
}
}
else
{
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
if (pScene->getChildByTag(HS_Shop_Tag))
{
pScene->removeChildByTag(HS_Shop_Tag);
}
}
}
示例12: switch
void RCLoadingScene::playNextScene()
{
// CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Imagesetfile/mainScene1.plist");
// CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Imagesetfile/mainScene2.plist");
// CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Imagesetfile/mainScene3.plist");
// CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Imagesetfile/mainScene4.plist");
// RCSceneManager::sharedSceneManager()->switchToOnePieceGameScene();
switch (m_loadingSceneTag) {
case kLoadingGameScene:
{
CCScene* scene = CCScene::create();
RCGameScene* node = RCGameScene::create();
scene->addChild(node);
CCDirector::sharedDirector()->replaceScene(scene);
node->addTileMap(m_tileMapName.c_str());
}
break;
default:
break;
}
}
示例13: Java_org_cocos2dx_hellocpp_HelloCpp_keyReleased
void Java_org_cocos2dx_hellocpp_HelloCpp_keyReleased(JNIEnv* env, jobject thiz, jint player, jint keyCode)
{
CCDirector *pDirector = CCDirector::sharedDirector();
if(pDirector != NULL)
{
CCScene *scene = pDirector->getRunningScene();
if(scene != NULL)
{
Game* layer = (Game*)scene->getChildByTag(1001);
if(layer != NULL)
{
layer->keyControllerReleased(player, keyCode);
}
else
{
CCDirector *pDirector = CCDirector::sharedDirector();
CCScene *scene_ = Game::scene();
pDirector->replaceScene(scene_);
}
}
}
}
示例14: initScenes
//------------------------------------------------------------------------------
bool initScenes(CCScene * pScene, CCScene** inScene, CCScene ** outScene)
{
CCAssert(pScene != NULL, "Argument scene must be non-nil");
CCScene * pOutScene = (CCScene*)CCDirector::sharedDirector()->getNotificationNode();
if (pOutScene == NULL)
{
pOutScene = CCScene::create();
pOutScene->init();
pOutScene->onEnter();
}
pOutScene->retain();
pScene->retain();
CCAssert(pScene != pOutScene, "Incoming scene must be different from the outgoing scene");
*inScene = pScene;
*outScene = pOutScene;
return true;
}
示例15: FireBall
void DirectBurn::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
if (UiManager::Singleton().IsInUi())
return;
CCSetIterator iter = pTouches->begin();
for (; iter != pTouches->end(); iter++)
{
CCTouch* pTouch = (CCTouch*)(*iter);
CCPoint touchPos = pTouch->getLocation();
m_fireBall = new FireBall();
m_fireBall->setPosition(touchPos);
m_fireBall->SetCanDirectBurn(true);
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
pScene->addChild(m_fireBall);
m_pStreak = CCMotionStreak::create(1.0f, 3.0f, 10.0f, ccWHITE, "streak.png");
pScene->addChild(m_pStreak);
}
}