mirror of https://github.com/axmolengine/axmol.git
1. adds support for iOS and Mac.
2. Modify position of some examples.
This commit is contained in:
parent
8ff088da53
commit
c2e85c1ae4
|
@ -125,6 +125,7 @@ void ArmatureTestScene::MainMenuCallback(CCObject* pSender)
|
||||||
|
|
||||||
void ArmatureTestLayer::onEnter()
|
void ArmatureTestLayer::onEnter()
|
||||||
{
|
{
|
||||||
|
|
||||||
CCLayer::onEnter();
|
CCLayer::onEnter();
|
||||||
|
|
||||||
// add title and subtitle
|
// add title and subtitle
|
||||||
|
@ -138,7 +139,7 @@ void ArmatureTestLayer::onEnter()
|
||||||
std::string strSubtitle = subtitle();
|
std::string strSubtitle = subtitle();
|
||||||
if( ! strSubtitle.empty() )
|
if( ! strSubtitle.empty() )
|
||||||
{
|
{
|
||||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 22);
|
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Arial", 18);
|
||||||
l->setColor(ccc3(0, 0, 0));
|
l->setColor(ccc3(0, 0, 0));
|
||||||
addChild(l, 1, 10001);
|
addChild(l, 1, 10001);
|
||||||
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||||
|
@ -158,8 +159,8 @@ void ArmatureTestLayer::onEnter()
|
||||||
|
|
||||||
addChild(menu, 100);
|
addChild(menu, 100);
|
||||||
|
|
||||||
|
|
||||||
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
|
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
|
||||||
|
|
||||||
}
|
}
|
||||||
void ArmatureTestLayer::onExit()
|
void ArmatureTestLayer::onExit()
|
||||||
{
|
{
|
||||||
|
@ -198,11 +199,6 @@ void ArmatureTestLayer::backCallback(CCObject* pSender)
|
||||||
void ArmatureTestLayer::draw()
|
void ArmatureTestLayer::draw()
|
||||||
{
|
{
|
||||||
CCLayer::draw();
|
CCLayer::draw();
|
||||||
|
|
||||||
// CC_NODE_DRAW_SETUP();
|
|
||||||
// ccDrawColor4B(0,0,0,255);
|
|
||||||
// ccDrawLine(VisibleRect::left(), VisibleRect::right());
|
|
||||||
// ccDrawLine(VisibleRect::bottom(), VisibleRect::top());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,7 +212,9 @@ void TestDragonBones20::onEnter()
|
||||||
armature->getAnimation()->playByIndex(1);
|
armature->getAnimation()->playByIndex(1);
|
||||||
armature->getAnimation()->setAnimationScale(0.4f);
|
armature->getAnimation()->setAnimationScale(0.4f);
|
||||||
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y * 0.3f);
|
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y * 0.3f);
|
||||||
addChild(armature);
|
armature->setScale(0.6);
|
||||||
|
addChild(armature);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,12 +227,10 @@ std::string TestDragonBones20::title()
|
||||||
void TestCSWithSkeleton::onEnter()
|
void TestCSWithSkeleton::onEnter()
|
||||||
{
|
{
|
||||||
ArmatureTestLayer::onEnter();
|
ArmatureTestLayer::onEnter();
|
||||||
|
|
||||||
cocos2d::extension::CCArmature *armature = NULL;
|
cocos2d::extension::CCArmature *armature = NULL;
|
||||||
|
|
||||||
armature = cocos2d::extension::CCArmature::create("Cowboy");
|
armature = cocos2d::extension::CCArmature::create("Cowboy");
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setScale(0.3f);
|
armature->setScale(0.2f);
|
||||||
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y/*-100*/));
|
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y/*-100*/));
|
||||||
addChild(armature);
|
addChild(armature);
|
||||||
}
|
}
|
||||||
|
@ -249,12 +245,11 @@ std::string TestCSWithSkeleton::title()
|
||||||
void TestCSWithoutSkeleton::onEnter()
|
void TestCSWithoutSkeleton::onEnter()
|
||||||
{
|
{
|
||||||
ArmatureTestLayer::onEnter();
|
ArmatureTestLayer::onEnter();
|
||||||
|
|
||||||
cocos2d::extension::CCArmature *armature = NULL;
|
cocos2d::extension::CCArmature *armature = NULL;
|
||||||
|
|
||||||
armature = cocos2d::extension::CCArmature::create("TestBone");
|
armature = cocos2d::extension::CCArmature::create("TestBone");
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setScale(0.3f);
|
armature->setAnchorPoint(ccp(0.5, -0.1));
|
||||||
|
armature->setScale(0.2f);
|
||||||
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100));
|
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100));
|
||||||
addChild(armature);
|
addChild(armature);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +269,9 @@ void TestCSContertFromDragonBone::onEnter()
|
||||||
cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Zombie_zamboni");
|
cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Zombie_zamboni");
|
||||||
armature->getAnimation()->playByIndex(1);
|
armature->getAnimation()->playByIndex(1);
|
||||||
armature->getAnimation()->setAnimationScale(0.5);
|
armature->getAnimation()->setAnimationScale(0.5);
|
||||||
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y + 100));
|
armature->setAnchorPoint(ccp(0.5, 0.5));
|
||||||
|
armature->setScale(0.6f);
|
||||||
|
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y));
|
||||||
addChild(armature);
|
addChild(armature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,13 +296,14 @@ void TestPerformance::onEnter()
|
||||||
|
|
||||||
scheduleUpdate();
|
scheduleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TestPerformance::title()
|
std::string TestPerformance::title()
|
||||||
{
|
{
|
||||||
return "Test Performance";
|
return "Test Performance";
|
||||||
}
|
}
|
||||||
std::string TestPerformance::subtitle()
|
std::string TestPerformance::subtitle()
|
||||||
{
|
{
|
||||||
return "Current cocos2d::extension::CCArmature Count : ";
|
return "Current CCArmature Count : ";
|
||||||
}
|
}
|
||||||
void TestPerformance::addArmature(cocos2d::extension::CCArmature *armature)
|
void TestPerformance::addArmature(cocos2d::extension::CCArmature *armature)
|
||||||
{
|
{
|
||||||
|
@ -324,6 +322,7 @@ void TestPerformance::update(float delta)
|
||||||
armature->init("Knight_f/Knight");
|
armature->init("Knight_f/Knight");
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setPosition(50 + armatureCount * 2, 150);
|
armature->setPosition(50 + armatureCount * 2, 150);
|
||||||
|
armature->setScale(0.6);
|
||||||
addArmature(armature);
|
addArmature(armature);
|
||||||
armature->release();
|
armature->release();
|
||||||
|
|
||||||
|
@ -350,11 +349,12 @@ void TestChangeZorder::onEnter()
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100));
|
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100));
|
||||||
++currentTag;
|
++currentTag;
|
||||||
|
armature->setScale(0.6f);
|
||||||
addChild(armature, currentTag, currentTag);
|
addChild(armature, currentTag, currentTag);
|
||||||
|
|
||||||
armature = cocos2d::extension::CCArmature::create("TestBone");
|
armature = cocos2d::extension::CCArmature::create("TestBone");
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setScale(0.3f);
|
armature->setScale(0.24f);
|
||||||
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100));
|
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100));
|
||||||
++currentTag;
|
++currentTag;
|
||||||
addChild(armature, currentTag, currentTag);
|
addChild(armature, currentTag, currentTag);
|
||||||
|
@ -363,6 +363,7 @@ void TestChangeZorder::onEnter()
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setPosition(ccp(VisibleRect::center().x , VisibleRect::center().y-100));
|
armature->setPosition(ccp(VisibleRect::center().x , VisibleRect::center().y-100));
|
||||||
++currentTag;
|
++currentTag;
|
||||||
|
armature->setScale(0.6f);
|
||||||
addChild(armature, currentTag, currentTag);
|
addChild(armature, currentTag, currentTag);
|
||||||
|
|
||||||
schedule( schedule_selector(TestChangeZorder::changeZorder), 1);
|
schedule( schedule_selector(TestChangeZorder::changeZorder), 1);
|
||||||
|
@ -371,7 +372,7 @@ void TestChangeZorder::onEnter()
|
||||||
}
|
}
|
||||||
std::string TestChangeZorder::title()
|
std::string TestChangeZorder::title()
|
||||||
{
|
{
|
||||||
return "Test Change ZOrder Of Different cocos2d::extension::CCArmature";
|
return "Test Change ZOrder Of Different CCArmature";
|
||||||
}
|
}
|
||||||
void TestChangeZorder::changeZorder(float dt)
|
void TestChangeZorder::changeZorder(float dt)
|
||||||
{
|
{
|
||||||
|
@ -392,15 +393,15 @@ void TestAnimationEvent::onEnter()
|
||||||
ArmatureTestLayer::onEnter();
|
ArmatureTestLayer::onEnter();
|
||||||
armature = cocos2d::extension::CCArmature::create("Cowboy");
|
armature = cocos2d::extension::CCArmature::create("Cowboy");
|
||||||
armature->getAnimation()->play("Fire");
|
armature->getAnimation()->play("Fire");
|
||||||
armature->setScaleX(-0.3f);
|
armature->setScaleX(-0.24f);
|
||||||
armature->setScaleY(0.3f);
|
armature->setScaleY(0.24f);
|
||||||
armature->setPosition(ccp(VisibleRect::left().x + 50, VisibleRect::left().y));
|
armature->setPosition(ccp(VisibleRect::left().x + 50, VisibleRect::left().y));
|
||||||
armature->getAnimation()->MovementEventSignal.connect(this, &TestAnimationEvent::animationEvent);
|
armature->getAnimation()->MovementEventSignal.connect(this, &TestAnimationEvent::animationEvent);
|
||||||
addChild(armature);
|
addChild(armature);
|
||||||
}
|
}
|
||||||
std::string TestAnimationEvent::title()
|
std::string TestAnimationEvent::title()
|
||||||
{
|
{
|
||||||
return "Test cocos2d::extension::CCArmature Animation Event";
|
return "Test CCArmature Animation Event";
|
||||||
}
|
}
|
||||||
void TestAnimationEvent::animationEvent(cocos2d::extension::CCArmature *armature, MovementEventType movementType, const char *movementID)
|
void TestAnimationEvent::animationEvent(cocos2d::extension::CCArmature *armature, MovementEventType movementType, const char *movementID)
|
||||||
{
|
{
|
||||||
|
@ -448,7 +449,7 @@ void TestParticleDisplay::onEnter()
|
||||||
armature = cocos2d::extension::CCArmature::create("robot");
|
armature = cocos2d::extension::CCArmature::create("robot");
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setPosition(VisibleRect::center());
|
armature->setPosition(VisibleRect::center());
|
||||||
armature->setScale(0.6f);
|
armature->setScale(0.48f);
|
||||||
addChild(armature);
|
addChild(armature);
|
||||||
|
|
||||||
CCParticleDisplayData displayData;
|
CCParticleDisplayData displayData;
|
||||||
|
@ -459,7 +460,7 @@ void TestParticleDisplay::onEnter()
|
||||||
bone->changeDisplayByIndex(0, true);
|
bone->changeDisplayByIndex(0, true);
|
||||||
bone->setIgnoreMovementBoneData(true);
|
bone->setIgnoreMovementBoneData(true);
|
||||||
bone->setZOrder(100);
|
bone->setZOrder(100);
|
||||||
bone->setScale(2);
|
bone->setScale(1.2);
|
||||||
armature->addBone(bone, "bady-a3");
|
armature->addBone(bone, "bady-a3");
|
||||||
|
|
||||||
bone = cocos2d::extension::CCBone::create("p2");
|
bone = cocos2d::extension::CCBone::create("p2");
|
||||||
|
@ -467,7 +468,7 @@ void TestParticleDisplay::onEnter()
|
||||||
bone->changeDisplayByIndex(0, true);
|
bone->changeDisplayByIndex(0, true);
|
||||||
bone->setIgnoreMovementBoneData(true);
|
bone->setIgnoreMovementBoneData(true);
|
||||||
bone->setZOrder(100);
|
bone->setZOrder(100);
|
||||||
bone->setScale(2);
|
bone->setScale(1.2);
|
||||||
armature->addBone(bone, "bady-a30");
|
armature->addBone(bone, "bady-a30");
|
||||||
}
|
}
|
||||||
std::string TestParticleDisplay::title()
|
std::string TestParticleDisplay::title()
|
||||||
|
@ -504,7 +505,7 @@ void TestUseMutiplePicture::onEnter()
|
||||||
armature = cocos2d::extension::CCArmature::create("Knight_f/Knight");
|
armature = cocos2d::extension::CCArmature::create("Knight_f/Knight");
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setPosition(ccp(VisibleRect::left().x+70, VisibleRect::left().y));
|
armature->setPosition(ccp(VisibleRect::left().x+70, VisibleRect::left().y));
|
||||||
armature->setScale(2);
|
armature->setScale(1.2);
|
||||||
addChild(armature);
|
addChild(armature);
|
||||||
|
|
||||||
std::string weapon[] = {"weapon_f-sword.png", "weapon_f-sword2.png", "weapon_f-sword3.png", "weapon_f-sword4.png", "weapon_f-sword5.png", "weapon_f-knife.png", "weapon_f-hammer.png"};
|
std::string weapon[] = {"weapon_f-sword.png", "weapon_f-sword2.png", "weapon_f-sword3.png", "weapon_f-sword4.png", "weapon_f-sword5.png", "weapon_f-knife.png", "weapon_f-hammer.png"};
|
||||||
|
@ -518,7 +519,7 @@ void TestUseMutiplePicture::onEnter()
|
||||||
}
|
}
|
||||||
std::string TestUseMutiplePicture::title()
|
std::string TestUseMutiplePicture::title()
|
||||||
{
|
{
|
||||||
return "Test One cocos2d::extension::CCArmature Use Different Picture";
|
return "Test One CCArmature Use Different Picture";
|
||||||
}
|
}
|
||||||
std::string TestUseMutiplePicture::subtitle()
|
std::string TestUseMutiplePicture::subtitle()
|
||||||
{
|
{
|
||||||
|
@ -547,15 +548,15 @@ void TestBox2DDetector::onEnter()
|
||||||
armature = cocos2d::extension::CCArmature::create("Cowboy");
|
armature = cocos2d::extension::CCArmature::create("Cowboy");
|
||||||
armature->getAnimation()->play("Fire");
|
armature->getAnimation()->play("Fire");
|
||||||
armature->getAnimation()->setAnimationScale(0.1f);
|
armature->getAnimation()->setAnimationScale(0.1f);
|
||||||
armature->setScaleX(-0.3f);
|
armature->setScaleX(-0.2f);
|
||||||
armature->setScaleY(0.3f);
|
armature->setScaleY(0.2f);
|
||||||
armature->setPosition(ccp(VisibleRect::left().x + 70, VisibleRect::left().y));
|
armature->setPosition(ccp(VisibleRect::left().x + 70, VisibleRect::left().y));
|
||||||
addChild(armature);
|
addChild(armature);
|
||||||
|
|
||||||
armature2 = cocos2d::extension::CCArmature::create("Cowboy");
|
armature2 = cocos2d::extension::CCArmature::create("Cowboy");
|
||||||
armature2->getAnimation()->play("Walk");
|
armature2->getAnimation()->play("Walk");
|
||||||
armature2->setScaleX(-0.3f);
|
armature2->setScaleX(-0.2f);
|
||||||
armature2->setScaleY(0.3f);
|
armature2->setScaleY(0.2f);
|
||||||
armature2->setPosition(ccp(VisibleRect::right().x - 30, VisibleRect::left().y));
|
armature2->setPosition(ccp(VisibleRect::right().x - 30, VisibleRect::left().y));
|
||||||
addChild(armature2);
|
addChild(armature2);
|
||||||
|
|
||||||
|
@ -596,6 +597,7 @@ void TestBoundingBox::onEnter()
|
||||||
armature = cocos2d::extension::CCArmature::create("Zombie_f/Zombie");
|
armature = cocos2d::extension::CCArmature::create("Zombie_f/Zombie");
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setPosition(VisibleRect::center());
|
armature->setPosition(VisibleRect::center());
|
||||||
|
armature->setScale(0.6);
|
||||||
addChild(armature);
|
addChild(armature);
|
||||||
}
|
}
|
||||||
std::string TestBoundingBox::title()
|
std::string TestBoundingBox::title()
|
||||||
|
@ -623,6 +625,7 @@ void TestAnchorPoint::onEnter()
|
||||||
cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Zombie_f/Zombie");
|
cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Zombie_f/Zombie");
|
||||||
armature->getAnimation()->playByIndex(0);
|
armature->getAnimation()->playByIndex(0);
|
||||||
armature->setPosition(VisibleRect::center());
|
armature->setPosition(VisibleRect::center());
|
||||||
|
armature->setScale(0.6);
|
||||||
addChild(armature, 0, i);
|
addChild(armature, 0, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,7 +650,7 @@ void TestArmatureNesting::onEnter()
|
||||||
armature = cocos2d::extension::CCArmature::create("cyborg");
|
armature = cocos2d::extension::CCArmature::create("cyborg");
|
||||||
armature->getAnimation()->playByIndex(1);
|
armature->getAnimation()->playByIndex(1);
|
||||||
armature->setPosition(VisibleRect::center());
|
armature->setPosition(VisibleRect::center());
|
||||||
armature->setScale(2);
|
armature->setScale(1.2);
|
||||||
armature->getAnimation()->setAnimationScale(0.4f);
|
armature->getAnimation()->setAnimationScale(0.4f);
|
||||||
addChild(armature);
|
addChild(armature);
|
||||||
|
|
||||||
|
@ -655,7 +658,7 @@ void TestArmatureNesting::onEnter()
|
||||||
}
|
}
|
||||||
std::string TestArmatureNesting::title()
|
std::string TestArmatureNesting::title()
|
||||||
{
|
{
|
||||||
return "Test cocos2d::extension::CCArmature Nesting";
|
return "Test CCArmature Nesting";
|
||||||
}
|
}
|
||||||
bool TestArmatureNesting::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
|
bool TestArmatureNesting::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
#include "cocos-ext.h"
|
#include "cocos-ext.h"
|
||||||
#include "../../VisibleRect.h"
|
#include "../../VisibleRect.h"
|
||||||
#include "../../testBasic.h"
|
#include "../../testBasic.h"
|
||||||
//#include "vld.h"
|
|
||||||
|
|
||||||
//#include "Box2D/Box2D.h"
|
|
||||||
|
|
||||||
|
|
||||||
class ArmatureTestScene : public TestScene
|
class ArmatureTestScene : public TestScene
|
||||||
{
|
{
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
a606a7cb80629a1b2ca56c0100155d44765d42f5
|
de70fbc4aea5b5d4b92c49f7eb4b287d8c7207de
|
|
@ -1 +1 @@
|
||||||
f586581454edb9506a141c21bbed73c3cd95a3b4
|
1e23c24d85665d55df741c3823dcc69002aff007
|
Loading…
Reference in New Issue