diff --git a/cocos2dx/include/CCTextureAtlas.h b/cocos2dx/include/CCTextureAtlas.h index 4f9f30c236..057edbd2ad 100644 --- a/cocos2dx/include/CCTextureAtlas.h +++ b/cocos2dx/include/CCTextureAtlas.h @@ -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; diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 36e53a32f1..7d166b334e 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -755,11 +755,16 @@ void CCSprite::setIsVisible(bool bVisible) m_bDirty = m_bRecursiveDirty = true; CCNode *pChild; NSMutableArray::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); + } + } } } } diff --git a/test_uphone/Res/fonts/bitmapFontTest2.bmp.REMOVED.git-id b/test_uphone/Res/fonts/bitmapFontTest2.bmp.REMOVED.git-id deleted file mode 100644 index b934758bd2..0000000000 --- a/test_uphone/Res/fonts/bitmapFontTest2.bmp.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -263832e2766c734b77335f353e3066033c158c90 \ No newline at end of file diff --git a/test_uphone/Res/fonts/bitmapFontTest2.png.REMOVED.git-id b/test_uphone/Res/fonts/bitmapFontTest2.png.REMOVED.git-id new file mode 100644 index 0000000000..d025022480 --- /dev/null +++ b/test_uphone/Res/fonts/bitmapFontTest2.png.REMOVED.git-id @@ -0,0 +1 @@ +9975e4961272d5bda6d5f3bbd61ea0fc02222199 \ No newline at end of file diff --git a/test_uphone/test_uphone.vcproj b/test_uphone/test_uphone.vcproj index d63cf0103e..1d1f79f6e1 100644 --- a/test_uphone/test_uphone.vcproj +++ b/test_uphone/test_uphone.vcproj @@ -659,6 +659,18 @@ > + + + + + + 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); +} diff --git a/test_uphone/tests/AtlasTest/AtlasTest.h b/test_uphone/tests/AtlasTest/AtlasTest.h new file mode 100644 index 0000000000..1974d22e96 --- /dev/null +++ b/test_uphone/tests/AtlasTest/AtlasTest.h @@ -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 diff --git a/test_uphone/tests/controller.cpp b/test_uphone/tests/controller.cpp index 3f652ddd3c..f7e36e1e22 100644 --- a/test_uphone/tests/controller.cpp +++ b/test_uphone/tests/controller.cpp @@ -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; } diff --git a/test_uphone/tests/testResource.h b/test_uphone/tests/testResource.h index e1b6de9975..0eaa0a9bf5 100644 --- a/test_uphone/tests/testResource.h +++ b/test_uphone/tests/testResource.h @@ -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"; diff --git a/test_uphone/tests/tests.h b/test_uphone/tests/tests.h index ff5c80c74f..bf8f508026 100644 --- a/test_uphone/tests/tests.h +++ b/test_uphone/tests/tests.h @@ -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