コード例 #1
0
ファイル: GameScene.cpp プロジェクト: weimingtom/gomoku_1_0
CCScene* GameLayer::scene(bool isBlackStart)
{
    // 'scene' is an autorelease object
    CCScene *scene = CCScene::create();
    
    // 'layer' is an autorelease object
    GameLayer *layer = GameLayer::create();
    layer->startGame(isBlackStart);

    // add layer as a child to scene
    scene->addChild(layer);

    // return the scene
    return scene;
}
コード例 #2
0
ファイル: Game.cpp プロジェクト: Stals/TilesFight
void Game::starNewGame(Player* player1, Player* player2, bool restart)
{
    CCScene *pScene = GameLayer::scene();
    GameLayer* gameLayer = (GameLayer*)pScene->getChildByTag(1337);
    
    if(!restart) {
        addPlayer(player1);
        addPlayer(player2);
    }
    gameLayer->startGame(player1, player2);
    
    if(CCDirector::sharedDirector()->getRunningScene()){
        CCDirector::sharedDirector()->replaceScene(pScene);
    }else{
        CCDirector::sharedDirector()->runWithScene(pScene);
    }
    
    setCurrentScreen(GAME_SCREEN);
    currentGameType = player2->isAI() ? VS_AI : VS_HUMAN;
}