mirror of https://github.com/axmolengine/axmol.git
modify the logic of "node" method
This commit is contained in:
parent
61ccb9f59e
commit
ed4e288f27
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
#include "CCTouchDispatcher.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CGPointExtension.h"
|
||||
namespace cocos2d {
|
||||
namespace cocos2d {
|
||||
|
||||
// CCLayer
|
||||
CCLayer::CCLayer()
|
||||
|
@ -43,30 +43,33 @@ CCLayer::~CCLayer()
|
|||
{
|
||||
}
|
||||
|
||||
bool CCLayer::init()
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
CCDirector * pDirector;
|
||||
CCX_BREAK_IF( ! (pDirector = CCDirector::getSharedDirector()) );
|
||||
this->setContentSize(pDirector->getWinSize());
|
||||
// success
|
||||
bRet = true;
|
||||
} while (0);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
CCLayer *CCLayer::node()
|
||||
{
|
||||
CCLayer *pRet = new CCLayer();
|
||||
if (pRet && pRet->init())
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
CCX_SAFE_DELETE(pRet)
|
||||
return NULL;
|
||||
bool CCLayer::init()
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
CCDirector * pDirector;
|
||||
CCX_BREAK_IF( ! (pDirector = CCDirector::getSharedDirector()) );
|
||||
this->setContentSize(pDirector->getWinSize());
|
||||
// success
|
||||
bRet = true;
|
||||
} while (0);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
CCLayer *CCLayer::node()
|
||||
{
|
||||
CCLayer *pRet = new CCLayer();
|
||||
if (pRet && pRet->init())
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
else
|
||||
{
|
||||
CCX_SAFE_DELETE(pRet)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/// Touch and Accelerometer related
|
||||
|
@ -415,4 +418,4 @@ void CCMultiplexLayer::switchToAndReleaseMe(unsigned int n)
|
|||
|
||||
this->addChild(m_pLayers->getObjectAtIndex(n));
|
||||
}
|
||||
}//namespace cocos2d
|
||||
}//namespace cocos2d
|
||||
|
|
|
@ -29,10 +29,10 @@ THE SOFTWARE.
|
|||
namespace cocos2d {
|
||||
|
||||
CCScene::CCScene()
|
||||
{
|
||||
m_bIsRelativeAnchorPoint = false;
|
||||
m_tAnchorPoint = ccp(0.5f, 0.5f);
|
||||
m_eSceneType = ccNormalScene;
|
||||
{
|
||||
m_bIsRelativeAnchorPoint = false;
|
||||
m_tAnchorPoint = ccp(0.5f, 0.5f);
|
||||
m_eSceneType = ccNormalScene;
|
||||
}
|
||||
|
||||
CCScene::~CCScene()
|
||||
|
@ -61,7 +61,10 @@ CCScene *CCScene::node()
|
|||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
CCX_SAFE_DELETE(pRet)
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
CCX_SAFE_DELETE(pRet)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}//namespace cocos2d
|
||||
|
|
Loading…
Reference in New Issue