mirror of https://github.com/axmolengine/axmol.git
Merge pull request #788 from minggo/NodeTest
rename CocosNodeTest to NodeTest and SC
This commit is contained in:
commit
e8861f80bf
|
@ -25,7 +25,6 @@ tests/BugsTest/Bug-458/Bug-458.cpp \
|
||||||
tests/BugsTest/Bug-458/QuestionContainerSprite.cpp \
|
tests/BugsTest/Bug-458/QuestionContainerSprite.cpp \
|
||||||
tests/ClickAndMoveTest/ClickAndMoveTest.cpp \
|
tests/ClickAndMoveTest/ClickAndMoveTest.cpp \
|
||||||
tests/CocosDenshionTest/CocosDenshionTest.cpp \
|
tests/CocosDenshionTest/CocosDenshionTest.cpp \
|
||||||
tests/CocosNodeTest/CocosNodeTest.cpp \
|
|
||||||
tests/CurlTest/CurlTest.cpp \
|
tests/CurlTest/CurlTest.cpp \
|
||||||
tests/CurrentLanguageTest/CurrentLanguageTest.cpp \
|
tests/CurrentLanguageTest/CurrentLanguageTest.cpp \
|
||||||
tests/DirectorTest/DirectorTest.cpp \
|
tests/DirectorTest/DirectorTest.cpp \
|
||||||
|
@ -40,6 +39,7 @@ tests/IntervalTest/IntervalTest.cpp \
|
||||||
tests/KeypadTest/KeypadTest.cpp \
|
tests/KeypadTest/KeypadTest.cpp \
|
||||||
tests/LabelTest/LabelTest.cpp \
|
tests/LabelTest/LabelTest.cpp \
|
||||||
tests/LayerTest/LayerTest.cpp \
|
tests/LayerTest/LayerTest.cpp \
|
||||||
|
tests/NodeTest/NodeTest.cpp \
|
||||||
tests/TextInputTest/TextInputTest.cpp \
|
tests/TextInputTest/TextInputTest.cpp \
|
||||||
tests/MenuTest/MenuTest.cpp \
|
tests/MenuTest/MenuTest.cpp \
|
||||||
tests/MotionStreakTest/MotionStreakTest.cpp \
|
tests/MotionStreakTest/MotionStreakTest.cpp \
|
||||||
|
|
|
@ -335,18 +335,6 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
|
||||||
Name="CocosNodeTest"
|
|
||||||
>
|
|
||||||
<File
|
|
||||||
RelativePath="..\tests\CocosNodeTest\CocosNodeTest.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\tests\CocosNodeTest\CocosNodeTest.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
<Filter
|
||||||
Name="TouchesTest"
|
Name="TouchesTest"
|
||||||
>
|
>
|
||||||
|
@ -850,6 +838,14 @@
|
||||||
<Filter
|
<Filter
|
||||||
Name="NodeTest"
|
Name="NodeTest"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\tests\NodeTest\NodeTest.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\tests\NodeTest\NodeTest.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="ActionsProgressTest"
|
Name="ActionsProgressTest"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "CocosNodeTest.h"
|
#include "NodeTest.h"
|
||||||
#include "../testResource.h"
|
#include "../testResource.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -22,7 +22,7 @@ CCLayer* restartCocosNodeAction();
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 12
|
#define MAX_LAYER 14
|
||||||
|
|
||||||
CCLayer* createCocosNodeLayer(int nIndex)
|
CCLayer* createCocosNodeLayer(int nIndex)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,8 @@ CCLayer* createCocosNodeLayer(int nIndex)
|
||||||
case 9: return new CameraOrbitTest();
|
case 9: return new CameraOrbitTest();
|
||||||
case 10: return new CameraZoomTest();
|
case 10: return new CameraZoomTest();
|
||||||
case 11: return new ConvertToNode();
|
case 11: return new ConvertToNode();
|
||||||
|
case 12: return new NodeOpaqueTest();
|
||||||
|
case 13: return new NodeNonOpaqueTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -103,7 +105,7 @@ void TestCocosNodeDemo::onEnter()
|
||||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
|
||||||
CCLabelTTF* label = CCLabelTTF::labelWithString(title().c_str(), "Arial", 32);
|
CCLabelTTF* label = CCLabelTTF::labelWithString(title().c_str(), "Arial", 32);
|
||||||
addChild(label, 1);
|
addChild(label, 10);
|
||||||
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||||
|
|
||||||
std::string strSubtitle = subtitle();
|
std::string strSubtitle = subtitle();
|
||||||
|
@ -125,7 +127,7 @@ void TestCocosNodeDemo::onEnter()
|
||||||
item2->setPosition( CCPointMake( s.width/2, 30) );
|
item2->setPosition( CCPointMake( s.width/2, 30) );
|
||||||
item3->setPosition( CCPointMake( s.width/2 + 100,30) );
|
item3->setPosition( CCPointMake( s.width/2 + 100,30) );
|
||||||
|
|
||||||
addChild(menu, 1);
|
addChild(menu, 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestCocosNodeDemo::restartCallback(CCObject* pSender)
|
void TestCocosNodeDemo::restartCallback(CCObject* pSender)
|
||||||
|
@ -638,22 +640,18 @@ CameraZoomTest::CameraZoomTest()
|
||||||
addChild( sprite, 0);
|
addChild( sprite, 0);
|
||||||
sprite->setPosition( CCPointMake(s.width/4*1, s.height/2) );
|
sprite->setPosition( CCPointMake(s.width/4*1, s.height/2) );
|
||||||
cam = sprite->getCamera();
|
cam = sprite->getCamera();
|
||||||
cam->setEyeXYZ(0, 0, 415);
|
cam->setEyeXYZ(0, 0, 415/2);
|
||||||
|
cam->setCenterXYZ(0, 0, 0);
|
||||||
|
|
||||||
// CENTER
|
// CENTER
|
||||||
sprite = CCSprite::spriteWithFile(s_pPathGrossini);
|
sprite = CCSprite::spriteWithFile(s_pPathGrossini);
|
||||||
addChild( sprite, 0, 40);
|
addChild( sprite, 0, 40);
|
||||||
sprite->setPosition(CCPointMake(s.width/4*2, s.height/2));
|
sprite->setPosition(CCPointMake(s.width/4*2, s.height/2));
|
||||||
// cam = [sprite camera);
|
|
||||||
// [cam setEyeX:0 eyeY:0 eyeZ:415/2);
|
|
||||||
|
|
||||||
// RIGHT
|
// RIGHT
|
||||||
sprite = CCSprite::spriteWithFile(s_pPathGrossini);
|
sprite = CCSprite::spriteWithFile(s_pPathGrossini);
|
||||||
addChild( sprite, 0, 20);
|
addChild( sprite, 0, 20);
|
||||||
sprite->setPosition(CCPointMake(s.width/4*3, s.height/2));
|
sprite->setPosition(CCPointMake(s.width/4*3, s.height/2));
|
||||||
// cam = [sprite camera);
|
|
||||||
// [cam setEyeX:0 eyeY:0 eyeZ:-485);
|
|
||||||
// [cam setCenterX:0 centerY:0 centerZ:0);
|
|
||||||
|
|
||||||
m_z = 0;
|
m_z = 0;
|
||||||
scheduleUpdate();
|
scheduleUpdate();
|
||||||
|
@ -672,7 +670,7 @@ void CameraZoomTest::update(ccTime dt)
|
||||||
|
|
||||||
sprite = getChildByTag(40);
|
sprite = getChildByTag(40);
|
||||||
cam = sprite->getCamera();
|
cam = sprite->getCamera();
|
||||||
cam->setEyeXYZ(0, 0, m_z);
|
cam->setEyeXYZ(0, 0, -m_z);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CameraZoomTest::title()
|
std::string CameraZoomTest::title()
|
||||||
|
@ -693,68 +691,54 @@ CameraCenterTest::CameraCenterTest()
|
||||||
CCOrbitCamera *orbit;
|
CCOrbitCamera *orbit;
|
||||||
|
|
||||||
// LEFT-TOP
|
// LEFT-TOP
|
||||||
sprite = new CCSprite();//::node();
|
sprite = CCSprite::spriteWithFile("Images/white-512x512.png");
|
||||||
sprite->init();
|
|
||||||
addChild( sprite, 0);
|
addChild( sprite, 0);
|
||||||
sprite->setPosition(CCPointMake(s.width/5*1, s.height/5*1));
|
sprite->setPosition(CCPointMake(s.width/5*1, s.height/5*1));
|
||||||
sprite->setColor(ccRED);
|
sprite->setColor(ccRED);
|
||||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||||
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
||||||
sprite->runAction(CCRepeatForever::actionWithAction( orbit ));
|
sprite->runAction(CCRepeatForever::actionWithAction( orbit ));
|
||||||
sprite->release();
|
|
||||||
// [sprite setAnchorPoint: CCPointMake(0,1));
|
// [sprite setAnchorPoint: CCPointMake(0,1));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// LEFT-BOTTOM
|
// LEFT-BOTTOM
|
||||||
sprite = new CCSprite();//::node();
|
sprite = CCSprite::spriteWithFile("Images/white-512x512.png");
|
||||||
sprite->init();
|
|
||||||
addChild( sprite, 0, 40);
|
addChild( sprite, 0, 40);
|
||||||
sprite->setPosition(CCPointMake(s.width/5*1, s.height/5*4));
|
sprite->setPosition(CCPointMake(s.width/5*1, s.height/5*4));
|
||||||
sprite->setColor(ccBLUE);
|
sprite->setColor(ccBLUE);
|
||||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||||
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
||||||
sprite->runAction(CCRepeatForever::actionWithAction( orbit ));
|
sprite->runAction(CCRepeatForever::actionWithAction( orbit ));
|
||||||
sprite->release();
|
|
||||||
// [sprite setAnchorPoint: CCPointMake(0,0));
|
|
||||||
|
|
||||||
|
|
||||||
// RIGHT-TOP
|
// RIGHT-TOP
|
||||||
sprite = new CCSprite();//::node();
|
sprite = CCSprite::spriteWithFile("Images/white-512x512.png");
|
||||||
sprite->init();
|
|
||||||
addChild( sprite, 0);
|
addChild( sprite, 0);
|
||||||
sprite->setPosition(CCPointMake(s.width/5*4, s.height/5*1));
|
sprite->setPosition(CCPointMake(s.width/5*4, s.height/5*1));
|
||||||
sprite->setColor(ccYELLOW);
|
sprite->setColor(ccYELLOW);
|
||||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||||
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
||||||
sprite->runAction(CCRepeatForever::actionWithAction( orbit) );
|
sprite->runAction(CCRepeatForever::actionWithAction( orbit) );
|
||||||
sprite->release();
|
|
||||||
// [sprite setAnchorPoint: CCPointMake(1,1));
|
|
||||||
|
|
||||||
|
|
||||||
// RIGHT-BOTTOM
|
// RIGHT-BOTTOM
|
||||||
sprite = new CCSprite();//::node();
|
sprite = CCSprite::spriteWithFile("Images/white-512x512.png");
|
||||||
sprite->init();
|
|
||||||
addChild( sprite, 0, 40);
|
addChild( sprite, 0, 40);
|
||||||
sprite->setPosition(CCPointMake(s.width/5*4, s.height/5*4));
|
sprite->setPosition(CCPointMake(s.width/5*4, s.height/5*4));
|
||||||
sprite->setColor(ccGREEN);
|
sprite->setColor(ccGREEN);
|
||||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||||
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
||||||
sprite->runAction( CCRepeatForever::actionWithAction( orbit ) );
|
sprite->runAction( CCRepeatForever::actionWithAction( orbit ) );
|
||||||
sprite->release();
|
|
||||||
// [sprite setAnchorPoint: CCPointMake(1,0));
|
|
||||||
|
|
||||||
// CENTER
|
// CENTER
|
||||||
sprite = new CCSprite();
|
sprite = CCSprite::spriteWithFile("Images/white-512x512.png");
|
||||||
sprite->init();
|
|
||||||
addChild( sprite, 0, 40);
|
addChild( sprite, 0, 40);
|
||||||
sprite->setPosition(CCPointMake(s.width/2, s.height/2));
|
sprite->setPosition(CCPointMake(s.width/2, s.height/2));
|
||||||
sprite->setColor(ccWHITE);
|
sprite->setColor(ccWHITE);
|
||||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||||
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
orbit = CCOrbitCamera::actionWithDuration(10, 1, 0, 0, 360, 0, 0);
|
||||||
sprite->runAction(CCRepeatForever::actionWithAction( orbit ) );
|
sprite->runAction(CCRepeatForever::actionWithAction( orbit ) );
|
||||||
sprite->release();
|
|
||||||
// [sprite setAnchorPoint: CCPointMake(0.5f, 0.5f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CameraCenterTest::title()
|
std::string CameraCenterTest::title()
|
||||||
|
@ -843,6 +827,56 @@ std::string ConvertToNode::subtitle()
|
||||||
return "testing convertToNodeSpace / AR. Touch and see console";
|
return "testing convertToNodeSpace / AR. Touch and see console";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// NodeOpaqueTest
|
||||||
|
|
||||||
|
NodeOpaqueTest::NodeOpaqueTest()
|
||||||
|
{
|
||||||
|
CCSprite *background = NULL;
|
||||||
|
|
||||||
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
|
background = CCSprite::spriteWithFile("Images/background1.png");
|
||||||
|
background->setGLServerState((ccGLServerState)(background->getGLServerState() & (~CC_GL_BLEND)));
|
||||||
|
background->setAnchorPoint(CCPointZero);
|
||||||
|
addChild(background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string NodeOpaqueTest::title()
|
||||||
|
{
|
||||||
|
return "Node Opaque Test";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string NodeOpaqueTest::subtitle()
|
||||||
|
{
|
||||||
|
return "Node rendered with GL_BLEND disabled";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// NodeNonOpaqueTest
|
||||||
|
|
||||||
|
NodeNonOpaqueTest::NodeNonOpaqueTest()
|
||||||
|
{
|
||||||
|
CCSprite *background = NULL;
|
||||||
|
|
||||||
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
|
background = CCSprite::spriteWithFile("Images/background1.jpg");
|
||||||
|
background->setGLServerState((ccGLServerState)(background->getGLServerState() | CC_GL_BLEND));
|
||||||
|
background->setAnchorPoint(CCPointZero);
|
||||||
|
addChild(background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string NodeNonOpaqueTest::title()
|
||||||
|
{
|
||||||
|
return "Node Non Opaque Test";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string NodeNonOpaqueTest::subtitle()
|
||||||
|
{
|
||||||
|
return "Node rendered with GL_BLEND enabled";
|
||||||
|
}
|
||||||
|
|
||||||
void CocosNodeTestScene::runThisTest()
|
void CocosNodeTestScene::runThisTest()
|
||||||
{
|
{
|
||||||
CCLayer* pLayer = nextCocosNodeAction();
|
CCLayer* pLayer = nextCocosNodeAction();
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _COCOSNODE_TEST_H_
|
#ifndef _NODE_TEST_H_
|
||||||
#define _COCOSNODE_TEST_H_
|
#define _NODE_TEST_H_
|
||||||
|
|
||||||
////----#include "cocos2d.h"
|
////----#include "cocos2d.h"
|
||||||
#include "../testBasic.h"
|
#include "../testBasic.h"
|
||||||
|
@ -129,6 +129,22 @@ public:
|
||||||
virtual std::string subtitle();
|
virtual std::string subtitle();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NodeOpaqueTest : public TestCocosNodeDemo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NodeOpaqueTest();
|
||||||
|
virtual std::string title();
|
||||||
|
virtual std::string subtitle();
|
||||||
|
};
|
||||||
|
|
||||||
|
class NodeNonOpaqueTest : public TestCocosNodeDemo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NodeNonOpaqueTest();
|
||||||
|
virtual std::string title();
|
||||||
|
virtual std::string subtitle();
|
||||||
|
};
|
||||||
|
|
||||||
class CocosNodeTestScene : public TestScene
|
class CocosNodeTestScene : public TestScene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
|
@ -11,7 +11,6 @@
|
||||||
#include "ActionsEaseTest/ActionsEaseTest.h"
|
#include "ActionsEaseTest/ActionsEaseTest.h"
|
||||||
#include "MotionStreakTest/MotionStreakTest.h"
|
#include "MotionStreakTest/MotionStreakTest.h"
|
||||||
#include "DrawPrimitivesTest/DrawPrimitivesTest.h"
|
#include "DrawPrimitivesTest/DrawPrimitivesTest.h"
|
||||||
#include "CocosNodeTest/CocosNodeTest.h"
|
|
||||||
#include "TouchesTest/TouchesTest.h"
|
#include "TouchesTest/TouchesTest.h"
|
||||||
#include "MenuTest/MenuTest.h"
|
#include "MenuTest/MenuTest.h"
|
||||||
#include "ActionManagerTest/ActionManagerTest.h"
|
#include "ActionManagerTest/ActionManagerTest.h"
|
||||||
|
@ -45,6 +44,7 @@
|
||||||
#include "FontTest/FontTest.h"
|
#include "FontTest/FontTest.h"
|
||||||
#include "CurrentLanguageTest/CurrentLanguageTest.h"
|
#include "CurrentLanguageTest/CurrentLanguageTest.h"
|
||||||
#include "TextureCacheTest/TextureCacheTest.h"
|
#include "TextureCacheTest/TextureCacheTest.h"
|
||||||
|
#include "NodeTest/NodeTest.h"
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||||
#include "ChipmunkTest/cocos2dChipmunkDemo.h"
|
#include "ChipmunkTest/cocos2dChipmunkDemo.h"
|
||||||
|
@ -117,7 +117,7 @@ const std::string g_aTestNames[TESTS_COUNT] = {
|
||||||
"ActionsEaseTest",
|
"ActionsEaseTest",
|
||||||
"MotionStreakTest",
|
"MotionStreakTest",
|
||||||
"DrawPrimitivesTest",
|
"DrawPrimitivesTest",
|
||||||
"CocosNodeTest",
|
"NodeTest",
|
||||||
"TouchesTest",
|
"TouchesTest",
|
||||||
"MenuTest",
|
"MenuTest",
|
||||||
"ActionManagerTest",
|
"ActionManagerTest",
|
||||||
|
|
Loading…
Reference in New Issue