mirror of https://github.com/axmolengine/axmol.git
issue #18, complete the implementation left.
This commit is contained in:
parent
05259df015
commit
820676ea28
|
@ -590,6 +590,19 @@ namespace cocos2d
|
|||
}
|
||||
|
||||
// implementation of TurnOffTiles
|
||||
CCTurnOffTiles* CCTurnOffTiles::actionWithSize(ccGridSize size, ccTime d)
|
||||
{
|
||||
CCTurnOffTiles* pAction = new CCTurnOffTiles();
|
||||
if (pAction->initWithSize(size, d))
|
||||
{
|
||||
pAction->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CCX_SAFE_DELETE(pAction);
|
||||
}
|
||||
return pAction;
|
||||
}
|
||||
|
||||
CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
|
||||
{
|
||||
|
|
|
@ -27,8 +27,6 @@ THE SOFTWARE.
|
|||
|
||||
#include <string>
|
||||
#include "NSObject.h"
|
||||
/// @todo #import <Foundation/Foundation.h>
|
||||
/// @todo #import <CoreGraphics/CGImage.h>
|
||||
#include "NSMutableDictionary.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
|
|
@ -164,7 +164,8 @@ namespace cocos2d
|
|||
virtual void update(ccTime time);
|
||||
|
||||
public:
|
||||
static CCTurnOffTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
||||
static CCTurnOffTiles* actionWithSize(ccGridSize size, ccTime d);
|
||||
static CCTurnOffTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
||||
|
||||
protected:
|
||||
int m_nSeed;
|
||||
|
|
|
@ -27,6 +27,7 @@ THE SOFTWARE.
|
|||
#include "CCIntervalAction.h"
|
||||
#include "CCInstantAction.h"
|
||||
#include "CCGridAction.h"
|
||||
#include "CCPageTurn3DAction.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
|
@ -113,19 +114,19 @@ void CCPageTurnTransition::onEnter()
|
|||
|
||||
CCIntervalAction* CCPageTurnTransition:: actionWithSize(ccGridSize vector)
|
||||
{
|
||||
/** @todo CCPageTurn3D
|
||||
if( back_ )
|
||||
if( m_bBack )
|
||||
{
|
||||
// Get hold of the PageTurn3DAction
|
||||
return [CCReverseTime actionWithAction:
|
||||
[CCPageTurn3D actionWithSize:v duration:duration]];
|
||||
return CCReverseTime::actionWithAction
|
||||
(
|
||||
CCPageTurn3D::actionWithSize(vector, m_fDuration)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get hold of the PageTurn3DAction
|
||||
return [CCPageTurn3D actionWithSize:v duration:duration];
|
||||
}*/
|
||||
return NULL;
|
||||
return CCPageTurn3D::actionWithSize(vector, m_fDuration);
|
||||
}
|
||||
}
|
||||
|
||||
}//namespace cocos2d
|
||||
|
|
|
@ -24,6 +24,10 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCRadialTransition.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCRenderTexture.h"
|
||||
#include "CCInstantAction.h"
|
||||
#include "CCProgressTimerActions.h"
|
||||
#include "CGPointExtension.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
|
@ -61,43 +65,44 @@ void CCRadialCCWTransition::onEnter()
|
|||
// create a transparent color layer
|
||||
// in which we are going to add our rendertextures
|
||||
CGSize size = CCDirector::getSharedDirector()->getWinSize();
|
||||
/** @todo CCProgressTimer, CCRenderTexture
|
||||
|
||||
// create the second render texture for outScene
|
||||
CCRenderTexture *outTexture = CCRenderTexture::renderTextureWithWidth:size.width height:size.height];
|
||||
outTexture.sprite.anchorPoint= ccp(0.5f,0.5f);
|
||||
outTexture.position = ccp(size.width/2, size.height/2);
|
||||
outTexture.anchorPoint = ccp(0.5f,0.5f);
|
||||
CCRenderTexture *outTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
|
||||
outTexture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
|
||||
outTexture->setPosition(ccp(size.width/2, size.height/2));
|
||||
outTexture->setAnchorPoint(ccp(0.5f,0.5f));
|
||||
|
||||
// render outScene to its texturebuffer
|
||||
[outTexture clear:0 g:0 b:0 a:1];
|
||||
[outTexture begin];
|
||||
[outScene visit];
|
||||
[outTexture end];
|
||||
outTexture->clear(0,0,0,1);
|
||||
outTexture->begin();
|
||||
m_pOutScene->visit();
|
||||
outTexture->end();
|
||||
|
||||
// Since we've passed the outScene to the texture we don't need it.
|
||||
[self hideOutShowIn];
|
||||
this->hideOutShowIn();
|
||||
|
||||
// We need the texture in RenderTexture.
|
||||
CCProgressTimer *outNode = [CCProgressTimer progressWithTexture:outTexture.sprite.texture];
|
||||
CCProgressTimer *outNode = CCProgressTimer::progressWithTexture(outTexture->getSprite()->getTexture());
|
||||
// but it's flipped upside down so we flip the sprite
|
||||
outNode.sprite.flipY = YES;
|
||||
outNode->getSprite()->setFlipY(true);
|
||||
// Return the radial type that we want to use
|
||||
outNode.type = [self radialType];
|
||||
outNode.percentage = 100.f;
|
||||
outNode.position = ccp(size.width/2, size.height/2);
|
||||
outNode.anchorPoint = ccp(0.5f,0.5f);
|
||||
outNode->setType(radialType());
|
||||
outNode->setPercentage(100.f);
|
||||
outNode->setPosition(ccp(size.width/2, size.height/2));
|
||||
outNode->setAnchorPoint(ccp(0.5f,0.5f));
|
||||
|
||||
// create the blend action
|
||||
CCIntervalAction * layerAction = [CCSequence actions:
|
||||
[CCProgressFromTo actionWithDuration:duration from:100.f to:0.f],
|
||||
[CCCallFunc actionWithTarget:self selector:@selector(finish)],
|
||||
nil ];
|
||||
CCAction * layerAction = CCSequence::actions
|
||||
(
|
||||
CCProgressFromTo::actionWithDuration(m_fDuration, 100.0f, 0.0f),
|
||||
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
|
||||
NULL
|
||||
);
|
||||
// run the blend action
|
||||
[outNode runAction: layerAction];
|
||||
outNode->runAction(layerAction);
|
||||
|
||||
// add the layer (which contains our two rendertextures) to the scene
|
||||
[self addChild: outNode z:2 tag:kSceneRadial];*/
|
||||
this->addChild(outNode, 2, kSceneRadial);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ THE SOFTWARE.
|
|||
#include "CCCameraAction.h"
|
||||
#include "CCLayer.h"
|
||||
#include "CCGridAction.h"
|
||||
#include "CCRenderTexture.h"
|
||||
#include "CCTiledGridAction.h"
|
||||
namespace cocos2d {
|
||||
|
||||
enum {
|
||||
|
@ -1094,7 +1096,6 @@ void CCCrossFadeTransition:: draw()
|
|||
|
||||
void CCCrossFadeTransition::onEnter()
|
||||
{
|
||||
/** @todo ccrendertexture
|
||||
__super::onEnter();
|
||||
|
||||
// create a transparent color layer
|
||||
|
@ -1104,7 +1105,7 @@ void CCCrossFadeTransition::onEnter()
|
|||
CCColorLayer* layer = CCColorLayer::layerWithColor(color);
|
||||
|
||||
// create the first render texture for inScene
|
||||
CCRenderTexture* inTexture = CCRenderTexture::renderTextureWithWidth((int)size.width, (int)size.height);
|
||||
CCRenderTexture* inTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
|
||||
inTexture->getSprite()->setAnchorPoint( ccp(0.5f,0.5f) );
|
||||
inTexture->setPosition( ccp(size.width/2, size.height/2) );
|
||||
inTexture->setAnchorPoint( ccp(0.5f,0.5f) );
|
||||
|
@ -1115,7 +1116,7 @@ void CCCrossFadeTransition::onEnter()
|
|||
inTexture->end();
|
||||
|
||||
// create the second render texture for outScene
|
||||
CCRenderTexture* outTexture = CCRenderTexture::renderTextureWithWidth((int)size.width, (int)size.height);
|
||||
CCRenderTexture* outTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
|
||||
outTexture->getSprite()->setAnchorPoint( ccp(0.5f,0.5f) );
|
||||
outTexture->setPosition( ccp(size.width/2, size.height/2) );
|
||||
outTexture->setAnchorPoint( ccp(0.5f,0.5f) );
|
||||
|
@ -1144,19 +1145,19 @@ void CCCrossFadeTransition::onEnter()
|
|||
|
||||
// create the blend action
|
||||
CCAction* layerAction = CCSequence::actions
|
||||
(
|
||||
CCFadeTo::actionWithDuration(m_fDuration, 0),
|
||||
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),
|
||||
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
|
||||
NULL
|
||||
);
|
||||
(
|
||||
CCFadeTo::actionWithDuration(m_fDuration, 0),
|
||||
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),
|
||||
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
|
||||
NULL
|
||||
);
|
||||
|
||||
|
||||
// run the blend action
|
||||
outTexture->getSprite()->runAction( layerAction );
|
||||
|
||||
// add the layer (which contains our two rendertextures) to the scene
|
||||
addChild(layer, 2, kSceneFade);*/
|
||||
addChild(layer, 2, kSceneFade);
|
||||
}
|
||||
|
||||
// clean up on exit
|
||||
|
@ -1195,37 +1196,24 @@ void CCTurnOffTilesTransition::sceneOrder()
|
|||
|
||||
void CCTurnOffTilesTransition::onEnter()
|
||||
{
|
||||
/** @todo ccturnofftiles
|
||||
__super::onEnter();
|
||||
CGSize s = CCDirector::getSharedDirector()->getWinSize();
|
||||
float aspect = s.width / s.height;
|
||||
int x = (int)(12 * aspect);
|
||||
int y = 12;
|
||||
|
||||
CCTurnOffTiles* toff = CCTurnOffTiles::actionWithSize( ccg(x,y), m_duration);
|
||||
CCTurnOffTiles* toff = CCTurnOffTiles::actionWithSize( ccg(x,y), m_fDuration);
|
||||
CCIntervalAction* action = easeActionWithAction(toff);
|
||||
m_outScene->runAction(
|
||||
CCSequence::actions(
|
||||
action,
|
||||
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
|
||||
CCStopGrid::action(),
|
||||
NULL)
|
||||
);*/
|
||||
/** @todo
|
||||
[super onEnter];
|
||||
CGSize s = [[CCDirector sharedDirector] winSize];
|
||||
float aspect = s.width / s.height;
|
||||
int x = 12 * aspect;
|
||||
int y = 12;
|
||||
|
||||
id toff = [CCTurnOffTiles actionWithSize: ccg(x,y) duration:duration];
|
||||
id action = [self easeActionWithAction:toff];
|
||||
[outScene runAction: [CCSequence actions: action,
|
||||
[CCCallFunc actionWithTarget:self selector:@selector(finish)],
|
||||
[CCStopGrid action],
|
||||
nil]
|
||||
];*/
|
||||
|
||||
m_pOutScene->runAction
|
||||
(
|
||||
CCSequence::actions
|
||||
(
|
||||
action,
|
||||
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
|
||||
CCStopGrid::action(),
|
||||
NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1254,12 +1242,12 @@ void CCSplitColsTransition::onEnter()
|
|||
|
||||
CCIntervalAction* split = action();
|
||||
CCIntervalAction* seq = (CCIntervalAction*)CCSequence::actions
|
||||
(
|
||||
split,
|
||||
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),
|
||||
split->reverse(),
|
||||
NULL
|
||||
);
|
||||
(
|
||||
split,
|
||||
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),
|
||||
split->reverse(),
|
||||
NULL
|
||||
);
|
||||
|
||||
this->runAction
|
||||
(
|
||||
|
@ -1276,8 +1264,7 @@ void CCSplitColsTransition::onEnter()
|
|||
|
||||
CCIntervalAction* CCSplitColsTransition:: action()
|
||||
{
|
||||
return NULL;
|
||||
/// @todo return [CCSplitCols actionWithCols:3 duration:duration/2.0f];
|
||||
return CCSplitCols::actionWithCols(3, m_fDuration/2.0f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1302,8 +1289,7 @@ CCSplitRowsTransition::~CCSplitRowsTransition()
|
|||
|
||||
CCIntervalAction* CCSplitRowsTransition::action()
|
||||
{
|
||||
return NULL;
|
||||
/// @todo return [CCSplitRows actionWithRows:3 duration:duration/2.0f];
|
||||
return CCSplitRows::actionWithRows(3, m_fDuration/2.0f);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCSplitRowsTransition)
|
||||
|
@ -1350,8 +1336,7 @@ void CCFadeTRTransition::onEnter()
|
|||
|
||||
CCIntervalAction* CCFadeTRTransition::actionWithSize(ccGridSize size)
|
||||
{
|
||||
return NULL;
|
||||
/// @todo return [CCFadeOutTRTiles actionWithSize:v duration:duration];
|
||||
return CCFadeOutTRTiles::actionWithSize(size, m_fDuration);
|
||||
}
|
||||
|
||||
CCIntervalAction* CCFadeTRTransition:: easeActionWithAction(CCIntervalAction* action)
|
||||
|
@ -1375,8 +1360,7 @@ CCFadeBLTransition::~CCFadeBLTransition()
|
|||
|
||||
CCIntervalAction* CCFadeBLTransition::actionWithSize(ccGridSize size)
|
||||
{
|
||||
return NULL;
|
||||
/// @todo return [CCFadeOutBLTiles actionWithSize:v duration:duration];
|
||||
return CCFadeOutBLTiles::actionWithSize(size, m_fDuration);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCFadeBLTransition)
|
||||
|
@ -1393,8 +1377,7 @@ CCFadeUpTransition::~CCFadeUpTransition()
|
|||
|
||||
CCIntervalAction* CCFadeUpTransition::actionWithSize(ccGridSize size)
|
||||
{
|
||||
return NULL;
|
||||
/// @todo return [CCFadeOutUpTiles actionWithSize:v duration:duration];
|
||||
return CCFadeOutUpTiles::actionWithSize(size, m_fDuration);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCFadeUpTransition)
|
||||
|
@ -1411,8 +1394,7 @@ CCFadeDownTransition::~CCFadeDownTransition()
|
|||
|
||||
CCIntervalAction* CCFadeDownTransition::actionWithSize(ccGridSize size)
|
||||
{
|
||||
return NULL;
|
||||
/// @todo return [CCFadeOutDownTiles actionWithSize:v duration:duration];
|
||||
return CCFadeOutDownTiles::actionWithSize(size, m_fDuration);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCFadeDownTransition)
|
||||
|
|
|
@ -79,14 +79,14 @@ CCTextureCache::CCTextureCache()
|
|||
CCTextureCache::~CCTextureCache()
|
||||
{
|
||||
CCLOG("cocos2d: deallocing CCTextureCache.");
|
||||
|
||||
CCX_SAFE_RELEASE(m_pTextures);
|
||||
CCX_SAFE_DELETE(m_pDictLock);
|
||||
CCX_SAFE_DELETE(m_pContextLock);
|
||||
CCX_SAFE_RELEASE(g_sharedTextureCache);
|
||||
/// @todo release
|
||||
// [textures release];
|
||||
// [dictLock release];
|
||||
// [contextLock release];
|
||||
// [auxEAGLcontext release];
|
||||
// auxEAGLcontext = nil;
|
||||
// sharedTextureCache = nil;
|
||||
// [super dealloc];
|
||||
}
|
||||
|
||||
void CCTextureCache::purgeSharedTextureCache()
|
||||
|
@ -187,15 +187,17 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
|
|||
|
||||
texture = m_pTextures->objectForKey(temp);
|
||||
|
||||
if( ! texture ) {
|
||||
|
||||
if( ! texture )
|
||||
{
|
||||
// Split up directory and filename
|
||||
std::string fullpath(CCFileUtils::fullPathFromRelativePath(path));
|
||||
|
||||
// all images are handled by UIImage except PVR extension that is handled by our own handler
|
||||
// if ( [[path lowercaseString] hasSuffix:@".pvr"] )
|
||||
for (unsigned int i = 0; i < temp.length(); ++i)
|
||||
{
|
||||
temp[i] = tolower(temp[i]);
|
||||
}
|
||||
if (std::string::npos != temp.find(".pvr"))
|
||||
{
|
||||
#ifdef _POWERVR_SUPPORT_
|
||||
|
|
Loading…
Reference in New Issue