コード例 #1
0
ファイル: Room.cpp プロジェクト: MishMick/Scrabble
bool CRoom::init(int boardType)
{	
	m_IsLoaded = false;
	CGameScene* scene = CGameScene::Instance();
	m_Field = CField::create(boardType);
	m_Turn = RT_FIRST_PLAYER;
	m_Type = RT_ONE_COMPUTER;
	m_State = RS_NONE;
	m_OldState = RS_NONE;
	scene->addChild(m_Field);
	m_ScorePlayer_1 = 0;
	m_ScorePlayer_2 = 0;
	m_Stack = new CStack();
	//m_Stack->CreateStack();
	m_DeckPlayer_1 = CDeck::create();
	//m_DeckPlayer_1->FirstInitEmptyCells(m_Stack);
	scene->addChild(m_DeckPlayer_1, CGameScene::OVER_GUI_LAYER);
	//m_DeckPlayer_2 = CDeck::create();
	//m_DeckPlayer_2->FirstInitEmptyCells(m_Stack);
	//scene->addChild(m_DeckPlayer_2, CGameScene::OVER_GUI_LAYER);
	m_ScorePointer_1 = CScorePointer::create();
	m_Field->GetFieldSprite()->addChild(m_ScorePointer_1, CScorePointer::ACTIVE_LAYER);
	m_ScorePointer_2 = CScorePointer::create();
	m_Field->GetFieldSprite()->addChild(m_ScorePointer_2, CScorePointer::ACTIVE_LAYER);
	m_Button = CRoomButton::create();
	m_Button->retain();
    //	scene->addChild(m_Button,CGameScene::GUI_LAYER);
	m_Id = -1;
	m_PassInARowCount = 0;
	m_FirstPlayerName = "Player 1";
	m_SecondPlayerName = "Player 2";
	return true;
}
コード例 #2
0
ファイル: CGameLogo.cpp プロジェクト: jonesgithub/magicpet
CCScene* CGameLogo::scene()
{
    CGameScene * scene = NULL;
    do 
    {
        // 'scene' is an autorelease object
        scene = new CGameScene();
        scene->autorelease();
        CC_BREAK_IF(! scene);

        // 'layer' is an autorelease object
        CGameLogo *layer = CGameLogo::node();
        CC_BREAK_IF(! layer);

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

    // return the scene
    return scene;
}