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


C++ MainScene类代码示例

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


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

示例1: MainScene

MainScene* MainScene::Create()
{
	MainScene* scene = new MainScene();
	scene->Init();

	return scene;
}
开发者ID:Jenovez,项目名称:Frame2D-old,代码行数:7,代码来源:MainScene.cpp

示例2: while

void IPadSprite::ccTouchEnded(CCTouch* touch, CCEvent* event)
{
	CCNode* pNode = this->getParent();
	CCNode* pNode1 = this;
	while(pNode->getParent() != NULL)
	{
		pNode1 = pNode;
		pNode = pNode->getParent();
	}
	MainScene* pScene = dynamic_cast<MainScene*>(pNode1);
	if(pScene)
	{
		pScene->hideMenu();
	}
	
	MS5Layer* pLayer = dynamic_cast<MS5Layer*>(this->getParent());
	if(pLayer)
		pLayer->hidePopupPanel();
		
	this->setIsVisible(false);
	pNode = this->getParent();
	pNode = pNode->getParent();
	
	if(pNode->getChildByTag(TAG_IPAD_BIG) == NULL)
	{
		ScaleSprite* pSprite = ScaleSprite::scaleSpriteWithFile("ipad_big.png");
		pSprite->setTag(TAG_IPAD_BIG);
		pSprite->setScale(0.24f);
		pSprite->setPosition( ccp(855, 420) );
		pNode->addChild(pSprite, 2);
		pSprite->startScale();
	}
} 
开发者ID:chenyufeng,项目名称:QATDemo-chinese,代码行数:33,代码来源:IPadSprite.cpp

示例3: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	MainScene mainScene;
	if (!mainScene.initialize())return -1;

	mainScene.exec();

	return 0;
}
开发者ID:rucm,项目名称:tetris,代码行数:9,代码来源:main.cpp

示例4: onEnter

void ForwardLayer::onEnter(){
	Layer::onEnter();
	Size size = Director::getInstance()->getVisibleSize();
	Vec2 origen =  Director::getInstance()->getVisibleOrigin();
	showsorce = cursorce;
	label = Label::createWithBMFont("futura-48.fnt",StringUtils::format("%dkb/s",showsorce));
	label->setColor(cocos2d::Color3B::YELLOW);
	label->setPosition(size.width-100,size.height-20);
	this->addChild(label);
    ///////////////////////////
	MainScene *scene = dynamic_cast<MainScene *>(Director::getInstance()->getRunningScene());
	auto layer = dynamic_cast<TouchLayer *>(scene->getChildByName("touchlayer"));
	////////////////////暂停VS开始///////////////////////
	auto item1 = MenuItemImage::create();
	item1->setName("itme1");
	item1->setNormalImage(Sprite::create("qianlei.png"));
	auto item2 = MenuItemImage::create();
	item2->setName("itme2");
	item2->setNormalImage(Sprite::create("light_skill.png"));
	MenuItemToggle*tog = MenuItemToggle::createWithCallback([=](Ref *sender){
		auto m = dynamic_cast<MenuItemToggle*>(sender);
		auto n =  m->getSelectedItem();
		auto im  = dynamic_cast<MenuItemImage*>(n);
		if (im->getName()=="itme2")
		{
            layer->setTouchStop(true);
			Director::getInstance()->pause();
			///暂停音效//////////////////////////////////////////////////////////////////////////////////
			SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
			auto menulayer = MemuLayer::create();
			menulayer->setName("layer");
			scene->addChild(menulayer,100);
		}
		if (im->getName()=="itme1")
		{
			//开始
			Director::getInstance()->resume();
			//回复触摸
			layer->setTouchStop(false);
			//开始音效///////////////////////////////////////////////////////////////////////////////////
			SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
			//移除菜单
			scene->removeChildByName("layer");
			/*layer->setTouchStop(true);
			Director::getInstance()->pause();
			///暂停音效//////////////////////////////////////////////////////////////////////////////////
			SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
			MainScene *sne = dynamic_cast<MainScene *>(Director::getInstance()->getRunningScene());
			auto menulayer = MemuLayer::create();
			menulayer->setName("layer");
			sne->addChild(menulayer);*/
		}
	},item1,item2,NULL);
	Menu *mu = Menu::create(tog,NULL);
	mu->setPosition(size.width-110,origen.y+30);
	this->addChild(mu);
}
开发者ID:joyfish,项目名称:TowerTD,代码行数:57,代码来源:ForwardLayer.cpp

示例5: onYesPressed

void PauseLayer::onYesPressed(CCObject* sender) {
  MainScene* scene = (MainScene*)this->getParent();
  scene->setPause(false);
  this->removeFromParentAndCleanup(true);
  if (_state == PauseLayerStateConfirmReplay) {
    this->replayButtonPressed(NULL);
  } else if (_state == PauseLayerStateConfirmTitle) {
    this->titleButtonPressed(NULL);
  }
}
开发者ID:KiRiN,项目名称:VOXCHRONICLE,代码行数:10,代码来源:PauseLayer.cpp

示例6: onTouchMoved

void MainLayer::onTouchMoved(Touch *pTouch, Event *pEvent)
{
        //    const CCPoint deltaPosition = pTouch->getDelta();
        //    BaseLayer::onTouchMoved(pTouch, pEvent);
    BaseScene* baseScene = static_cast<BaseScene*>(Director::getInstance()->getRunningScene());
    if( baseScene->GetSceneType() == SceneType_MainScene )
    {
        MainScene* mainScene = static_cast<MainScene*>(baseScene);
        mainScene->OnTouchMove();
    }
    
}
开发者ID:Sinhyub,项目名称:silhouette,代码行数:12,代码来源:MainLayer.cpp

示例7: setData

bool LevelTreeModel::setData(const QModelIndex &index, const QVariant &value, int role)
{

    if(index.isValid() && (role == Qt::DisplayRole || role == Qt::EditRole)) {
        MainScene *scene = static_cast<MainScene*>(itemFromIndex (index));
        scene->setName(value.toString());
        QModelIndex topLeft = index;
        QModelIndex bottomRight = index;
        emit dataChanged(topLeft, bottomRight);
        return true;
    }
    return false;
}
开发者ID:jreuss,项目名称:tudimapper,代码行数:13,代码来源:leveltreemodel.cpp

示例8: onTouchBegan

bool MainLayer::onTouchBegan(Touch *pTouch, Event *pEvent)
{
        //    BaseLayer::onTouchBegan(pTouch, pEvent);
    
    BaseScene* baseScene = static_cast<BaseScene*>(Director::getInstance()->getRunningScene());
    if( baseScene->GetSceneType() == SceneType_MainScene )
    {
        MainScene* mainScene = static_cast<MainScene*>(baseScene);
        mainScene->OnTouchBegin();
    }
    
    return true;
}
开发者ID:Sinhyub,项目名称:silhouette,代码行数:13,代码来源:MainLayer.cpp

示例9: MainScene

MainScene* MainScene::create()
{
   MainScene *pRet = new MainScene();
   if (pRet && pRet->init())
   {
      pRet->autorelease();
      return pRet;
   }
   else
   {
      CC_SAFE_DELETE(pRet);
      return NULL;
   }
}
开发者ID:ChaitanyaGP,项目名称:SensorTest,代码行数:14,代码来源:MainScene.cpp

示例10: main

int main(int argc, char** argv) {
	{
		Game g;
		if (g.init()) {
			MainScene main; 
			main.setIdentifier("mainScene");
			g.addScene(&main);
			g.setActiveScene("mainScene");
			g.start();
		}
	}
	//std::cin.get();
	return 0;
}
开发者ID:Nueard,项目名称:V64,代码行数:14,代码来源:main.cpp

示例11: createMainScene

CCScene* MainScene::createMainScene()
{
    CCScene* scene = new CCScene;
    
    MainScene* pPlayer = new MainScene;
    if (pPlayer && pPlayer->Init()==true)
    {
        pPlayer->autorelease();
        scene->addChild(pPlayer);
        return scene;
    }
    delete pPlayer;
    delete scene;
    return NULL;
}
开发者ID:cjlaaa,项目名称:testCCB,代码行数:15,代码来源:HelloWorldScene.cpp

示例12: MainScene

MainScene* MainScene::created()
{
	MainScene *pRet = new MainScene();
	if(pRet && pRet->init())
	{
		pRet->autorelease();
		return pRet;
	}
	else
	{
		delete pRet;
		pRet = nullptr;
		return nullptr;
	}
}
开发者ID:fengjun19999,项目名称:MyLua,代码行数:15,代码来源:MainScene.cpp

示例13: MainScene

MainScene *MainScene::create()
{
    MainScene *pRet = new MainScene();
    if (pRet && pRet->init())
    {
        pRet->autorelease();
        return pRet;
    } 
    else 
    { 
        delete pRet;
        pRet = NULL;
        return NULL;
    } 
}
开发者ID:studio501,项目名称:fiypig,代码行数:15,代码来源:MainScene.cpp

示例14: onTouchEnded

void MainLayer::onTouchEnded(Touch *pTouch, Event *pEvent)
{
        //    BaseLayer::onTouchEnded(pTouch, pEvent);
    
    const Point touchLocation = pTouch->getLocation();
    
    BaseScene* baseScene = static_cast<BaseScene*>(Director::getInstance()->getRunningScene());
    if( baseScene->GetSceneType() == SceneType_MainScene )
    {
        MainScene* mainScene = static_cast<MainScene*>(baseScene);
        mainScene->OnTouchEnd();
    }
    
    
}
开发者ID:Sinhyub,项目名称:silhouette,代码行数:15,代码来源:MainLayer.cpp

示例15: MainScene

//1920x1080
//1920x864
//960x432
CCScene* MainScene::scene()
{
    CCScene* pScene = CCScene::create();
    MainScene* uiLayer = new MainScene();
    if (uiLayer && uiLayer->init(pScene))
    {
        uiLayer->autorelease();
        pScene->addChild(uiLayer);
    }
    else
    {
        CC_SAFE_DELETE(uiLayer);
    }
    return pScene;
}
开发者ID:aababy,项目名称:Tool,代码行数:18,代码来源:MainScene.cpp


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