mirror of https://github.com/axmolengine/axmol.git
fixed #486, setDepthTest(true) in TileMapTest, while setDepthTest(false) in TransitionsTest. TransitionFlip will not flickers any more :)
This commit is contained in:
parent
78d49e9806
commit
10d94fb170
|
@ -28,11 +28,11 @@ TileMapTest::TileMapTest()
|
|||
|
||||
map->setAnchorPoint( ccp(0, 0.5f) );
|
||||
|
||||
CCScaleBy *scale = CCScaleBy::actionWithDuration(4, 0.8f);
|
||||
CCActionInterval *scaleBack = scale->reverse();
|
||||
|
||||
CCFiniteTimeAction* seq = CCSequence::actions(scale, scaleBack, NULL);
|
||||
|
||||
CCScaleBy *scale = CCScaleBy::actionWithDuration(4, 0.8f);
|
||||
CCActionInterval *scaleBack = scale->reverse();
|
||||
|
||||
CCFiniteTimeAction* seq = CCSequence::actions(scale, scaleBack, NULL);
|
||||
|
||||
map->runAction(CCRepeatForever::actionWithAction((CCActionInterval *)seq));
|
||||
}
|
||||
|
||||
|
@ -1114,62 +1114,62 @@ std::string TMXOrthoMoveLayer::subtitle()
|
|||
// TMXBug987
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
TMXBug987::TMXBug987()
|
||||
{
|
||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/orthogonal-test6.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
CCSize s1 = map->getContentSize();
|
||||
CCLOG("ContentSize: %f, %f", s1.width,s1.height);
|
||||
|
||||
CCArray* childs = map->getChildren();
|
||||
CCTMXLayer* pNode;
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(childs, pObject)
|
||||
{
|
||||
pNode = (CCTMXLayer*) pObject;
|
||||
CC_BREAK_IF(!pNode);
|
||||
pNode->getTexture()->setAntiAliasTexParameters();
|
||||
}
|
||||
|
||||
map->setAnchorPoint(ccp(0, 0));
|
||||
CCTMXLayer *layer = map->layerNamed("Tile Layer 1");
|
||||
layer->setTileGID(3, ccp(2,2));
|
||||
}
|
||||
|
||||
std::string TMXBug987::title()
|
||||
{
|
||||
return "TMX Bug 987";
|
||||
}
|
||||
|
||||
std::string TMXBug987::subtitle()
|
||||
{
|
||||
return "You should see an square";
|
||||
}
|
||||
|
||||
TMXBug987::TMXBug987()
|
||||
{
|
||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/orthogonal-test6.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
CCSize s1 = map->getContentSize();
|
||||
CCLOG("ContentSize: %f, %f", s1.width,s1.height);
|
||||
|
||||
CCArray* childs = map->getChildren();
|
||||
CCTMXLayer* pNode;
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(childs, pObject)
|
||||
{
|
||||
pNode = (CCTMXLayer*) pObject;
|
||||
CC_BREAK_IF(!pNode);
|
||||
pNode->getTexture()->setAntiAliasTexParameters();
|
||||
}
|
||||
|
||||
map->setAnchorPoint(ccp(0, 0));
|
||||
CCTMXLayer *layer = map->layerNamed("Tile Layer 1");
|
||||
layer->setTileGID(3, ccp(2,2));
|
||||
}
|
||||
|
||||
std::string TMXBug987::title()
|
||||
{
|
||||
return "TMX Bug 987";
|
||||
}
|
||||
|
||||
std::string TMXBug987::subtitle()
|
||||
{
|
||||
return "You should see an square";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// TMXBug787
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
TMXBug787::TMXBug787()
|
||||
{
|
||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/iso-test-bug787.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
map->setScale(0.25f);
|
||||
}
|
||||
|
||||
std::string TMXBug787::title()
|
||||
{
|
||||
return "TMX Bug 787";
|
||||
}
|
||||
|
||||
std::string TMXBug787::subtitle()
|
||||
{
|
||||
return "You should see a map";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
TMXBug787::TMXBug787()
|
||||
{
|
||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/iso-test-bug787.tmx");
|
||||
addChild(map, 0, kTagTileMap);
|
||||
|
||||
map->setScale(0.25f);
|
||||
}
|
||||
|
||||
std::string TMXBug787::title()
|
||||
{
|
||||
return "TMX Bug 787";
|
||||
}
|
||||
|
||||
std::string TMXBug787::subtitle()
|
||||
{
|
||||
return "You should see a map";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// TileDemo
|
||||
|
@ -1376,5 +1376,10 @@ void TileMapTestScene::runThisTest()
|
|||
CCLayer* pLayer = nextTileMapAction();
|
||||
addChild(pLayer);
|
||||
|
||||
// fix bug #486, #419.
|
||||
// "test" is the default value in CCDirector::setGLDefaultValues()
|
||||
// but TransitionTest may setDepthTest(false), we should revert it here
|
||||
CCDirector::sharedDirector()->setDepthTest(true);
|
||||
|
||||
CCDirector::sharedDirector()->replaceScene(this);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "TransitionsTest.h"
|
||||
#include "../testResource.h"
|
||||
|
||||
#define TRANSITION_DURATION (1.2f)
|
||||
|
||||
#include "TransitionsTest.h"
|
||||
#include "../testResource.h"
|
||||
|
||||
#define TRANSITION_DURATION (1.2f)
|
||||
|
||||
class FadeWhiteTransition : public CCTransitionFade
|
||||
{
|
||||
public:
|
||||
|
@ -137,10 +137,10 @@ public:
|
|||
{
|
||||
return CCTransitionPageTurn::transitionWithDuration(t, s, true);
|
||||
}
|
||||
};
|
||||
|
||||
#define MAX_LAYER 37
|
||||
|
||||
};
|
||||
|
||||
#define MAX_LAYER 37
|
||||
|
||||
static std::string transitions[MAX_LAYER] = {
|
||||
"JumpZoomTransition",
|
||||
"FadeTransition",
|
||||
|
@ -167,22 +167,22 @@ static std::string transitions[MAX_LAYER] = {
|
|||
"SlideInRTransition",
|
||||
"SlideInTTransition",
|
||||
"SlideInBTransition",
|
||||
|
||||
"CCTransitionCrossFade",
|
||||
"CCTransitionRadialCCW",
|
||||
"CCTransitionRadialCW",
|
||||
"PageTransitionForward",
|
||||
"PageTransitionBackward",
|
||||
"FadeTRTransition",
|
||||
"FadeBLTransition",
|
||||
"FadeUpTransition",
|
||||
"FadeDownTransition",
|
||||
"TurnOffTilesTransition",
|
||||
"SplitRowsTransition",
|
||||
"SplitColsTransition",
|
||||
};
|
||||
static int s_nSceneIdx = 0;
|
||||
|
||||
|
||||
"CCTransitionCrossFade",
|
||||
"CCTransitionRadialCCW",
|
||||
"CCTransitionRadialCW",
|
||||
"PageTransitionForward",
|
||||
"PageTransitionBackward",
|
||||
"FadeTRTransition",
|
||||
"FadeBLTransition",
|
||||
"FadeUpTransition",
|
||||
"FadeDownTransition",
|
||||
"TurnOffTilesTransition",
|
||||
"SplitRowsTransition",
|
||||
"SplitColsTransition",
|
||||
};
|
||||
static int s_nSceneIdx = 0;
|
||||
|
||||
CCTransitionScene* createTransition(int nIndex, ccTime t, CCScene* s)
|
||||
{
|
||||
switch(nIndex)
|
||||
|
@ -196,12 +196,12 @@ CCTransitionScene* createTransition(int nIndex, ccTime t, CCScene* s)
|
|||
case 6: return FlipYDownOver::transitionWithDuration(t, s);
|
||||
case 7: return FlipAngularLeftOver::transitionWithDuration(t, s);
|
||||
case 8: return FlipAngularRightOver::transitionWithDuration(t, s);
|
||||
case 9: return ZoomFlipXLeftOver::transitionWithDuration(t, s);
|
||||
case 10: return ZoomFlipXRightOver::transitionWithDuration(t, s);
|
||||
case 11: return ZoomFlipYUpOver::transitionWithDuration(t, s);
|
||||
case 12: return ZoomFlipYDownOver::transitionWithDuration(t, s);
|
||||
case 13: return ZoomFlipAngularLeftOver::transitionWithDuration(t, s);
|
||||
case 14: return ZoomFlipAngularRightOver::transitionWithDuration(t, s);
|
||||
case 9: return ZoomFlipXLeftOver::transitionWithDuration(t, s);
|
||||
case 10: return ZoomFlipXRightOver::transitionWithDuration(t, s);
|
||||
case 11: return ZoomFlipYUpOver::transitionWithDuration(t, s);
|
||||
case 12: return ZoomFlipYDownOver::transitionWithDuration(t, s);
|
||||
case 13: return ZoomFlipAngularLeftOver::transitionWithDuration(t, s);
|
||||
case 14: return ZoomFlipAngularRightOver::transitionWithDuration(t, s);
|
||||
case 15: return CCTransitionShrinkGrow::transitionWithDuration(t, s);
|
||||
case 16: return CCTransitionRotoZoom::transitionWithDuration(t, s);
|
||||
case 17: return CCTransitionMoveInL::transitionWithDuration(t, s);
|
||||
|
@ -213,36 +213,39 @@ CCTransitionScene* createTransition(int nIndex, ccTime t, CCScene* s)
|
|||
case 23: return CCTransitionSlideInT::transitionWithDuration(t, s);
|
||||
case 24: return CCTransitionSlideInB::transitionWithDuration(t, s);
|
||||
|
||||
case 25: return CCTransitionCrossFade::transitionWithDuration(t,s);
|
||||
case 26: return CCTransitionRadialCCW::transitionWithDuration(t,s);
|
||||
case 27: return CCTransitionRadialCW::transitionWithDuration(t,s);
|
||||
case 28: return PageTransitionForward::transitionWithDuration(t, s);
|
||||
case 29: return PageTransitionBackward::transitionWithDuration(t, s);
|
||||
case 30: return CCTransitionFadeTR::transitionWithDuration(t, s);
|
||||
case 31: return CCTransitionFadeBL::transitionWithDuration(t, s);
|
||||
case 32: return CCTransitionFadeUp::transitionWithDuration(t, s);
|
||||
case 33: return CCTransitionFadeDown::transitionWithDuration(t, s);
|
||||
case 34: return CCTransitionTurnOffTiles::transitionWithDuration(t, s);
|
||||
case 35: return CCTransitionSplitRows::transitionWithDuration(t, s);
|
||||
case 25: return CCTransitionCrossFade::transitionWithDuration(t,s);
|
||||
case 26: return CCTransitionRadialCCW::transitionWithDuration(t,s);
|
||||
case 27: return CCTransitionRadialCW::transitionWithDuration(t,s);
|
||||
case 28: return PageTransitionForward::transitionWithDuration(t, s);
|
||||
case 29: return PageTransitionBackward::transitionWithDuration(t, s);
|
||||
case 30: return CCTransitionFadeTR::transitionWithDuration(t, s);
|
||||
case 31: return CCTransitionFadeBL::transitionWithDuration(t, s);
|
||||
case 32: return CCTransitionFadeUp::transitionWithDuration(t, s);
|
||||
case 33: return CCTransitionFadeDown::transitionWithDuration(t, s);
|
||||
case 34: return CCTransitionTurnOffTiles::transitionWithDuration(t, s);
|
||||
case 35: return CCTransitionSplitRows::transitionWithDuration(t, s);
|
||||
case 36: return CCTransitionSplitCols::transitionWithDuration(t, s);
|
||||
default: break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void TransitionsTestScene::runThisTest()
|
||||
{
|
||||
CCLayer * pLayer = new TestLayer1();
|
||||
addChild(pLayer);
|
||||
pLayer->release();
|
||||
|
||||
CCDirector::sharedDirector()->replaceScene(this);
|
||||
}
|
||||
|
||||
TestLayer1::TestLayer1(void)
|
||||
{
|
||||
|
||||
|
||||
void TransitionsTestScene::runThisTest()
|
||||
{
|
||||
CCLayer * pLayer = new TestLayer1();
|
||||
addChild(pLayer);
|
||||
pLayer->release();
|
||||
|
||||
// fix bug #486, without setDepthTest(false), FlipX,Y will flickers
|
||||
CCDirector::sharedDirector()->setDepthTest(false);
|
||||
|
||||
CCDirector::sharedDirector()->replaceScene(this);
|
||||
}
|
||||
|
||||
TestLayer1::TestLayer1(void)
|
||||
{
|
||||
float x,y;
|
||||
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
|
@ -250,7 +253,7 @@ TestLayer1::TestLayer1(void)
|
|||
y = size.height;
|
||||
|
||||
CCSprite* bg1 = CCSprite::spriteWithFile(s_back1);
|
||||
bg1->setPosition( CCPointMake(size.width/2, size.height/2) );
|
||||
bg1->setPosition( CCPointMake(size.width/2, size.height/2) );
|
||||
addChild(bg1, -1);
|
||||
|
||||
CCLabelTTF* title = CCLabelTTF::labelWithString( (transitions[s_nSceneIdx]).c_str(), "Thonburi", 32 );
|
||||
|
@ -264,8 +267,8 @@ TestLayer1::TestLayer1(void)
|
|||
addChild( label);
|
||||
|
||||
// menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer1::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer1::restartCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer1::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer1::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TestLayer1::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
@ -278,13 +281,13 @@ TestLayer1::TestLayer1(void)
|
|||
addChild(menu, 1);
|
||||
|
||||
schedule( schedule_selector(TestLayer1::step), 1.0f);
|
||||
}
|
||||
|
||||
TestLayer1::~TestLayer1(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TestLayer1::~TestLayer1(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TestLayer1::restartCallback(CCObject* pSender)
|
||||
{
|
||||
CCScene* s = new TransitionsTestScene();
|
||||
|
@ -295,9 +298,9 @@ void TestLayer1::restartCallback(CCObject* pSender)
|
|||
CCScene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
|
||||
s->release();
|
||||
pLayer->release();
|
||||
if (pScene)
|
||||
if (pScene)
|
||||
{
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,19 +317,19 @@ void TestLayer1::nextCallback(CCObject* pSender)
|
|||
CCScene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
|
||||
s->release();
|
||||
pLayer->release();
|
||||
if (pScene)
|
||||
if (pScene)
|
||||
{
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
}
|
||||
}
|
||||
|
||||
void TestLayer1::backCallback(CCObject* pSender)
|
||||
{
|
||||
void TestLayer1::backCallback(CCObject* pSender)
|
||||
{
|
||||
s_nSceneIdx--;
|
||||
int total = MAX_LAYER;
|
||||
if( s_nSceneIdx < 0 )
|
||||
s_nSceneIdx += total;
|
||||
|
||||
s_nSceneIdx += total;
|
||||
|
||||
CCScene* s = new TransitionsTestScene();
|
||||
|
||||
CCLayer* pLayer = new TestLayer2();
|
||||
|
@ -335,19 +338,19 @@ void TestLayer1::backCallback(CCObject* pSender)
|
|||
CCScene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
|
||||
s->release();
|
||||
pLayer->release();
|
||||
if (pScene)
|
||||
if (pScene)
|
||||
{
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
}
|
||||
}
|
||||
|
||||
void TestLayer1::step(ccTime dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
TestLayer2::TestLayer2()
|
||||
{
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
}
|
||||
}
|
||||
|
||||
void TestLayer1::step(ccTime dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
TestLayer2::TestLayer2()
|
||||
{
|
||||
float x,y;
|
||||
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
|
@ -355,7 +358,7 @@ TestLayer2::TestLayer2()
|
|||
y = size.height;
|
||||
|
||||
CCSprite* bg1 = CCSprite::spriteWithFile(s_back2);
|
||||
bg1->setPosition( CCPointMake(size.width/2, size.height/2) );
|
||||
bg1->setPosition( CCPointMake(size.width/2, size.height/2) );
|
||||
addChild(bg1, -1);
|
||||
|
||||
CCLabelTTF* title = CCLabelTTF::labelWithString((transitions[s_nSceneIdx]).c_str(), "Thonburi", 32 );
|
||||
|
@ -369,8 +372,8 @@ TestLayer2::TestLayer2()
|
|||
addChild( label);
|
||||
|
||||
// menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer2::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer2::restartCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer2::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer2::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TestLayer2::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
@ -382,14 +385,14 @@ TestLayer2::TestLayer2()
|
|||
|
||||
addChild(menu, 1);
|
||||
|
||||
schedule(schedule_selector(TestLayer2::step), 1.0f);
|
||||
}
|
||||
|
||||
TestLayer2::~TestLayer2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
schedule(schedule_selector(TestLayer2::step), 1.0f);
|
||||
}
|
||||
|
||||
TestLayer2::~TestLayer2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TestLayer2::restartCallback(CCObject* pSender)
|
||||
{
|
||||
CCScene* s = new TransitionsTestScene();
|
||||
|
@ -400,9 +403,9 @@ void TestLayer2::restartCallback(CCObject* pSender)
|
|||
CCScene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
|
||||
s->release();
|
||||
pLayer->release();
|
||||
if (pScene)
|
||||
if (pScene)
|
||||
{
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,19 +422,19 @@ void TestLayer2::nextCallback(CCObject* pSender)
|
|||
CCScene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
|
||||
s->release();
|
||||
pLayer->release();
|
||||
if (pScene)
|
||||
if (pScene)
|
||||
{
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
}
|
||||
}
|
||||
|
||||
void TestLayer2::backCallback(CCObject* pSender)
|
||||
{
|
||||
void TestLayer2::backCallback(CCObject* pSender)
|
||||
{
|
||||
s_nSceneIdx--;
|
||||
int total = MAX_LAYER;
|
||||
if( s_nSceneIdx < 0 )
|
||||
s_nSceneIdx += total;
|
||||
|
||||
s_nSceneIdx += total;
|
||||
|
||||
CCScene* s = new TransitionsTestScene();
|
||||
|
||||
CCLayer* pLayer = new TestLayer1();
|
||||
|
@ -440,13 +443,13 @@ void TestLayer2::backCallback(CCObject* pSender)
|
|||
CCScene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
|
||||
s->release();
|
||||
pLayer->release();
|
||||
if (pScene)
|
||||
if (pScene)
|
||||
{
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
}
|
||||
}
|
||||
|
||||
void TestLayer2::step(ccTime dt)
|
||||
{
|
||||
|
||||
}
|
||||
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||
}
|
||||
}
|
||||
|
||||
void TestLayer2::step(ccTime dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue