本文整理汇总了C++中MainScene类的典型用法代码示例。如果您正苦于以下问题:C++ MainScene类的具体用法?C++ MainScene怎么用?C++ MainScene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MainScene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MainScene
MainScene* MainScene::Create()
{
MainScene* scene = new MainScene();
scene->Init();
return scene;
}
示例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();
}
}
示例3: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MainScene mainScene;
if (!mainScene.initialize())return -1;
mainScene.exec();
return 0;
}
示例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);
}
示例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);
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例9: MainScene
MainScene* MainScene::create()
{
MainScene *pRet = new MainScene();
if (pRet && pRet->init())
{
pRet->autorelease();
return pRet;
}
else
{
CC_SAFE_DELETE(pRet);
return NULL;
}
}
示例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;
}
示例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;
}
示例12: MainScene
MainScene* MainScene::created()
{
MainScene *pRet = new MainScene();
if(pRet && pRet->init())
{
pRet->autorelease();
return pRet;
}
else
{
delete pRet;
pRet = nullptr;
return nullptr;
}
}
示例13: MainScene
MainScene *MainScene::create()
{
MainScene *pRet = new MainScene();
if (pRet && pRet->init())
{
pRet->autorelease();
return pRet;
}
else
{
delete pRet;
pRet = NULL;
return NULL;
}
}
示例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();
}
}
示例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;
}