2012-03-26 16:46:23 +08:00
|
|
|
/****************************************************************************
|
2012-09-24 21:22:20 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2012-03-26 16:46:23 +08:00
|
|
|
Copyright (c) 2009 Lam Pham
|
|
|
|
Copyright (c) 2012 Ricardo Quesada
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#include "CCTransitionProgress.h"
|
|
|
|
#include "CCDirector.h"
|
2012-06-19 16:20:46 +08:00
|
|
|
#include "misc_nodes/CCRenderTexture.h"
|
|
|
|
#include "misc_nodes/CCProgressTimer.h"
|
2012-03-26 16:46:23 +08:00
|
|
|
#include "CCLayer.h"
|
2012-06-19 16:20:46 +08:00
|
|
|
#include "actions/CCActionInstant.h"
|
|
|
|
#include "actions/CCActionProgressTimer.h"
|
|
|
|
#include "support/CCPointExtension.h"
|
2012-03-26 16:46:23 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
|
|
|
enum {
|
2012-04-19 14:35:52 +08:00
|
|
|
kCCSceneRadial = 0xc001,
|
2012-03-26 16:46:23 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
CCTransitionProgress::CCTransitionProgress()
|
2012-06-15 15:10:40 +08:00
|
|
|
: m_fTo(0.0f)
|
|
|
|
, m_fFrom(0.0f)
|
|
|
|
, m_pSceneToBeModified(NULL)
|
2012-03-26 16:46:23 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-11-01 22:12:13 +08:00
|
|
|
CCTransitionProgress* CCTransitionProgress::create(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgress* pScene = new CCTransitionProgress();
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CCTransitionProgress* CCTransitionProgress::transitionWithDuration(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgress* pScene = new CCTransitionProgress();
|
|
|
|
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-03-26 16:46:23 +08:00
|
|
|
// CCTransitionProgress
|
|
|
|
void CCTransitionProgress::onEnter()
|
|
|
|
{
|
|
|
|
CCTransitionScene::onEnter();
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
setupTransition();
|
|
|
|
|
|
|
|
// create a transparent color layer
|
|
|
|
// in which we are going to add our rendertextures
|
2012-03-26 16:46:23 +08:00
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// create the second render texture for outScene
|
2012-06-14 15:13:16 +08:00
|
|
|
CCRenderTexture *texture = CCRenderTexture::create((int)size.width, (int)size.height);
|
2012-04-19 14:35:52 +08:00
|
|
|
texture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
|
|
|
|
texture->setPosition(ccp(size.width/2, size.height/2));
|
|
|
|
texture->setAnchorPoint(ccp(0.5f,0.5f));
|
2012-03-26 16:46:23 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// render outScene to its texturebuffer
|
|
|
|
texture->clear(0, 0, 0, 1);
|
|
|
|
texture->begin();
|
2012-06-15 15:10:40 +08:00
|
|
|
m_pSceneToBeModified->visit();
|
2012-04-19 14:35:52 +08:00
|
|
|
texture->end();
|
2012-03-26 16:46:23 +08:00
|
|
|
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// Since we've passed the outScene to the texture we don't need it.
|
2012-06-15 15:10:40 +08:00
|
|
|
if (m_pSceneToBeModified == m_pOutScene)
|
2012-03-26 16:46:23 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
hideOutShowIn();
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
// We need the texture in RenderTexture.
|
|
|
|
CCProgressTimer *pNode = progressTimerNodeWithRenderTexture(texture);
|
2012-03-26 16:46:23 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// create the blend action
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* layerAction = (CCActionInterval*)CCSequence::create(
|
2012-06-15 15:10:40 +08:00
|
|
|
CCProgressFromTo::create(m_fDuration, m_fFrom, m_fTo),
|
2012-06-14 15:13:16 +08:00
|
|
|
CCCallFunc::create(this, callfunc_selector(CCTransitionProgress::finish)),
|
2012-03-26 16:46:23 +08:00
|
|
|
NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
// run the blend action
|
|
|
|
pNode->runAction(layerAction);
|
2012-03-26 16:46:23 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// add the layer (which contains our two rendertextures) to the scene
|
|
|
|
addChild(pNode, 2, kCCSceneRadial);
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// clean up on exit
|
|
|
|
void CCTransitionProgress::onExit()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
// remove our layer and release all containing objects
|
|
|
|
removeChildByTag(kCCSceneRadial, false);
|
2012-03-26 16:46:23 +08:00
|
|
|
CCTransitionScene::onExit();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCTransitionProgress::sceneOrder()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
m_bIsInSceneOnTop = false;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCTransitionProgress::setupTransition()
|
|
|
|
{
|
2012-06-15 15:10:40 +08:00
|
|
|
m_pSceneToBeModified = m_pOutScene;
|
|
|
|
m_fFrom = 100;
|
|
|
|
m_fTo = 0;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CCProgressTimer* CCTransitionProgress::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCAssert(false, "override me - abstract class");
|
|
|
|
return NULL;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CCTransitionProgressRadialCCW
|
|
|
|
|
|
|
|
CCProgressTimer* CCTransitionProgressRadialCCW::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
|
|
|
|
{
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
|
2012-03-26 16:46:23 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// but it is flipped upside down so we flip the sprite
|
|
|
|
pNode->getSprite()->setFlipY(true);
|
|
|
|
pNode->setType(kCCProgressTimerTypeRadial);
|
|
|
|
|
|
|
|
// Return the radial type that we want to use
|
2012-06-15 15:10:40 +08:00
|
|
|
pNode->setReverseDirection(false);
|
2012-04-19 14:35:52 +08:00
|
|
|
pNode->setPercentage(100);
|
|
|
|
pNode->setPosition(ccp(size.width/2, size.height/2));
|
|
|
|
pNode->setAnchorPoint(ccp(0.5f,0.5f));
|
|
|
|
|
|
|
|
return pNode;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
2012-11-01 22:12:13 +08:00
|
|
|
CCTransitionProgressRadialCCW* CCTransitionProgressRadialCCW::create(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressRadialCCW* pScene = new CCTransitionProgressRadialCCW();
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CCTransitionProgressRadialCCW* CCTransitionProgressRadialCCW::transitionWithDuration(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressRadialCCW* pScene = new CCTransitionProgressRadialCCW();
|
|
|
|
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-03-26 16:46:23 +08:00
|
|
|
// CCTransitionProgressRadialCW
|
2012-11-01 22:12:13 +08:00
|
|
|
CCTransitionProgressRadialCW* CCTransitionProgressRadialCW::create(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressRadialCW* pScene = new CCTransitionProgressRadialCW();
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CCTransitionProgressRadialCW* CCTransitionProgressRadialCW::transitionWithDuration(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressRadialCW* pScene = new CCTransitionProgressRadialCW();
|
|
|
|
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-03-26 16:46:23 +08:00
|
|
|
|
|
|
|
CCProgressTimer* CCTransitionProgressRadialCW::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// but it is flipped upside down so we flip the sprite
|
|
|
|
pNode->getSprite()->setFlipY(true);
|
|
|
|
pNode->setType( kCCProgressTimerTypeRadial );
|
|
|
|
|
|
|
|
// Return the radial type that we want to use
|
2012-06-15 15:10:40 +08:00
|
|
|
pNode->setReverseDirection(true);
|
2012-04-19 14:35:52 +08:00
|
|
|
pNode->setPercentage(100);
|
|
|
|
pNode->setPosition(ccp(size.width/2, size.height/2));
|
|
|
|
pNode->setAnchorPoint(ccp(0.5f,0.5f));
|
|
|
|
|
|
|
|
return pNode;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CCTransitionProgressHorizontal
|
2012-11-01 22:12:13 +08:00
|
|
|
CCTransitionProgressHorizontal* CCTransitionProgressHorizontal::create(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressHorizontal* pScene = new CCTransitionProgressHorizontal();
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CCTransitionProgressHorizontal* CCTransitionProgressHorizontal::transitionWithDuration(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressHorizontal* pScene = new CCTransitionProgressHorizontal();
|
|
|
|
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-03-26 16:46:23 +08:00
|
|
|
|
|
|
|
CCProgressTimer* CCTransitionProgressHorizontal::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// but it is flipped upside down so we flip the sprite
|
|
|
|
pNode->getSprite()->setFlipY(true);
|
|
|
|
pNode->setType( kCCProgressTimerTypeBar);
|
|
|
|
|
|
|
|
pNode->setMidpoint(ccp(1, 0));
|
|
|
|
pNode->setBarChangeRate(ccp(1,0));
|
|
|
|
|
|
|
|
pNode->setPercentage(100);
|
|
|
|
pNode->setPosition(ccp(size.width/2, size.height/2));
|
|
|
|
pNode->setAnchorPoint(ccp(0.5f,0.5f));
|
|
|
|
|
|
|
|
return pNode;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CCTransitionProgressVertical
|
2012-11-01 22:12:13 +08:00
|
|
|
CCTransitionProgressVertical* CCTransitionProgressVertical::create(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressVertical* pScene = new CCTransitionProgressVertical();
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CCTransitionProgressVertical* CCTransitionProgressVertical::transitionWithDuration(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressVertical* pScene = new CCTransitionProgressVertical();
|
|
|
|
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-03-26 16:46:23 +08:00
|
|
|
|
|
|
|
CCProgressTimer* CCTransitionProgressVertical::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// but it is flipped upside down so we flip the sprite
|
|
|
|
pNode->getSprite()->setFlipY(true);
|
|
|
|
pNode->setType(kCCProgressTimerTypeBar);
|
|
|
|
|
|
|
|
pNode->setMidpoint(ccp(0, 0));
|
|
|
|
pNode->setBarChangeRate(ccp(0,1));
|
|
|
|
|
|
|
|
pNode->setPercentage(100);
|
|
|
|
pNode->setPosition(ccp(size.width/2, size.height/2));
|
|
|
|
pNode->setAnchorPoint(ccp(0.5f,0.5f));
|
|
|
|
|
|
|
|
return pNode;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CCTransitionProgressInOut
|
2012-11-01 22:12:13 +08:00
|
|
|
CCTransitionProgressInOut* CCTransitionProgressInOut::create(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressInOut* pScene = new CCTransitionProgressInOut();
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CCTransitionProgressInOut* CCTransitionProgressInOut::transitionWithDuration(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressInOut* pScene = new CCTransitionProgressInOut();
|
|
|
|
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-03-26 16:46:23 +08:00
|
|
|
|
|
|
|
void CCTransitionProgressInOut::sceneOrder()
|
|
|
|
{
|
|
|
|
m_bIsInSceneOnTop = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCTransitionProgressInOut::setupTransition()
|
|
|
|
{
|
2012-06-15 15:10:40 +08:00
|
|
|
m_pSceneToBeModified = m_pInScene;
|
|
|
|
m_fFrom = 0;
|
|
|
|
m_fTo = 100;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CCProgressTimer* CCTransitionProgressInOut::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// but it is flipped upside down so we flip the sprite
|
|
|
|
pNode->getSprite()->setFlipY(true);
|
|
|
|
pNode->setType( kCCProgressTimerTypeBar);
|
|
|
|
|
|
|
|
pNode->setMidpoint(ccp(0.5f, 0.5f));
|
|
|
|
pNode->setBarChangeRate(ccp(1, 1));
|
|
|
|
|
|
|
|
pNode->setPercentage(0);
|
|
|
|
pNode->setPosition(ccp(size.width/2, size.height/2));
|
|
|
|
pNode->setAnchorPoint(ccp(0.5f,0.5f));
|
|
|
|
|
|
|
|
return pNode;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CCTransitionProgressOutIn
|
2012-11-01 22:12:13 +08:00
|
|
|
CCTransitionProgressOutIn* CCTransitionProgressOutIn::create(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressOutIn* pScene = new CCTransitionProgressOutIn();
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CCTransitionProgressOutIn* CCTransitionProgressOutIn::transitionWithDuration(float t, CCScene* scene)
|
|
|
|
{
|
|
|
|
CCTransitionProgressOutIn* pScene = new CCTransitionProgressOutIn();
|
|
|
|
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-03-26 16:46:23 +08:00
|
|
|
|
|
|
|
CCProgressTimer* CCTransitionProgressOutIn::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// but it is flipped upside down so we flip the sprite
|
|
|
|
pNode->getSprite()->setFlipY(true);
|
|
|
|
pNode->setType( kCCProgressTimerTypeBar );
|
|
|
|
|
|
|
|
pNode->setMidpoint(ccp(0.5f, 0.5f));
|
|
|
|
pNode->setBarChangeRate(ccp(1, 1));
|
|
|
|
|
|
|
|
pNode->setPercentage(100);
|
|
|
|
pNode->setPosition(ccp(size.width/2, size.height/2));
|
|
|
|
pNode->setAnchorPoint(ccp(0.5f,0.5f));
|
|
|
|
|
|
|
|
return pNode;
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|