add AtlasTest code
This commit is contained in:
natural-law 2010-09-07 03:47:54 +00:00
parent 43672e1770
commit f94441141f
10 changed files with 809 additions and 8 deletions

View File

@ -45,7 +45,7 @@ Supported features:
The quads are rendered using an OpenGL ES VBO.
To render the quads using an interleaved vertex array list, you should modify the ccConfig.h file
*/
class CCTextureAtlas : public NSObject
class CCX_DLL CCTextureAtlas : public NSObject
{
protected:
GLushort *m_pIndices;

View File

@ -755,11 +755,16 @@ void CCSprite::setIsVisible(bool bVisible)
m_bDirty = m_bRecursiveDirty = true;
CCNode *pChild;
NSMutableArray<CCNode*>::NSMutableArrayIterator iter;
for (iter = m_pChildren->begin(); iter != m_pChildren->end(); ++iter)
{
pChild = *iter;
pChild->setIsVisible(bVisible);
}
if (m_pChildren && m_pChildren->count() != 0)
{
for (iter = m_pChildren->begin(); iter != m_pChildren->end(); ++iter)
{
pChild = *iter;
CCX_BREAK_IF(! pChild);
pChild->setIsVisible(bVisible);
}
}
}
}
}

View File

@ -1 +0,0 @@
263832e2766c734b77335f353e3066033c158c90

View File

@ -0,0 +1 @@
9975e4961272d5bda6d5f3bbd61ea0fc02222199

View File

@ -659,6 +659,18 @@
>
</File>
</Filter>
<Filter
Name="AtlasTest"
>
<File
RelativePath=".\tests\AtlasTest\AtlasTest.cpp"
>
</File>
<File
RelativePath=".\tests\AtlasTest\AtlasTest.h"
>
</File>
</Filter>
</Filter>
<File
RelativePath=".\test_uphoneUnicodeScript.h"

View File

@ -0,0 +1,657 @@
#include "AtlasTest.h"
#include "../testResource.h"
enum {
kTagTileMap = 1,
kTagSpriteManager = 1,
kTagAnimation1 = 1,
kTagBitmapAtlas1 = 1,
kTagBitmapAtlas2 = 2,
kTagBitmapAtlas3 = 3,
};
enum {
kTagSprite1,
kTagSprite2,
kTagSprite3,
kTagSprite4,
kTagSprite5,
kTagSprite6,
kTagSprite7,
kTagSprite8,
};
//------------------------------------------------------------------
//
// AtlasDemo
//
//------------------------------------------------------------------
enum
{
IDC_NEXT = 100,
IDC_BACK,
IDC_RESTART
};
static int sceneIdx = -1;
#define MAX_LAYER 9
CCLayer* createAtlasLayer(int nIndex)
{
switch(nIndex)
{
case 0: return new Atlas1();
case 1: return new LabelAtlasTest();
case 2: return new LabelAtlasColorTest();
case 3: return new Atlas3();
case 4: return new Atlas4();
case 5: return new Atlas5();
case 6: return new Atlas6();
case 7: return new AtlasBitmapColor();
case 8: return new AtlasFastBitmap();
}
return NULL;
}
CCLayer* nextAtlasAction()
{
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
CCLayer* pLayer = createAtlasLayer(sceneIdx);
pLayer->autorelease();
return pLayer;
}
CCLayer* backAtlasAction()
{
sceneIdx--;
int total = MAX_LAYER;
if( sceneIdx < 0 )
sceneIdx += total;
CCLayer* pLayer = createAtlasLayer(sceneIdx);
pLayer->autorelease();
return pLayer;
}
CCLayer* restartAtlasAction()
{
CCLayer* pLayer = createAtlasLayer(sceneIdx);
pLayer->autorelease();
return pLayer;
}
AtlasDemo::AtlasDemo(void)
{
}
AtlasDemo::~AtlasDemo(void)
{
}
std::string AtlasDemo::title()
{
return "No title";
}
std::string AtlasDemo::subtitle()
{
return "";
}
void AtlasDemo::onEnter()
{
__super::onEnter();
CGSize s = CCDirector::getSharedDirector()->getWinSize();
CCLabel* label = CCLabel::labelWithString(title().c_str(), "Arial", 28);
addChild(label, 1);
label->setPosition( ccp(s.width/2, s.height-50) );
std::string strSubtitle = subtitle();
if( ! strSubtitle.empty() )
{
CCLabel* l = CCLabel::labelWithString(strSubtitle.c_str(), "Thonburi", 16);
addChild(l, 1);
l->setPosition( ccp(s.width/2, s.height-80) );
}
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(AtlasDemo::backCallback) );
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(AtlasDemo::restartCallback) );
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(AtlasDemo::nextCallback) );
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
menu->setPosition( CGPointZero );
item1->setPosition( ccp( s.width/2 - 100,30) );
item2->setPosition( ccp( s.width/2, 30) );
item3->setPosition( ccp( s.width/2 + 100,30) );
addChild(menu, 1);
}
void AtlasDemo::restartCallback(NSObject* pSender)
{
CCScene* s = new AtlasTestScene();
s->addChild(restartAtlasAction());
CCDirector::getSharedDirector()->replaceScene(s);
s->release();
}
void AtlasDemo::nextCallback(NSObject* pSender)
{
CCScene* s = new AtlasTestScene();
s->addChild( nextAtlasAction() );
CCDirector::getSharedDirector()->replaceScene(s);
s->release();
}
void AtlasDemo::backCallback(NSObject* pSender)
{
CCScene* s = new AtlasTestScene();
s->addChild( backAtlasAction() );
CCDirector::getSharedDirector()->replaceScene(s);
s->release();
}
//------------------------------------------------------------------
//
// Atlas1
//
//------------------------------------------------------------------
Atlas1::Atlas1()
{
m_textureAtlas = CCTextureAtlas::textureAtlasWithFile(s_AtlasTest, 3); m_textureAtlas->retain();
CGSize s = CCDirector::getSharedDirector()->getWinSize();
//
// Notice: u,v tex coordinates are inverted
//
ccV3F_C4B_T2F_Quad quads[] =
{
{
{{0,0,0},{0,0,255,255},{0.0f,1.0f},}, // bottom left
{{s.width,0,0},{0,0,255,0},{1.0f,1.0f},}, // bottom right
{{0,s.height,0},{0,0,255,0},{0.0f,0.0f},}, // top left
{{s.width,s.height,0},{0,0,255,255},{1.0f,0.0f},}, // top right
},
{
{{40,40,0},{255,255,255,255},{0.0f,0.2f},}, // bottom left
{{120,80,0},{255,0,0,255},{0.5f,0.2f},}, // bottom right
{{40,160,0},{255,255,255,255},{0.0f,0.0f},}, // top left
{{160,160,0},{0,255,0,255},{0.5f,0.0f},}, // top right
},
{
{{s.width/2,40,0},{255,0,0,255},{0.0f,1.0f},}, // bottom left
{{s.width,40,0},{0,255,0,255},{1.0f,1.0f},}, // bottom right
{{s.width/2-50,200,0},{0,0,255,255},{0.0f,0.0f},}, // top left
{{s.width,100,0},{255,255,0,255},{1.0f,0.0f},}, // top right
},
};
for( int i=0;i<3;i++)
{
m_textureAtlas->updateQuad(&quads[i], i);
}
}
Atlas1::~Atlas1()
{
m_textureAtlas->release();
}
void Atlas1::draw()
{
// GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// GL_TEXTURE_2D
m_textureAtlas->drawQuads();
// [textureAtlas drawNumberOfQuads:3];
}
std::string Atlas1::title()
{
return "CCTextureAtlas";
}
std::string Atlas1::subtitle()
{
return "Manual creation of CCTextureAtlas";
}
//------------------------------------------------------------------
//
// LabelAtlasTest
//
//------------------------------------------------------------------
LabelAtlasTest::LabelAtlasTest()
{
m_time = 0;
CCLabelAtlas* label1 = CCLabelAtlas::labelAtlasWithString("123 Test", "tuffy_bold_italic-charmap.png", 48, 64, ' ');
addChild(label1, 0, kTagSprite1);
label1->setPosition( ccp(10,100) );
label1->setOpacity( 200 );
CCLabelAtlas *label2 = CCLabelAtlas::labelAtlasWithString("0123456789", "tuffy_bold_italic-charmap.png", 48, 64, ' ');
addChild(label2, 0, kTagSprite2);
label2->setPosition( ccp(10,200) );
label2->setOpacity( 32 );
schedule(schedule_selector(LabelAtlasTest::step));
}
void LabelAtlasTest::step(ccTime dt)
{
m_time += dt;
char string[12] = {0};
sprintf(string, "%2.2f Test", m_time);
//string.format("%2.2f Test", m_time);
CCLabelAtlas* label1 = (CCLabelAtlas*)getChildByTag(kTagSprite1);
label1->setString(string);
CCLabelAtlas*label2 = (CCLabelAtlas*)getChildByTag(kTagSprite2);
sprintf(string, "%d", (int)m_time);
//string.format("%d", (int)m_time);
label2->setString(string);
}
std::string LabelAtlasTest::title()
{
return "LabelAtlas";
}
std::string LabelAtlasTest::subtitle()
{
return "Updating label should be fast";
}
//------------------------------------------------------------------
//
// LabelAtlasColorTest
//
//------------------------------------------------------------------
LabelAtlasColorTest::LabelAtlasColorTest()
{
CCLabelAtlas* label1 = CCLabelAtlas::labelAtlasWithString("123 Test", "tuffy_bold_italic-charmap.png", 48, 64, ' ');
addChild(label1, 0, kTagSprite1);
label1->setPosition( ccp(10,100) );
label1->setOpacity( 200 );
CCLabelAtlas* label2 = CCLabelAtlas::labelAtlasWithString("0123456789", "tuffy_bold_italic-charmap.png", 48, 64, ' ');
addChild(label2, 0, kTagSprite2);
label2->setPosition( ccp(10,200) );
label2->setColor( ccRED );
CCIntervalAction* fade = CCFadeOut::actionWithDuration(1.0f);
CCIntervalAction* fade_in = fade->reverse();
CCFiniteTimeAction* seq = CCSequence::actions(fade, fade_in, NULL);
CCAction* repeat = CCRepeatForever::actionWithAction( (CCIntervalAction*)seq );
label2->runAction( repeat );
m_time = 0;
schedule( schedule_selector(LabelAtlasColorTest::step) ); //:@selector(step:)];
}
void LabelAtlasColorTest::step(ccTime dt)
{
m_time += dt;
char string[12] = {0};
sprintf(string, "%2.2f Test", m_time);
//std::string string = std::string::stringWithFormat("%2.2f Test", m_time);
CCLabelAtlas* label1 = (CCLabelAtlas*)getChildByTag(kTagSprite1);
label1->setString(string);
CCLabelAtlas* label2 = (CCLabelAtlas*)getChildByTag(kTagSprite2);
sprintf(string, "%d", (int)m_time);
label2->setString( string );
}
std::string LabelAtlasColorTest::title()
{
return "CCLabelAtlas";
}
std::string LabelAtlasColorTest::subtitle()
{
return "Opacity + Color should work at the same time";
}
//------------------------------------------------------------------
//
// Atlas3
//
//------------------------------------------------------------------
Atlas3::Atlas3()
{
m_time = 0;
CCColorLayer* col = CCColorLayer::layerWithColor( ccc4(128,128,128,255) );
addChild(col, -10);
CCBitmapFontAtlas* label1 = CCBitmapFontAtlas::bitmapFontAtlasWithString("Test", "bitmapFontTest2.fnt");
// testing anchors
label1->setAnchorPoint( ccp(0,0) );
addChild(label1, 0, kTagBitmapAtlas1);
CCIntervalAction* fade = CCFadeOut::actionWithDuration(1.0f);
CCIntervalAction* fade_in = fade->reverse();
CCFiniteTimeAction* seq = CCSequence::actions(fade, fade_in, NULL);
CCAction* repeat = CCRepeatForever::actionWithAction((CCIntervalAction*)seq);
label1->runAction(repeat);
// VERY IMPORTANT
// color and opacity work OK because bitmapFontAltas2 loads a BMP image (not a PNG image)
// If you want to use both opacity and color, it is recommended to use NON premultiplied images like BMP images
// Of course, you can also tell XCode not to compress PNG images, but I think it doesn't work as expected
CCBitmapFontAtlas *label2 = CCBitmapFontAtlas::bitmapFontAtlasWithString("Test", "bitmapFontTest2.fnt");
// testing anchors
label2->setAnchorPoint( ccp(0.5f, 0.5f) );
label2->setColor( ccRED );
addChild(label2, 0, kTagBitmapAtlas2);
label2->runAction( (CCAction*)(repeat->copy()->autorelease()) );
CCBitmapFontAtlas* label3 = CCBitmapFontAtlas::bitmapFontAtlasWithString("Test", "bitmapFontTest2.fnt");
// testing anchors
label3->setAnchorPoint( ccp(1,1) );
addChild(label3, 0, kTagBitmapAtlas3);
CGSize s = CCDirector::getSharedDirector()->getWinSize();
label1->setPosition( ccp( 0,0) );
label2->setPosition( ccp( s.width/2, s.height/2) );
label3->setPosition( ccp( s.width, s.height) );
schedule( schedule_selector(Atlas3::step) );//:@selector(step:)];
}
void Atlas3::step(ccTime dt)
{
m_time += dt;
//std::string string;
char string[15] = {0};
sprintf(string, "%2.2f Test j", m_time);
//string.format("%2.2f Test j", m_time);
CCBitmapFontAtlas *label1 = (CCBitmapFontAtlas*) getChildByTag(kTagBitmapAtlas1);
label1->setString(string);
CCBitmapFontAtlas *label2 = (CCBitmapFontAtlas*) getChildByTag(kTagBitmapAtlas2);
label2->setString(string);
CCBitmapFontAtlas *label3 = (CCBitmapFontAtlas*) getChildByTag(kTagBitmapAtlas3);
label3->setString(string);
}
std::string Atlas3::title()
{
return "CCBitmapFontAtlas";
}
std::string Atlas3::subtitle()
{
return "Testing alignment. Testing opacity + tint";
}
//------------------------------------------------------------------
//
// Atlas4
//
//------------------------------------------------------------------
Atlas4::Atlas4()
{
m_time = 0;
// Upper Label
CCBitmapFontAtlas *label = CCBitmapFontAtlas::bitmapFontAtlasWithString("Bitmap Font Atlas", "bitmapFontTest.fnt");
addChild(label);
CGSize s = CCDirector::getSharedDirector()->getWinSize();
label->setPosition( ccp(s.width/2, s.height/2) );
label->setAnchorPoint( ccp(0.5f, 0.5f) );
CCSprite* BChar = (CCSprite*) label->getChildByTag(0);
CCSprite* FChar = (CCSprite*) label->getChildByTag(7);
CCSprite* AChar = (CCSprite*) label->getChildByTag(12);
CCIntervalAction* rotate = CCRotateBy::actionWithDuration(2, 360);
CCAction* rot_4ever = CCRepeatForever::actionWithAction(rotate);
CCIntervalAction* scale = CCScaleBy::actionWithDuration(2, 1.5f);
CCIntervalAction* scale_back = scale->reverse();
CCFiniteTimeAction* scale_seq = CCSequence::actions(scale, scale_back,NULL);
CCAction* scale_4ever = CCRepeatForever::actionWithAction((CCIntervalAction*)scale_seq);
CCIntervalAction* jump = CCJumpBy::actionWithDuration(0.5f, CGPointZero, 60, 1);
CCAction* jump_4ever = CCRepeatForever::actionWithAction(jump);
CCIntervalAction* fade_out = CCFadeOut::actionWithDuration(1);
CCIntervalAction* fade_in = CCFadeIn::actionWithDuration(1);
CCFiniteTimeAction* seq = CCSequence::actions(fade_out, fade_in, NULL);
CCAction* fade_4ever = CCRepeatForever::actionWithAction((CCIntervalAction*)seq);
BChar->runAction(rot_4ever);
BChar->runAction(scale_4ever);
FChar->runAction(jump_4ever);
AChar->runAction(fade_4ever);
// Bottom Label
CCBitmapFontAtlas *label2 = CCBitmapFontAtlas::bitmapFontAtlasWithString("00.0", "bitmapFontTest.fnt");
addChild(label2, 0, kTagBitmapAtlas2);
label2->setPosition( ccp(s.width/2.0f, 80) );
CCSprite* lastChar = (CCSprite*) label2->getChildByTag(3);
lastChar->runAction( (CCAction*)(rot_4ever->copy()->autorelease()) );
schedule( schedule_selector(Atlas4::step), 0.1f);
}
void Atlas4::draw()
{
CGSize s = CCDirector::getSharedDirector()->getWinSize();
ccDrawLine( ccp(0, s.height/2), ccp(s.width, s.height/2) );
ccDrawLine( ccp(s.width/2, 0), ccp(s.width/2, s.height) );
}
void Atlas4::step(ccTime dt)
{
m_time += dt;
char string[10] = {0};
sprintf(string, "%04.1f", m_time);
// std::string string;
// string.format("%04.1f", m_time);
CCBitmapFontAtlas* label1 = (CCBitmapFontAtlas*) getChildByTag(kTagBitmapAtlas2);
label1->setString(string);
}
std::string Atlas4::title()
{
return "CCBitmapFontAtlas";
}
std::string Atlas4::subtitle()
{
return "Using fonts as CCSprite objects. Some characters should rotate.";
}
//------------------------------------------------------------------
//
// Atlas5
//
//------------------------------------------------------------------
Atlas5::Atlas5()
{
CCBitmapFontAtlas *label = CCBitmapFontAtlas::bitmapFontAtlasWithString("abcdefg", "bitmapFontTest4.fnt");
addChild(label);
CGSize s = CCDirector::getSharedDirector()->getWinSize();
label->setPosition( ccp(s.width/2, s.height/2) );
label->setAnchorPoint( ccp(0.5f, 0.5f) );
}
std::string Atlas5::title()
{
return "CCBitmapFontAtlas";
}
std::string Atlas5::subtitle()
{
return "Testing padding";
}
//------------------------------------------------------------------
//
// Atlas6
//
//------------------------------------------------------------------
Atlas6::Atlas6()
{
CGSize s = CCDirector::getSharedDirector()->getWinSize();
CCBitmapFontAtlas* label = NULL;
label = CCBitmapFontAtlas::bitmapFontAtlasWithString("FaFeFiFoFu", "bitmapFontTest5.fnt");
addChild(label);
label->setPosition( ccp(s.width/2, s.height/2+50) );
label->setAnchorPoint( ccp(0.5f, 0.5f) ) ;
label = CCBitmapFontAtlas::bitmapFontAtlasWithString("fafefifofu", "bitmapFontTest5.fnt");
addChild(label);
label->setPosition( ccp(s.width/2, s.height/2) );
label->setAnchorPoint( ccp(0.5f, 0.5f) );
label = CCBitmapFontAtlas::bitmapFontAtlasWithString("aeiou", "bitmapFontTest5.fnt");
addChild(label);
label->setPosition( ccp(s.width/2, s.height/2-50) );
label->setAnchorPoint( ccp(0.5f, 0.5f) );
}
std::string Atlas6::title()
{
return "CCBitmapFontAtlas";
}
std::string Atlas6::subtitle()
{
return "Rendering should be OK. Testing offset";
}
//------------------------------------------------------------------
//
// AtlasBitmapColor
//
//------------------------------------------------------------------
/*
* Use any of these editors to generate bitmap font atlas:
* http://www.n4te.com/hiero/hiero.jnlp
* http://slick.cokeandcode.com/demos/hiero.jnlp
* http://www.angelcode.com/products/bmfont/
*/
AtlasBitmapColor::AtlasBitmapColor()
{
CGSize s = CCDirector::getSharedDirector()->getWinSize();
CCBitmapFontAtlas* label = NULL;
label = CCBitmapFontAtlas::bitmapFontAtlasWithString("Blue", "bitmapFontTest5.fnt");
label->setColor( ccBLUE );
addChild(label);
label->setPosition( ccp(s.width/2, s.height/4) );
label->setAnchorPoint( ccp(0.5f, 0.5f) );
label = CCBitmapFontAtlas::bitmapFontAtlasWithString("Red", "bitmapFontTest5.fnt");
addChild(label);
label->setPosition( ccp(s.width/2, 2*s.height/4) );
label->setAnchorPoint( ccp(0.5f, 0.5f) );
label->setColor( ccRED );
label = CCBitmapFontAtlas::bitmapFontAtlasWithString("G", "bitmapFontTest5.fnt");
addChild(label);
label->setPosition( ccp(s.width/2, 3*s.height/4) );
label->setAnchorPoint( ccp(0.5f, 0.5f) );
label->setColor( ccGREEN );
label->setString("Green");
}
std::string AtlasBitmapColor::title()
{
return "CCBitmapFontAtlas";
}
std::string AtlasBitmapColor::subtitle()
{
return "Testing color";
}
//------------------------------------------------------------------
//
// AtlasFastBitmap
//
//------------------------------------------------------------------
AtlasFastBitmap::AtlasFastBitmap()
{
// Upper Label
for( int i=0 ; i < 100;i ++ )
{
char str[6] = {0};
sprintf(str, "-%d-", i);
CCBitmapFontAtlas* label = CCBitmapFontAtlas::bitmapFontAtlasWithString(str, "bitmapFontTest.fnt");
addChild(label);
CGSize s = CCDirector::getSharedDirector()->getWinSize();
CGPoint p = ccp( CCRANDOM_0_1() * s.width, CCRANDOM_0_1() * s.height);
label->setPosition( p );
label->setAnchorPoint(ccp(0.5f, 0.5f));
}
}
std::string AtlasFastBitmap::title()
{
return "CCBitmapFontAtlas";
}
std::string AtlasFastBitmap::subtitle()
{
return "Creating several CCBitmapFontAtlas with the same .fnt file should be fast";
}
void AtlasTestScene::runThisTest()
{
CCLayer* pLayer = nextAtlasAction();
addChild(pLayer);
CCDirector::getSharedDirector()->replaceScene(this);
}

View File

@ -0,0 +1,121 @@
#ifndef _ATLAS_TEST_H_
#define _ATLAS_TEST_H_
#include "../testBasic.h"
class AtlasDemo : public CCLayer
{
protected:
public:
AtlasDemo(void);
~AtlasDemo(void);
virtual std::string title();
virtual std::string subtitle();
virtual void onEnter();
void restartCallback(NSObject* pSender);
void nextCallback(NSObject* pSender);
void backCallback(NSObject* pSender);
};
class Atlas1 : public AtlasDemo
{
CCTextureAtlas* m_textureAtlas;
public:
Atlas1();
~Atlas1();
virtual std::string title();
virtual std::string subtitle();
virtual void draw();
};
class LabelAtlasTest : public AtlasDemo
{
ccTime m_time;
public:
LabelAtlasTest();
virtual void step(ccTime dt);
virtual std::string title();
virtual std::string subtitle();
};
class LabelAtlasColorTest : public AtlasDemo
{
ccTime m_time;
public:
LabelAtlasColorTest();
virtual void step(ccTime dt);
virtual std::string title();
virtual std::string subtitle();
};
class Atlas3 : public AtlasDemo
{
ccTime m_time;
public:
Atlas3();
virtual void step(ccTime dt);
virtual std::string title();
virtual std::string subtitle();
};
class Atlas4 : public AtlasDemo
{
ccTime m_time;
public:
Atlas4();
virtual void step(ccTime dt);
virtual void draw();
virtual std::string title();
virtual std::string subtitle();
};
class Atlas5 : public AtlasDemo
{
public:
Atlas5();
virtual std::string title();
virtual std::string subtitle();
};
class Atlas6 : public AtlasDemo
{
public:
Atlas6();
virtual std::string title();
virtual std::string subtitle();
};
class AtlasBitmapColor : public AtlasDemo
{
public:
AtlasBitmapColor();
virtual std::string title();
virtual std::string subtitle();
};
class AtlasFastBitmap : public AtlasDemo
{
public:
AtlasFastBitmap();
virtual std::string title();
virtual std::string subtitle();
};
class AtlasTestScene : public TestScene
{
public:
virtual void runThisTest();
};
#endif

View File

@ -56,6 +56,8 @@ static TestScene* CreateTestScene(int nIdx)
case TESTS_CHIPMUNK:
CCDirector::getSharedDirector()->setDeviceOrientation(kCCDeviceOrientationPortrait);
pScene = new ChipmunkTestScene(); break;
case TEST_ATLAS:
pScene = new AtlasTestScene(); break;
default:
break;
}

View File

@ -33,6 +33,7 @@ static const char s_MenuItem[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_test
static const char s_SendScore[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/SendScoreButton.png";
static const char s_PressSendScore[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/SendScoreButtonPressed.png";
static const char s_Power[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/powered.png";
static const char s_AtlasTest[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/atlastest.png";
// tilemaps resource
static const char s_TilesPng[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/TileMaps/tiles.png";

View File

@ -21,6 +21,7 @@
#include "TileMapTest/TileMapTest.h"
#include "cocos2dChipmunkDemo.h"
#include "IntervalTest/IntervalTest.h"
#include "AtlasTest/AtlasTest.h"
enum
{
@ -44,6 +45,7 @@ enum
TEST_TILE_MAP,
TEST_INTERVAL,
TESTS_CHIPMUNK,
TEST_ATLAS,
TESTS_COUNT,
};
@ -67,7 +69,8 @@ const std::string g_aTestNames[TESTS_COUNT] = {
"ParallaxTest",
"TileMapTest",
"IntervalTest",
"ChipmunkTest"
"ChipmunkTest",
"AtlasTest",
};
#endif