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


C++ CCScene类代码示例

本文整理汇总了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;
}
开发者ID:antiwise,项目名称:chickencrossing-windows,代码行数:21,代码来源:EggScrambleModeLayer.cpp

示例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;
	}
}
开发者ID:beforeeight,项目名称:bump,代码行数:21,代码来源:MainLayer.cpp

示例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();
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:22,代码来源:LevelManager.cpp

示例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;
}
开发者ID:faransae,项目名称:Classes,代码行数:21,代码来源:RS_Main.cpp

示例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;
}
开发者ID:pototao,项目名称:DefenseTest,代码行数:21,代码来源:HelloWorldScene.cpp

示例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;

}
开发者ID:centurywar,项目名称:LHW,代码行数:21,代码来源:BaseLayer.cpp

示例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;
}
开发者ID:fU9ANg,项目名称:GLdemos,代码行数:21,代码来源:AppDelegate.cpp

示例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;
}
开发者ID:faransae,项目名称:Classes,代码行数:21,代码来源:MovieMenu.cpp

示例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));
	}

}
开发者ID:huanghuiquan,项目名称:TomAndJerry,代码行数:21,代码来源:StartMenu.cpp

示例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;
}
开发者ID:BGCX261,项目名称:zombieswarmer-svn-to-git,代码行数:21,代码来源:SwarmGame.cpp

示例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);
		}
	}
}
开发者ID:wanggan768q,项目名称:GameWork,代码行数:26,代码来源:HSGameShopLayer.cpp

示例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;
    }
}
开发者ID:ryanflees,项目名称:TileMapDemo,代码行数:22,代码来源:RCLoadingScene.cpp

示例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_);
				}
			}
		}
	}
开发者ID:OneGameAMonth,项目名称:Cocos2d-x,代码行数:22,代码来源:main.cpp

示例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;
}
开发者ID:sbc100,项目名称:OpenQuick,代码行数:23,代码来源:QTransition.cpp

示例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);
    }
}
开发者ID:hanxu101,项目名称:projectx,代码行数:22,代码来源:DirectBurn.cpp


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