From c2e85c1ae4bc6348bf575102d25e596cba10fded Mon Sep 17 00:00:00 2001 From: chengstory Date: Sat, 8 Jun 2013 17:11:11 +0800 Subject: [PATCH] 1. adds support for iOS and Mac. 2. Modify position of some examples. --- .../ArmatureTest/ArmatureScene.cpp | 69 ++++++++++--------- .../ArmatureTest/ArmatureScene.h | 4 -- .../project.pbxproj.REMOVED.git-id | 2 +- .../project.pbxproj.REMOVED.git-id | 2 +- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp index fc56c9d480..fe72aa3666 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp @@ -125,6 +125,7 @@ void ArmatureTestScene::MainMenuCallback(CCObject* pSender) void ArmatureTestLayer::onEnter() { + CCLayer::onEnter(); // add title and subtitle @@ -138,7 +139,7 @@ void ArmatureTestLayer::onEnter() std::string strSubtitle = subtitle(); 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)); addChild(l, 1, 10001); l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 60) ); @@ -158,8 +159,8 @@ void ArmatureTestLayer::onEnter() addChild(menu, 100); - setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor)); + } void ArmatureTestLayer::onExit() { @@ -198,11 +199,6 @@ void ArmatureTestLayer::backCallback(CCObject* pSender) void ArmatureTestLayer::draw() { CCLayer::draw(); - -// CC_NODE_DRAW_SETUP(); -// ccDrawColor4B(0,0,0,255); -// ccDrawLine(VisibleRect::left(), VisibleRect::right()); -// ccDrawLine(VisibleRect::bottom(), VisibleRect::top()); } @@ -216,8 +212,10 @@ void TestDragonBones20::onEnter() armature->getAnimation()->playByIndex(1); armature->getAnimation()->setAnimationScale(0.4f); armature->setPosition(VisibleRect::center().x, VisibleRect::center().y * 0.3f); - addChild(armature); - + armature->setScale(0.6); + addChild(armature); + + } std::string TestDragonBones20::title() @@ -229,12 +227,10 @@ std::string TestDragonBones20::title() void TestCSWithSkeleton::onEnter() { ArmatureTestLayer::onEnter(); - cocos2d::extension::CCArmature *armature = NULL; - armature = cocos2d::extension::CCArmature::create("Cowboy"); armature->getAnimation()->playByIndex(0); - armature->setScale(0.3f); + armature->setScale(0.2f); armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y/*-100*/)); addChild(armature); } @@ -249,12 +245,11 @@ std::string TestCSWithSkeleton::title() void TestCSWithoutSkeleton::onEnter() { ArmatureTestLayer::onEnter(); - cocos2d::extension::CCArmature *armature = NULL; - armature = cocos2d::extension::CCArmature::create("TestBone"); 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)); addChild(armature); } @@ -274,7 +269,9 @@ void TestCSContertFromDragonBone::onEnter() cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Zombie_zamboni"); armature->getAnimation()->playByIndex(1); 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); } @@ -299,13 +296,14 @@ void TestPerformance::onEnter() scheduleUpdate(); } + std::string TestPerformance::title() { return "Test Performance"; } std::string TestPerformance::subtitle() { - return "Current cocos2d::extension::CCArmature Count : "; + return "Current CCArmature Count : "; } void TestPerformance::addArmature(cocos2d::extension::CCArmature *armature) { @@ -324,6 +322,7 @@ void TestPerformance::update(float delta) armature->init("Knight_f/Knight"); armature->getAnimation()->playByIndex(0); armature->setPosition(50 + armatureCount * 2, 150); + armature->setScale(0.6); addArmature(armature); armature->release(); @@ -350,11 +349,12 @@ void TestChangeZorder::onEnter() armature->getAnimation()->playByIndex(0); armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100)); ++currentTag; + armature->setScale(0.6f); addChild(armature, currentTag, currentTag); armature = cocos2d::extension::CCArmature::create("TestBone"); armature->getAnimation()->playByIndex(0); - armature->setScale(0.3f); + armature->setScale(0.24f); armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100)); ++currentTag; addChild(armature, currentTag, currentTag); @@ -363,6 +363,7 @@ void TestChangeZorder::onEnter() armature->getAnimation()->playByIndex(0); armature->setPosition(ccp(VisibleRect::center().x , VisibleRect::center().y-100)); ++currentTag; + armature->setScale(0.6f); addChild(armature, currentTag, currentTag); schedule( schedule_selector(TestChangeZorder::changeZorder), 1); @@ -371,7 +372,7 @@ void TestChangeZorder::onEnter() } 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) { @@ -392,15 +393,15 @@ void TestAnimationEvent::onEnter() ArmatureTestLayer::onEnter(); armature = cocos2d::extension::CCArmature::create("Cowboy"); armature->getAnimation()->play("Fire"); - armature->setScaleX(-0.3f); - armature->setScaleY(0.3f); + armature->setScaleX(-0.24f); + armature->setScaleY(0.24f); armature->setPosition(ccp(VisibleRect::left().x + 50, VisibleRect::left().y)); armature->getAnimation()->MovementEventSignal.connect(this, &TestAnimationEvent::animationEvent); addChild(armature); } 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) { @@ -448,7 +449,7 @@ void TestParticleDisplay::onEnter() armature = cocos2d::extension::CCArmature::create("robot"); armature->getAnimation()->playByIndex(0); armature->setPosition(VisibleRect::center()); - armature->setScale(0.6f); + armature->setScale(0.48f); addChild(armature); CCParticleDisplayData displayData; @@ -459,7 +460,7 @@ void TestParticleDisplay::onEnter() bone->changeDisplayByIndex(0, true); bone->setIgnoreMovementBoneData(true); bone->setZOrder(100); - bone->setScale(2); + bone->setScale(1.2); armature->addBone(bone, "bady-a3"); bone = cocos2d::extension::CCBone::create("p2"); @@ -467,7 +468,7 @@ void TestParticleDisplay::onEnter() bone->changeDisplayByIndex(0, true); bone->setIgnoreMovementBoneData(true); bone->setZOrder(100); - bone->setScale(2); + bone->setScale(1.2); armature->addBone(bone, "bady-a30"); } std::string TestParticleDisplay::title() @@ -504,7 +505,7 @@ void TestUseMutiplePicture::onEnter() armature = cocos2d::extension::CCArmature::create("Knight_f/Knight"); armature->getAnimation()->playByIndex(0); armature->setPosition(ccp(VisibleRect::left().x+70, VisibleRect::left().y)); - armature->setScale(2); + armature->setScale(1.2); 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"}; @@ -518,7 +519,7 @@ void TestUseMutiplePicture::onEnter() } std::string TestUseMutiplePicture::title() { - return "Test One cocos2d::extension::CCArmature Use Different Picture"; + return "Test One CCArmature Use Different Picture"; } std::string TestUseMutiplePicture::subtitle() { @@ -547,15 +548,15 @@ void TestBox2DDetector::onEnter() armature = cocos2d::extension::CCArmature::create("Cowboy"); armature->getAnimation()->play("Fire"); armature->getAnimation()->setAnimationScale(0.1f); - armature->setScaleX(-0.3f); - armature->setScaleY(0.3f); + armature->setScaleX(-0.2f); + armature->setScaleY(0.2f); armature->setPosition(ccp(VisibleRect::left().x + 70, VisibleRect::left().y)); addChild(armature); armature2 = cocos2d::extension::CCArmature::create("Cowboy"); armature2->getAnimation()->play("Walk"); - armature2->setScaleX(-0.3f); - armature2->setScaleY(0.3f); + armature2->setScaleX(-0.2f); + armature2->setScaleY(0.2f); armature2->setPosition(ccp(VisibleRect::right().x - 30, VisibleRect::left().y)); addChild(armature2); @@ -596,6 +597,7 @@ void TestBoundingBox::onEnter() armature = cocos2d::extension::CCArmature::create("Zombie_f/Zombie"); armature->getAnimation()->playByIndex(0); armature->setPosition(VisibleRect::center()); + armature->setScale(0.6); addChild(armature); } std::string TestBoundingBox::title() @@ -623,6 +625,7 @@ void TestAnchorPoint::onEnter() cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Zombie_f/Zombie"); armature->getAnimation()->playByIndex(0); armature->setPosition(VisibleRect::center()); + armature->setScale(0.6); addChild(armature, 0, i); } @@ -647,7 +650,7 @@ void TestArmatureNesting::onEnter() armature = cocos2d::extension::CCArmature::create("cyborg"); armature->getAnimation()->playByIndex(1); armature->setPosition(VisibleRect::center()); - armature->setScale(2); + armature->setScale(1.2); armature->getAnimation()->setAnimationScale(0.4f); addChild(armature); @@ -655,7 +658,7 @@ void TestArmatureNesting::onEnter() } std::string TestArmatureNesting::title() { - return "Test cocos2d::extension::CCArmature Nesting"; + return "Test CCArmature Nesting"; } bool TestArmatureNesting::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.h b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.h index 652c19479e..88064b3075 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.h +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.h @@ -5,10 +5,6 @@ #include "cocos-ext.h" #include "../../VisibleRect.h" #include "../../testBasic.h" -//#include "vld.h" - -//#include "Box2D/Box2D.h" - class ArmatureTestScene : public TestScene { diff --git a/samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id index 071ada9c94..85267bd3f2 100644 --- a/samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -a606a7cb80629a1b2ca56c0100155d44765d42f5 \ No newline at end of file +de70fbc4aea5b5d4b92c49f7eb4b287d8c7207de \ No newline at end of file diff --git a/samples/Cpp/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/Cpp/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id index 4ada33c054..eec067e7b2 100644 --- a/samples/Cpp/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/Cpp/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -f586581454edb9506a141c21bbed73c3cd95a3b4 \ No newline at end of file +1e23c24d85665d55df741c3823dcc69002aff007 \ No newline at end of file