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


C++ CCScene::visit方法代码示例

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


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

示例1: ScreenShoot

static CCString ScreenShoot()
{
	CCSize size = CCDirector::sharedDirector()->getWinSize();  
	//定义一个屏幕大小的渲染纹理  
	CCRenderTexture* pScreen = CCRenderTexture::create(size.width,size.height, kCCTexture2DPixelFormat_RGBA8888);  
	//获得当前的场景指针  
	CCScene* pCurScene = CCDirector::sharedDirector()->getRunningScene();  
	//渲染纹理开始捕捉  
	pScreen->begin();  
	//当前场景参与绘制  
	pCurScene->visit();  
	//结束捕捉  
	pScreen->end();  
	char szfile[1024]={0};
	//string   pathToSave = "/sdcard/download/";//

	string pathToSave = "ScreenShoot.png";
	//sprintf(szfile,"%s%s",pathToSave.c_str(),"share.png");
	//保存为png
	if(pScreen->saveToFile(pathToSave.c_str(), kCCImageFormatPNG))
	{
		//CCMessageBox("saveToFile ok!", "saveToFile ok!");
	}
	pathToSave = CCFileUtils::sharedFileUtils()->getWritablePath()+pathToSave;
	//保存为jpg
	//pScreen->saveToFile("XXXXXX.jpg", kCCImageFormatJPEG);  
	CC_SAFE_DELETE(pScreen); 

	return pathToSave.c_str();
}
开发者ID:FreeDao,项目名称:FaceBook-Working--FlappyBird,代码行数:30,代码来源:HelloWorldScene.cpp

示例2: initShareMessageBox

void AsMessageBox::initShareMessageBox(int subType){
    
    if(!MainUser->muted)
        CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("openFrame.wav");
    
    shareImageIndex = subType;
    
    //1.截屏
    if (subType == 1) {
        CCRenderTexture* pScreen = CCRenderTexture::create(winSize.width,winSize.height);
        CCScene* pCurScene = CCDirector::sharedDirector()->getRunningScene();
        pScreen->begin();
        pCurScene->visit();
        pScreen->end();
        pScreen->saveToFile("shared.png",kCCImageFormatPNG);
    }

    //2.黑色底层
    cover = CCLayerColor::create(ccc4(0,0,0,200));
    cover->setPosition(CCPointZero);
    addChild(cover,0);
    
    //3.提示框底层
    showbox = CCSprite::createWithSpriteFrameName("shareFrame.png");
    showbox->setScaleY(1.1);
    showbox->setPosition(ccp(size.width/2,size.height/2+winDif*2*alpha));
    cover->addChild(showbox,1);
    
    //4.提示框上的文字
    CCSprite* shareWeixinSprite = CCSprite::createWithSpriteFrameName("shareWeixin.png");
    CCSprite* shareWeixinSprite_s = CCSprite::createWithSpriteFrameName("shareWeixin-s.png");
    CCSprite* shareWeixin1Sprite = CCSprite::createWithSpriteFrameName("shareWeixin1.png");
    CCSprite* shareWeixin1Sprite_s = CCSprite::createWithSpriteFrameName("shareWeixin1-s.png");
    CCSprite* closeSprite = CCSprite::createWithSpriteFrameName("closeMatchTable.png");
    CCSprite* closeSprite_s = CCSprite::createWithSpriteFrameName("closeMatchTable-s.png");
    CCMenuItemSprite* closeItem = CCMenuItemSprite::create(closeSprite,closeSprite_s,this,menu_selector(AsMessageBox::closeMessageBox));
    CCMenuItemSprite* item1 = CCMenuItemSprite::create(shareWeixinSprite,shareWeixinSprite_s,this,menu_selector(AsMessageBox::goShare));
    CCMenuItemSprite* item2 = CCMenuItemSprite::create(shareWeixin1Sprite,shareWeixin1Sprite_s,this,menu_selector(AsMessageBox::goShare));
    item1->setTag(10);
    item2->setTag(11);
    item1->setPosition(ccp(size.width*18/50,size.height*10/20+winDif*2.18*alpha));
    item2->setPosition(ccp(size.width*32/50,size.height*10/20+winDif*2.18*alpha));
    closeItem->setPosition(ccp(size.width*5.7/7,size.height*11.5/20+winDif*2.18*alpha));
    closeMenu = CCMenu::create(item1,item2,closeItem,NULL);
    closeMenu->setPosition(CCPointZero);
    addChild(closeMenu,2);
    
    //5.文字提示
    CCLabelTTF* shareToIndiLabel = CCLabelTTF::create("分享给朋友","Arial Rounded MT Bold",24);
    CCLabelTTF* shareToCircleLabel = CCLabelTTF::create("分享到朋友圈","Arial Rounded MT Bold",24);
    shareToIndiLabel->setColor(ccc3(55, 55, 55));
    shareToCircleLabel->setColor(ccc3(55, 55, 55));
    shareToIndiLabel->setPosition(ccp(size.width*18/50,size.height*8/20+winDif*2.18*alpha));
    shareToCircleLabel->setPosition(ccp(size.width*32/50,size.height*8/20+winDif*2.18*alpha));
    addChild(shareToIndiLabel,7,53);
    addChild(shareToCircleLabel,7,54);
    
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:58,代码来源:Type3Share.cpp

示例3: hit

void Player::hit() {
    if (getSprite() == NULL) {
        return;
    }
	CCSize size = CCDirector::sharedDirector()->getWinSize();
    Config::isPause = true;
	CCRenderTexture* renderTexture = CCRenderTexture::create(size.width, size.height);
	CCScene* temp = CCDirector::sharedDirector()->getRunningScene();
	renderTexture->begin(); 
	temp->visit();
	renderTexture->end();
	CCDirector::sharedDirector()->pushScene(GamePause::scene(renderTexture));
//	if (m_scene != NULL) {
//		Config::score++;
//		m_scene->setScore();
//	}
}
开发者ID:Raymond-Wong,项目名称:Orbitum,代码行数:17,代码来源:Player.cpp


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