mirror of https://github.com/axmolengine/axmol.git
Adds Base class to tests
Base class displays the Menu( <- O -> ) Improved in some tests the way to create entries. Instead of defining the tests twice: the "create" method, and the entry in the array, it is only needed in the array (ActionsTest, SpriteTest and Texture2DTest)
This commit is contained in:
parent
698e4092ae
commit
80117afc82
|
@ -82,28 +82,6 @@ std::string ActionManagerTest::title()
|
|||
return "No title";
|
||||
}
|
||||
|
||||
void ActionManagerTest::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, std::bind(&ActionManagerTest::backCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, std::bind(&ActionManagerTest::restartCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, std::bind(&ActionManagerTest::nextCallback, this, std::placeholders::_1));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
||||
void ActionManagerTest::restartCallback(CCObject* pSender)
|
||||
{
|
||||
CCScene* s = new ActionManagerTestScene();
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#define _ACTION_MANAGER_TEST_H_
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class ActionManagerTest: public CCLayer
|
||||
class ActionManagerTest: public BaseTest
|
||||
{
|
||||
protected:
|
||||
CCTextureAtlas* m_atlas;
|
||||
|
@ -15,7 +16,6 @@ public:
|
|||
~ActionManagerTest(void);
|
||||
|
||||
virtual std::string title();
|
||||
virtual void onEnter();
|
||||
|
||||
void restartCallback(CCObject* pSender);
|
||||
void nextCallback(CCObject* pSender);
|
||||
|
|
|
@ -606,7 +606,7 @@ std::string EaseSpriteDemo::title()
|
|||
|
||||
void EaseSpriteDemo::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
BaseTest::onEnter();
|
||||
|
||||
// Or you can create an sprite using a filename. PNG and BMP files are supported. Probably TIFF too
|
||||
m_grossini = CCSprite::create(s_pPathGrossini); m_grossini->retain();
|
||||
|
@ -620,23 +620,6 @@ void EaseSpriteDemo::onEnter()
|
|||
m_grossini->setPosition(ccp(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*1/5));
|
||||
m_kathia->setPosition(ccp(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2.5f/5));
|
||||
m_tamara->setPosition(ccp(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*4/5));
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label);
|
||||
label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, std::bind(&EaseSpriteDemo::backCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, std::bind(&EaseSpriteDemo::restartCallback , this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, std::bind(&EaseSpriteDemo::nextCallback, this, std::placeholders::_1) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
||||
void EaseSpriteDemo::restartCallback(CCObject* pSender)
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
|
||||
////----#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
class EaseSpriteDemo : public CCLayer
|
||||
class EaseSpriteDemo : public BaseTest
|
||||
{
|
||||
protected:
|
||||
CCSprite* m_grossini;
|
||||
|
|
|
@ -90,32 +90,7 @@ std::string SpriteDemo::subtitle()
|
|||
|
||||
void SpriteDemo::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 18);
|
||||
addChild(label, 1);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 22);
|
||||
addChild(l, 1);
|
||||
l->setPosition( ccp(s.width/2, s.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(SpriteDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(SpriteDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(SpriteDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
addChild(menu, 1);
|
||||
BaseTest::onEnter();
|
||||
|
||||
CCLayerColor *background = CCLayerColor::create(ccc4(255,0,0,255));
|
||||
addChild(background, -10);
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#define _ACTIONS_PROGRESS_TEST_H_
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class SpriteDemo : public CCLayer
|
||||
class SpriteDemo : public BaseTest
|
||||
{
|
||||
public:
|
||||
SpriteDemo(void);
|
||||
|
|
|
@ -2,101 +2,53 @@
|
|||
#include "../testResource.h"
|
||||
#include "cocos2d.h"
|
||||
|
||||
TESTLAYER_CREATE_FUNC(ActionManual);
|
||||
TESTLAYER_CREATE_FUNC(ActionMove);
|
||||
TESTLAYER_CREATE_FUNC(ActionRotate);
|
||||
TESTLAYER_CREATE_FUNC(ActionScale);
|
||||
TESTLAYER_CREATE_FUNC(ActionSkew);
|
||||
TESTLAYER_CREATE_FUNC(ActionRotationalSkew);
|
||||
TESTLAYER_CREATE_FUNC(ActionRotationalSkewVSStandardSkew);
|
||||
TESTLAYER_CREATE_FUNC(ActionSkewRotateScale);
|
||||
TESTLAYER_CREATE_FUNC(ActionJump);
|
||||
TESTLAYER_CREATE_FUNC(ActionCardinalSpline);
|
||||
TESTLAYER_CREATE_FUNC(ActionCatmullRom);
|
||||
TESTLAYER_CREATE_FUNC(ActionBezier);
|
||||
TESTLAYER_CREATE_FUNC(ActionBlink);
|
||||
TESTLAYER_CREATE_FUNC(ActionFade);
|
||||
TESTLAYER_CREATE_FUNC(ActionTint);
|
||||
TESTLAYER_CREATE_FUNC(ActionAnimate);
|
||||
TESTLAYER_CREATE_FUNC(ActionSequence);
|
||||
TESTLAYER_CREATE_FUNC(ActionSequence2);
|
||||
TESTLAYER_CREATE_FUNC(ActionSpawn);
|
||||
TESTLAYER_CREATE_FUNC(ActionReverse);
|
||||
TESTLAYER_CREATE_FUNC(ActionDelayTime);
|
||||
TESTLAYER_CREATE_FUNC(ActionRepeat);
|
||||
TESTLAYER_CREATE_FUNC(ActionRepeatForever);
|
||||
TESTLAYER_CREATE_FUNC(ActionRotateToRepeat);
|
||||
TESTLAYER_CREATE_FUNC(ActionRotateJerk);
|
||||
TESTLAYER_CREATE_FUNC(ActionCallFunction);
|
||||
TESTLAYER_CREATE_FUNC(ActionCallFunc);
|
||||
TESTLAYER_CREATE_FUNC(ActionCallFuncND);
|
||||
TESTLAYER_CREATE_FUNC(ActionReverseSequence);
|
||||
TESTLAYER_CREATE_FUNC(ActionReverseSequence2);
|
||||
TESTLAYER_CREATE_FUNC(ActionRemoveSelf);
|
||||
TESTLAYER_CREATE_FUNC(ActionOrbit);
|
||||
TESTLAYER_CREATE_FUNC(ActionFollow);
|
||||
TESTLAYER_CREATE_FUNC(ActionTargeted);
|
||||
TESTLAYER_CREATE_FUNC(ActionMoveStacked);
|
||||
TESTLAYER_CREATE_FUNC(ActionMoveJumpStacked);
|
||||
TESTLAYER_CREATE_FUNC(ActionMoveBezierStacked);
|
||||
TESTLAYER_CREATE_FUNC(ActionCardinalSplineStacked);
|
||||
TESTLAYER_CREATE_FUNC(ActionCatmullRomStacked);
|
||||
TESTLAYER_CREATE_FUNC(PauseResumeActions);
|
||||
TESTLAYER_CREATE_FUNC(Issue1305);
|
||||
TESTLAYER_CREATE_FUNC(Issue1305_2);
|
||||
TESTLAYER_CREATE_FUNC(Issue1288);
|
||||
TESTLAYER_CREATE_FUNC(Issue1288_2);
|
||||
TESTLAYER_CREATE_FUNC(Issue1327);
|
||||
TESTLAYER_CREATE_FUNC(Issue1398);
|
||||
|
||||
|
||||
static NEWTESTFUNC createFunctions[] = {
|
||||
CF(ActionManual),
|
||||
CF(ActionMove),
|
||||
CF(ActionRotate),
|
||||
CF(ActionScale),
|
||||
CF(ActionSkew),
|
||||
CF(ActionRotationalSkew),
|
||||
CF(ActionRotationalSkewVSStandardSkew),
|
||||
CF(ActionSkewRotateScale),
|
||||
CF(ActionJump),
|
||||
CF(ActionCardinalSpline),
|
||||
CF(ActionCatmullRom),
|
||||
CF(ActionBezier),
|
||||
CF(ActionBlink),
|
||||
CF(ActionFade),
|
||||
CF(ActionTint),
|
||||
CF(ActionAnimate),
|
||||
CF(ActionSequence),
|
||||
CF(ActionSequence2),
|
||||
CF(ActionRemoveSelf),
|
||||
CF(ActionSpawn),
|
||||
CF(ActionReverse),
|
||||
CF(ActionDelayTime),
|
||||
CF(ActionRepeat),
|
||||
CF(ActionRepeatForever),
|
||||
CF(ActionRotateToRepeat),
|
||||
CF(ActionRotateJerk),
|
||||
CF(ActionCallFunction),
|
||||
CF(ActionCallFunc),
|
||||
CF(ActionCallFuncND),
|
||||
CF(ActionReverseSequence),
|
||||
CF(ActionReverseSequence2),
|
||||
CF(ActionOrbit),
|
||||
CF(ActionFollow),
|
||||
CF(ActionTargeted),
|
||||
CF(ActionMoveStacked),
|
||||
CF(ActionMoveJumpStacked),
|
||||
CF(ActionMoveBezierStacked),
|
||||
CF(ActionCardinalSplineStacked),
|
||||
CF(ActionCatmullRomStacked),
|
||||
CF(PauseResumeActions),
|
||||
CF(Issue1305),
|
||||
CF(Issue1305_2),
|
||||
CF(Issue1288),
|
||||
CF(Issue1288_2),
|
||||
CF(Issue1327),
|
||||
CF(Issue1398)
|
||||
static std::function<CCLayer*()> createFunctions[] = {
|
||||
CL(ActionManual),
|
||||
CL(ActionMove),
|
||||
CL(ActionRotate),
|
||||
CL(ActionScale),
|
||||
CL(ActionSkew),
|
||||
CL(ActionRotationalSkew),
|
||||
CL(ActionRotationalSkewVSStandardSkew),
|
||||
CL(ActionSkewRotateScale),
|
||||
CL(ActionJump),
|
||||
CL(ActionCardinalSpline),
|
||||
CL(ActionCatmullRom),
|
||||
CL(ActionBezier),
|
||||
CL(ActionBlink),
|
||||
CL(ActionFade),
|
||||
CL(ActionTint),
|
||||
CL(ActionAnimate),
|
||||
CL(ActionSequence),
|
||||
CL(ActionSequence2),
|
||||
CL(ActionRemoveSelf),
|
||||
CL(ActionSpawn),
|
||||
CL(ActionReverse),
|
||||
CL(ActionDelayTime),
|
||||
CL(ActionRepeat),
|
||||
CL(ActionRepeatForever),
|
||||
CL(ActionRotateToRepeat),
|
||||
CL(ActionRotateJerk),
|
||||
CL(ActionCallFunction),
|
||||
CL(ActionCallFunc),
|
||||
CL(ActionCallFuncND),
|
||||
CL(ActionReverseSequence),
|
||||
CL(ActionReverseSequence2),
|
||||
CL(ActionOrbit),
|
||||
CL(ActionFollow),
|
||||
CL(ActionTargeted),
|
||||
CL(ActionMoveStacked),
|
||||
CL(ActionMoveJumpStacked),
|
||||
CL(ActionMoveBezierStacked),
|
||||
CL(ActionCardinalSplineStacked),
|
||||
CL(ActionCatmullRomStacked),
|
||||
CL(PauseResumeActions),
|
||||
CL(Issue1305),
|
||||
CL(Issue1305_2),
|
||||
CL(Issue1288),
|
||||
CL(Issue1288_2),
|
||||
CL(Issue1327),
|
||||
CL(Issue1398)
|
||||
};
|
||||
|
||||
static int sceneIdx=-1;
|
||||
|
@ -158,7 +110,7 @@ std::string ActionsDemo::subtitle()
|
|||
|
||||
void ActionsDemo::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
BaseTest::onEnter();
|
||||
|
||||
// Or you can create an sprite using a filename. only PNG is supported now. Probably TIFF too
|
||||
m_grossini = CCSprite::create(s_pPathGrossini);
|
||||
|
@ -177,35 +129,6 @@ void ActionsDemo::onEnter()
|
|||
m_grossini->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/3));
|
||||
m_tamara->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2/3));
|
||||
m_kathia->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/2));
|
||||
|
||||
// add title and subtitle
|
||||
std::string str = title();
|
||||
const char * pTitle = str.c_str();
|
||||
CCLabelTTF* label = CCLabelTTF::create(pTitle, "Arial", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
}
|
||||
|
||||
// add menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, std::bind( &ActionsDemo::backCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, std::bind( &ActionsDemo::restartCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, std::bind( &ActionsDemo::nextCallback, this, std::placeholders::_1) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
||||
void ActionsDemo::onExit()
|
||||
|
@ -214,7 +137,7 @@ void ActionsDemo::onExit()
|
|||
m_tamara->release();
|
||||
m_kathia->release();
|
||||
|
||||
CCLayer::onExit();
|
||||
BaseTest::onExit();
|
||||
}
|
||||
|
||||
void ActionsDemo::restartCallback(CCObject* pSender)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _ActionsTest_H_
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
////----#include "cocos2d.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
@ -63,7 +64,7 @@ public:
|
|||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class ActionsDemo : public CCLayer
|
||||
class ActionsDemo : public BaseTest
|
||||
{
|
||||
protected:
|
||||
CCSprite* m_grossini;
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
//
|
||||
// BaseTest.cpp
|
||||
// TestCpp
|
||||
//
|
||||
// Created by Ricardo Quesada on 6/6/13.
|
||||
//
|
||||
//
|
||||
|
||||
#include "BaseTest.h"
|
||||
#include "VisibleRect.h"
|
||||
#include "testResource.h"
|
||||
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
void BaseTest::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
// add title and subtitle
|
||||
std::string str = title();
|
||||
const char * pTitle = str.c_str();
|
||||
CCLabelTTF* label = CCLabelTTF::create(pTitle, "Arial", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
}
|
||||
|
||||
// add menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, std::bind( &BaseTest::backCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, std::bind( &BaseTest::restartCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, std::bind( &BaseTest::nextCallback, this, std::placeholders::_1) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
|
||||
}
|
||||
|
||||
void BaseTest::onExit()
|
||||
{
|
||||
CCLayer::onExit();
|
||||
}
|
||||
|
||||
std::string BaseTest::title()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string BaseTest::subtitle()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void BaseTest::restartCallback(CCObject* pSender)
|
||||
{
|
||||
CCLog("override restart!");
|
||||
}
|
||||
|
||||
void BaseTest::nextCallback(CCObject* pSender)
|
||||
{
|
||||
CCLog("override next!");
|
||||
}
|
||||
|
||||
void BaseTest::backCallback(CCObject* pSender)
|
||||
{
|
||||
CCLog("override back!");
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
//
|
||||
// BaseTest.h
|
||||
// TestCpp
|
||||
//
|
||||
// Created by Ricardo Quesada on 6/6/13.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __TestCpp__BaseTest__
|
||||
#define __TestCpp__BaseTest__
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
class BaseTest : public cocos2d::CCLayer
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
||||
virtual void restartCallback(CCObject* pSender);
|
||||
virtual void nextCallback(CCObject* pSender);
|
||||
virtual void backCallback(CCObject* pSender);
|
||||
};
|
||||
|
||||
|
||||
#endif /* defined(__TestCpp__BaseTest__) */
|
|
@ -92,40 +92,13 @@ static CCLayer* restartAction()
|
|||
|
||||
bool BaseClippingNodeTest::init()
|
||||
{
|
||||
if (CCLayer::init()) {
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
if (BaseTest::init()) {
|
||||
|
||||
CCSprite *background = CCSprite::create(s_back3);
|
||||
background->setAnchorPoint( CCPointZero );
|
||||
background->setPosition( CCPointZero );
|
||||
this->addChild(background, -1);
|
||||
|
||||
CCLabelTTF *label = CCLabelTTF::create(this->title().c_str(), "Arial", 32);
|
||||
this->addChild(label, 1, kTagTitleLabel);
|
||||
label->setPosition( ccp(s.width / 2, s.height - 50));
|
||||
|
||||
std::string subtitleText = this->subtitle();
|
||||
if (subtitleText.length() > 0) {
|
||||
CCLabelTTF *subtitle = CCLabelTTF::create(subtitleText.c_str(), "Thonburi", 16);
|
||||
this->addChild(subtitle, 1, kTagSubtitleLabel);
|
||||
subtitle->setPosition(ccp(s.width / 2, s.height - 80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2,
|
||||
this, menu_selector(BaseClippingNodeTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2,
|
||||
this, menu_selector(BaseClippingNodeTest::restartCallback));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2,
|
||||
this, menu_selector(BaseClippingNodeTest::nextCallback));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp(s.width / 2 - item2->getContentSize().width * 2, item2->getContentSize().height / 2));
|
||||
item2->setPosition( ccp(s.width / 2, item2->getContentSize().height / 2));
|
||||
item3->setPosition( ccp(s.width / 2 + item2->getContentSize().width * 2, item2->getContentSize().height / 2));
|
||||
this->addChild(menu, 1);
|
||||
|
||||
this->setup();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#define __CLIPPINGNODETEST_H__
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class BaseClippingNodeTest : public CCLayer
|
||||
class BaseClippingNodeTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
~BaseClippingNodeTest();
|
||||
|
|
|
@ -76,41 +76,12 @@ std::string ConfigurationBase::subtitle()
|
|||
|
||||
void ConfigurationBase::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
// add title and subtitle
|
||||
std::string str = title();
|
||||
const char * pTitle = str.c_str();
|
||||
CCLabelTTF* label = CCLabelTTF::create(pTitle, "Arial", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
}
|
||||
|
||||
// add menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ConfigurationBase::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ConfigurationBase::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(ConfigurationBase::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void ConfigurationBase::onExit()
|
||||
{
|
||||
CCLayer::onExit();
|
||||
BaseTest::onExit();
|
||||
}
|
||||
|
||||
void ConfigurationBase::restartCallback(CCObject* pSender)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __CONFIGURATIONTEST_H__
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
|
@ -15,7 +16,7 @@ public:
|
|||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class ConfigurationBase : public CCLayer
|
||||
class ConfigurationBase : public BaseTest
|
||||
{
|
||||
protected:
|
||||
|
||||
|
|
|
@ -66,33 +66,7 @@ BaseLayer::BaseLayer()
|
|||
|
||||
void BaseLayer::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF *label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label);
|
||||
label->setPosition(ccp(s.width/2, s.height-50));
|
||||
|
||||
string subTitle = subtitle();
|
||||
if (subTitle.size() > 0)
|
||||
{
|
||||
CCLabelTTF *l = CCLabelTTF::create(subTitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(BaseLayer::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png", "Images/r2.png", this, menu_selector(BaseLayer::restartCallback));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", this, menu_selector(BaseLayer::nextCallback));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
|
||||
item1->setPosition(ccp(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(s.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
addChild(menu, 100);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void BaseLayer::restartCallback(cocos2d::CCObject *pSender)
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
|
||||
#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class BaseLayer : public CCLayer
|
||||
class BaseLayer : public BaseTest
|
||||
{
|
||||
public:
|
||||
BaseLayer();
|
||||
|
|
|
@ -333,7 +333,7 @@ CCLayer* restartEffectAdvanceAction()
|
|||
|
||||
void EffectAdvanceTextLayer::onEnter(void)
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
BaseTest::onEnter();
|
||||
|
||||
CCSprite *bg = CCSprite::create("Images/background3.png");
|
||||
addChild(bg, 0, kTagBackground);
|
||||
|
@ -351,34 +351,7 @@ void EffectAdvanceTextLayer::onEnter(void)
|
|||
tamara->setPosition( ccp(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3.0f,VisibleRect::bottom().y+200) );
|
||||
CCActionInterval* sc2 = CCScaleBy::create(2, 5);
|
||||
CCActionInterval* sc2_back = sc2->reverse();
|
||||
tamara->runAction( CCRepeatForever::create(CCSequence::create(sc2, sc2_back, NULL) ) );
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Marker Felt", 28);
|
||||
|
||||
label->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) );
|
||||
addChild(label);
|
||||
label->setTag( kTagLabel );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 101);
|
||||
l->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(EffectAdvanceTextLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png","Images/r2.png", this, menu_selector(EffectAdvanceTextLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", this, menu_selector(EffectAdvanceTextLayer::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
tamara->runAction( CCRepeatForever::create(CCSequence::create(sc2, sc2_back, NULL) ) );
|
||||
}
|
||||
|
||||
EffectAdvanceTextLayer::~EffectAdvanceTextLayer(void)
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class EffectAdvanceTextLayer: public CCLayer
|
||||
class EffectAdvanceTextLayer: public BaseTest
|
||||
{
|
||||
protected:
|
||||
CCTextureAtlas* m_atlas;
|
||||
|
|
|
@ -337,8 +337,10 @@ void EffectTestScene::runThisTest()
|
|||
#define SID_RESTART 1
|
||||
|
||||
TextLayer::TextLayer(void)
|
||||
: BaseTest::BaseTest()
|
||||
{
|
||||
initWithColor( ccc4(32,128,32,255) );
|
||||
CCLayerColor *background = CCLayerColor::create( ccc4(32,128,32,255) );
|
||||
this->addChild(background,-20);
|
||||
|
||||
CCNode* node = CCNode::create();
|
||||
CCActionInterval* effect = getAction();
|
||||
|
@ -364,25 +366,6 @@ TextLayer::TextLayer(void)
|
|||
CCActionInterval* sc2_back = sc2->reverse();
|
||||
tamara->runAction( CCRepeatForever::create(CCSequence::create(sc2, sc2_back, NULL)) );
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create((effectsList[actionIdx]).c_str(), "Marker Felt", 32);
|
||||
|
||||
label->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) );
|
||||
addChild(label);
|
||||
label->setTag( kTagLabel );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(TextLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(TextLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(TextLayer::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
|
||||
schedule( schedule_selector(TextLayer::checkAnim) );
|
||||
}
|
||||
|
||||
|
@ -413,7 +396,7 @@ TextLayer* TextLayer::create()
|
|||
|
||||
void TextLayer::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void TextLayer::newScene()
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _EFFECTS_TEST_H_
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class EffectTestScene : public TestScene
|
||||
{
|
||||
|
@ -9,7 +10,7 @@ public:
|
|||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class TextLayer : public CCLayerColor
|
||||
class TextLayer : public BaseTest
|
||||
{
|
||||
protected:
|
||||
//UxString m_strTitle;
|
||||
|
|
|
@ -65,31 +65,7 @@ void FileUtilsTestScene::runThisTest()
|
|||
|
||||
void FileUtilsDemo::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label);
|
||||
label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
|
||||
std::string subTitle = subtitle();
|
||||
if(! subTitle.empty())
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(subTitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(FileUtilsDemo::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png","Images/r2.png", this, menu_selector(FileUtilsDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", this, menu_selector(FileUtilsDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void FileUtilsDemo::backCallback(CCObject* pSender)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#define __FILEUTILSTEST_H__
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace std;
|
||||
|
||||
|
@ -11,7 +13,7 @@ public:
|
|||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class FileUtilsDemo : public CCLayer
|
||||
class FileUtilsDemo : public BaseTest
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
|
|
|
@ -77,18 +77,8 @@ static const char* restartAction(void)
|
|||
|
||||
|
||||
FontTest::FontTest()
|
||||
: BaseTest()
|
||||
{
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(FontTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(FontTest::restartCallback));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(FontTest::nextCallback));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
addChild(menu, 1);
|
||||
|
||||
showFont(restartAction());
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class FontTestScene : public TestScene
|
||||
{
|
||||
|
@ -10,7 +11,7 @@ public:
|
|||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class FontTest : public cocos2d::CCLayer
|
||||
class FontTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
FontTest();
|
||||
|
|
|
@ -134,34 +134,7 @@ std::string AtlasDemo::subtitle()
|
|||
|
||||
void AtlasDemo::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 28);
|
||||
addChild(label, 1);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition( ccp(s.width/2, s.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(AtlasDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(AtlasDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(AtlasDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));;
|
||||
|
||||
addChild(menu, 1);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void AtlasDemo::restartCallback(CCObject* pSender)
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#define _ATLAS_TEST_H_
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class AtlasDemo : public CCLayer
|
||||
class AtlasDemo : public BaseTest
|
||||
{
|
||||
protected:
|
||||
|
||||
|
|
|
@ -99,34 +99,7 @@ std::string LayerTest::title()
|
|||
|
||||
void LayerTest::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
string subtitle_ = subtitle();
|
||||
if (subtitle_.size() > 0)
|
||||
{
|
||||
CCLabelTTF *l = CCLabelTTF::create(subtitle_.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(ccp(s.width / 2, s.height - 80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(LayerTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(LayerTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(LayerTest::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void LayerTest::restartCallback(CCObject* pSender)
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
////----#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class LayerTest : public CCLayer
|
||||
class LayerTest : public BaseTest
|
||||
{
|
||||
protected:
|
||||
std::string m_strTitle;
|
||||
|
|
|
@ -228,36 +228,11 @@ std::string MotionStreakTest::subtitle()
|
|||
|
||||
void MotionStreakTest::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
BaseTest::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label, 0, kTagLabel);
|
||||
label->setPosition(ccp(s.width/2, s.height-50));
|
||||
|
||||
string subTitle = this->subtitle();
|
||||
if (subTitle.size() > 0)
|
||||
{
|
||||
CCLabelTTF *l = CCLabelTTF::create(subTitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(MotionStreakTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(MotionStreakTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(MotionStreakTest::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
|
||||
CCMenuItemToggle *itemMode = CCMenuItemToggle::createWithTarget(this, menu_selector(MotionStreakTest::modeCallback),
|
||||
CCMenuItemToggle *itemMode = CCMenuItemToggle::createWithCallback( std::bind(&MotionStreakTest::modeCallback, this, std::placeholders::_1),
|
||||
CCMenuItemFont::create("Use High Quality Mode"),
|
||||
CCMenuItemFont::create("Use Fast Mode"),
|
||||
NULL);
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
|
||||
////----#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
//USING_NS_CC;
|
||||
|
||||
class MotionStreakTest : public CCLayer
|
||||
class MotionStreakTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
MotionStreakTest(void);
|
||||
|
|
|
@ -100,34 +100,7 @@ std::string TestCocosNodeDemo::subtitle()
|
|||
|
||||
void TestCocosNodeDemo::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label, 10);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition( ccp(s.width/2, s.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(TestCocosNodeDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1,s_pPathR2, this, menu_selector(TestCocosNodeDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(TestCocosNodeDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 11);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void TestCocosNodeDemo::restartCallback(CCObject* pSender)
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
////----#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class TestCocosNodeDemo : public CCLayer
|
||||
class TestCocosNodeDemo : public BaseTest
|
||||
{
|
||||
public:
|
||||
TestCocosNodeDemo(void);
|
||||
|
|
|
@ -216,26 +216,7 @@ std::string ParallaxDemo::title()
|
|||
|
||||
void ParallaxDemo::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 28);
|
||||
addChild(label, 1);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ParallaxDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ParallaxDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(ParallaxDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void ParallaxDemo::restartCallback(CCObject* pSender)
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#define _PARALLAX_TEST_H_
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class ParallaxDemo : public CCLayer
|
||||
class ParallaxDemo : public BaseTest
|
||||
{
|
||||
protected:
|
||||
CCTextureAtlas* m_atlas;
|
||||
|
|
|
@ -640,7 +640,7 @@ void RadiusMode1::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -724,7 +724,7 @@ void RadiusMode2::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -808,7 +808,7 @@ void Issue704::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -900,7 +900,7 @@ void Issue870::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -941,7 +941,7 @@ void DemoParticleFromFile::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1067,41 +1067,26 @@ ParticleDemo::~ParticleDemo(void)
|
|||
|
||||
void ParticleDemo::onEnter(void)
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
initWithColor( ccc4(127,127,127,255) );
|
||||
BaseTest::onEnter();
|
||||
|
||||
m_color = CCLayerColor::create( ccc4(127,127,127,255) );
|
||||
this->addChild(m_color);
|
||||
|
||||
m_emitter = NULL;
|
||||
|
||||
setTouchEnabled( true );
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 28);
|
||||
addChild(label, 100, 1000);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
CCLabelTTF *sub = CCLabelTTF::create(subtitle().c_str(), "Arial", 16);
|
||||
addChild(sub, 100);
|
||||
sub->setPosition(ccp(s.width/2, s.height-80));
|
||||
|
||||
|
||||
CCMenuItemImage* item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ParticleDemo::backCallback) );
|
||||
CCMenuItemImage* item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ParticleDemo::restartCallback) );
|
||||
CCMenuItemImage* item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(ParticleDemo::nextCallback) );
|
||||
|
||||
CCMenuItemToggle* item4 = CCMenuItemToggle::createWithTarget(this,
|
||||
menu_selector(ParticleDemo::toggleCallback),
|
||||
CCMenuItemToggle* item4 = CCMenuItemToggle::createWithCallback( std::bind( &ParticleDemo::toggleCallback, this, std::placeholders::_1),
|
||||
CCMenuItemFont::create( "Free Movement" ),
|
||||
CCMenuItemFont::create( "Relative Movement" ),
|
||||
CCMenuItemFont::create( "Grouped Movement" ),
|
||||
NULL );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, item4, NULL);
|
||||
CCMenu *menu = CCMenu::create(item4, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item4->setPosition( ccp( VisibleRect::left().x, VisibleRect::bottom().y+ 100) );
|
||||
item4->setAnchorPoint( ccp(0,0) );
|
||||
|
||||
|
@ -1123,9 +1108,6 @@ void ParticleDemo::onEnter(void)
|
|||
|
||||
|
||||
scheduleUpdate();
|
||||
|
||||
CCLabelTTF* pLabel = (CCLabelTTF*)(this->getChildByTag(1000));
|
||||
pLabel->setString(title().c_str());
|
||||
}
|
||||
|
||||
std::string ParticleDemo::title()
|
||||
|
@ -1229,7 +1211,7 @@ void ParticleBatchHybrid::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1277,7 +1259,7 @@ void ParticleBatchMultipleEmitters::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1320,7 +1302,7 @@ void ParticleReorder::onEnter()
|
|||
ParticleDemo::onEnter();
|
||||
|
||||
m_nOrder = 0;
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1490,7 +1472,7 @@ void Issue1201::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1520,7 +1502,7 @@ void MultipleParticleSystems::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1575,7 +1557,7 @@ void MultipleParticleSystemsBatched::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1637,7 +1619,7 @@ void AddAndDeleteParticleSystems::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1726,7 +1708,7 @@ void ReorderParticleSystems::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
removeChild(m_background ,true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1872,7 +1854,7 @@ void PremultipliedAlphaTest::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
this->setColor(ccBLUE);
|
||||
m_color->setColor(ccBLUE);
|
||||
this->removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
@ -1904,7 +1886,7 @@ void PremultipliedAlphaTest2::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
this->setColor(ccBLACK);
|
||||
m_color->setColor(ccBLACK);
|
||||
this->removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _PARTICLE_TEST_H_
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
////----#include "cocos2d.h"
|
||||
// #include "touch_dispatcher/CCTouch.h"
|
||||
// #include "CCParticleExample.h"
|
||||
|
@ -12,11 +13,12 @@ public:
|
|||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class ParticleDemo : public CCLayerColor
|
||||
class ParticleDemo : public BaseTest
|
||||
{
|
||||
protected:
|
||||
CCParticleSystem* m_emitter;
|
||||
CCSprite* m_background;
|
||||
CCLayerColor* m_color;
|
||||
|
||||
public:
|
||||
~ParticleDemo(void);
|
||||
|
|
|
@ -1 +1 @@
|
|||
eff4f2aa0226630c0b7749f48604f100212b964e
|
||||
548013044691d4d3c7d3b2dec546b0aaa90cee8c
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
#include <string>
|
||||
|
||||
class SpriteTestDemo : public CCLayer
|
||||
class SpriteTestDemo : public BaseTest
|
||||
{
|
||||
protected:
|
||||
std::string m_strTitle;
|
||||
|
|
|
@ -8,120 +8,60 @@ enum {
|
|||
kTagSprite2 = 3,
|
||||
};
|
||||
|
||||
typedef CCLayer* (*NEWTEXTURE2DTESTFUNC)();
|
||||
#define TEXTURE2D_CREATE_FUNC(className) \
|
||||
static CCLayer* create##className() \
|
||||
{ return new className(); }
|
||||
|
||||
TEXTURE2D_CREATE_FUNC(TextureMemoryAlloc);
|
||||
|
||||
TEXTURE2D_CREATE_FUNC(TextureAlias);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRMipMap);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRMipMap2);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRNonSquare);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRNPOT4444);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRNPOT8888);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVR);
|
||||
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVR2BPP);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVR2BPPv3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVR4BPP);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVR4BPPv3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRII4BPPv3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGBA8888);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGBA8888v3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRBGRA8888);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRBGRA8888v3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGBA4444);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGBA4444v3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGBA4444GZ);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGBA4444CCZ);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGBA5551);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGBA5551v3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGB565);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGB565v3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGB888);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRRGB888v3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRA8);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRA8v3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRI8);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRI8v3);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRAI88);
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRAI88v3);
|
||||
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRv3Premult);
|
||||
|
||||
TEXTURE2D_CREATE_FUNC(TexturePVRBadEncoding);
|
||||
TESTLAYER_CREATE_FUNC(TexturePNG);
|
||||
TESTLAYER_CREATE_FUNC(TextureJPEG);
|
||||
TESTLAYER_CREATE_FUNC(TextureTIFF);
|
||||
TESTLAYER_CREATE_FUNC(TextureWEBP);
|
||||
TESTLAYER_CREATE_FUNC(TexturePixelFormat);
|
||||
TESTLAYER_CREATE_FUNC(TextureBlend);
|
||||
TESTLAYER_CREATE_FUNC(TextureAsync);
|
||||
TESTLAYER_CREATE_FUNC(TextureGlClamp);
|
||||
TESTLAYER_CREATE_FUNC(TextureGlRepeat);
|
||||
TESTLAYER_CREATE_FUNC(TextureSizeTest);
|
||||
TESTLAYER_CREATE_FUNC(TextureCache1);
|
||||
TESTLAYER_CREATE_FUNC(TextureDrawAtPoint);
|
||||
TESTLAYER_CREATE_FUNC(TextureDrawInRect);
|
||||
|
||||
TESTLAYER_CREATE_FUNC(TextureETC1);
|
||||
|
||||
static NEWTEXTURE2DTESTFUNC createFunctions[] =
|
||||
static std::function<CCLayer*()> createFunctions[] =
|
||||
{
|
||||
createTextureMemoryAlloc,
|
||||
createTextureAlias,
|
||||
createTexturePVRMipMap,
|
||||
createTexturePVRMipMap2,
|
||||
createTexturePVRNonSquare,
|
||||
createTexturePVRNPOT4444,
|
||||
createTexturePVRNPOT8888,
|
||||
createTexturePVR,
|
||||
createTexturePVR2BPP,
|
||||
createTexturePVR2BPPv3,
|
||||
createTexturePVR4BPP,
|
||||
createTexturePVR4BPPv3,
|
||||
createTexturePVRII4BPPv3,
|
||||
createTexturePVRRGBA8888,
|
||||
createTexturePVRRGBA8888v3,
|
||||
createTexturePVRBGRA8888,
|
||||
createTexturePVRBGRA8888v3,
|
||||
createTexturePVRRGBA4444,
|
||||
createTexturePVRRGBA4444v3,
|
||||
createTexturePVRRGBA4444GZ,
|
||||
createTexturePVRRGBA4444CCZ,
|
||||
createTexturePVRRGBA5551,
|
||||
createTexturePVRRGBA5551v3,
|
||||
createTexturePVRRGB565,
|
||||
createTexturePVRRGB565v3,
|
||||
createTexturePVRRGB888,
|
||||
createTexturePVRRGB888v3,
|
||||
createTexturePVRA8,
|
||||
createTexturePVRA8v3,
|
||||
createTexturePVRI8,
|
||||
createTexturePVRI8v3,
|
||||
createTexturePVRAI88,
|
||||
createTexturePVRAI88v3,
|
||||
CL(TextureMemoryAlloc),
|
||||
CL(TextureAlias),
|
||||
CL(TexturePVRMipMap),
|
||||
CL(TexturePVRMipMap2),
|
||||
CL(TexturePVRNonSquare),
|
||||
CL(TexturePVRNPOT4444),
|
||||
CL(TexturePVRNPOT8888),
|
||||
CL(TexturePVR),
|
||||
CL(TexturePVR2BPP),
|
||||
CL(TexturePVR2BPPv3),
|
||||
CL(TexturePVR4BPP),
|
||||
CL(TexturePVR4BPPv3),
|
||||
CL(TexturePVRII4BPPv3),
|
||||
CL(TexturePVRRGBA8888),
|
||||
CL(TexturePVRRGBA8888v3),
|
||||
CL(TexturePVRBGRA8888),
|
||||
CL(TexturePVRBGRA8888v3),
|
||||
CL(TexturePVRRGBA4444),
|
||||
CL(TexturePVRRGBA4444v3),
|
||||
CL(TexturePVRRGBA4444GZ),
|
||||
CL(TexturePVRRGBA4444CCZ),
|
||||
CL(TexturePVRRGBA5551),
|
||||
CL(TexturePVRRGBA5551v3),
|
||||
CL(TexturePVRRGB565),
|
||||
CL(TexturePVRRGB565v3),
|
||||
CL(TexturePVRRGB888),
|
||||
CL(TexturePVRRGB888v3),
|
||||
CL(TexturePVRA8),
|
||||
CL(TexturePVRA8v3),
|
||||
CL(TexturePVRI8),
|
||||
CL(TexturePVRI8v3),
|
||||
CL(TexturePVRAI88),
|
||||
CL(TexturePVRAI88v3),
|
||||
|
||||
createTexturePVRv3Premult,
|
||||
CL(TexturePVRv3Premult),
|
||||
|
||||
createTexturePVRBadEncoding,
|
||||
createTexturePNG,
|
||||
createTextureJPEG,
|
||||
createTextureTIFF,
|
||||
createTextureWEBP,
|
||||
createTexturePixelFormat,
|
||||
createTextureBlend,
|
||||
createTextureAsync,
|
||||
createTextureGlClamp,
|
||||
createTextureGlRepeat,
|
||||
createTextureSizeTest,
|
||||
createTextureCache1,
|
||||
createTextureDrawAtPoint,
|
||||
createTextureDrawInRect,
|
||||
CL(TexturePVRBadEncoding),
|
||||
CL(TexturePNG),
|
||||
CL(TextureJPEG),
|
||||
CL(TextureTIFF),
|
||||
CL(TextureWEBP),
|
||||
CL(TexturePixelFormat),
|
||||
CL(TextureBlend),
|
||||
CL(TextureAsync),
|
||||
CL(TextureGlClamp),
|
||||
CL(TextureGlRepeat),
|
||||
CL(TextureSizeTest),
|
||||
CL(TextureCache1),
|
||||
CL(TextureDrawAtPoint),
|
||||
CL(TextureDrawInRect),
|
||||
|
||||
createTextureETC1,
|
||||
CL(TextureETC1),
|
||||
};
|
||||
|
||||
static unsigned int TEST_CASE_COUNT = sizeof(createFunctions) / sizeof(createFunctions[0]);
|
||||
|
@ -172,33 +112,10 @@ CCLayer* restartTextureTest()
|
|||
//------------------------------------------------------------------
|
||||
void TextureDemo::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
BaseTest::onEnter();
|
||||
|
||||
CCTextureCache::sharedTextureCache()->dumpCachedTextureInfo();
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF *label = CCLabelTTF::create(title().c_str(), "Arial", 26);
|
||||
addChild(label, 1, kTagLabel);
|
||||
label->setPosition(ccp(s.width/2, s.height-50));
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if(strSubtitle.length())
|
||||
{
|
||||
CCLabelTTF *l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(TextureDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(TextureDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(TextureDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
addChild(menu, 1);
|
||||
|
||||
CCLayerColor *col = CCLayerColor::create(ccc4(128,128,128,255));
|
||||
addChild(col, -10);
|
||||
|
||||
|
@ -1393,10 +1310,7 @@ void TexturePixelFormat::onEnter()
|
|||
// 3- 16-bit RGB5A1
|
||||
// 4- 16-bit RGB565
|
||||
TextureDemo::onEnter();
|
||||
|
||||
CCLabelTTF *label = (CCLabelTTF*) getChildByTag(kTagLabel);
|
||||
label->setColor(ccc3(16,16,255));
|
||||
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLayerColor *background = CCLayerColor::create(ccc4(128,128,128,255), s.width, s.height);
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
#define __TEXTURE2D_TEST_H__
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
|
||||
class TextureDemo : public CCLayer
|
||||
class TextureDemo : public BaseTest
|
||||
{
|
||||
public:
|
||||
virtual ~TextureDemo();
|
||||
|
|
|
@ -26,4 +26,8 @@ static CCLayer* create##className() \
|
|||
|
||||
#define CF(className) create##className
|
||||
|
||||
// C++ 11
|
||||
|
||||
#define CL(__className__) [](){ return new __className__();}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1 +1 @@
|
|||
8922f463911cface3b01435714d824c97adf5948
|
||||
509eda87a0dd525207e23c811e04786bf5b2e3c6
|
|
@ -1 +1 @@
|
|||
bd72399cc616a35a20111d4a5bedc5c473e93e37
|
||||
04925ef9a72a8d03563f5578810893e794504e6e
|
Loading…
Reference in New Issue