From 17854cd922502cdd76538fac6ad7607fc23f153f Mon Sep 17 00:00:00 2001 From: yangxiao Date: Tue, 17 Jun 2014 13:45:58 +0800 Subject: [PATCH 1/2] change speed --- cocos/Android.mk | 4 ++-- tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cocos/Android.mk b/cocos/Android.mk index 38ff47598e..0ea402566a 100644 --- a/cocos/Android.mk +++ b/cocos/Android.mk @@ -189,13 +189,13 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \ LOCAL_C_INCLUDES := $(LOCAL_PATH) \ $(LOCAL_PATH)/. \ $(LOCAL_PATH)/platform/android \ + $(LOCAL_PATH)/../external \ $(LOCAL_PATH)/../external/tinyxml2 \ $(LOCAL_PATH)/../external/unzip \ $(LOCAL_PATH)/../external/chipmunk/include/chipmunk \ $(LOCAL_PATH)/../external/edtaa3func \ $(LOCAL_PATH)/../external/xxhash \ - $(LOCAL_PATH)/../external/ConvertUTF \ - $(LOCAL_PATH)/../external/json + $(LOCAL_PATH)/../external/ConvertUTF LOCAL_LDLIBS := -lGLESv2 \ diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 3bc7f1e535..5ff2b3b186 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -555,9 +555,14 @@ void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p) animate->setPlayBack(true); } - if(std::rand() % 3 == 0) + int rand2 = std::rand(); + if(rand2 % 3 == 1) { - animate->setSpeed(animate->getSpeed() * (std::rand() % 10)); + animate->setSpeed(animate->getSpeed() + CCRANDOM_0_1()); + } + else if(rand2 % 3 == 2) + { + animate->setSpeed(animate->getSpeed() - 0.5 * CCRANDOM_0_1()); } sprite->runAction(RepeatForever::create(animate)); From fd02a914f4528f9eeb952bffbb25fd652778b231 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Tue, 17 Jun 2014 13:50:58 +0800 Subject: [PATCH 2/2] remove unused code --- cocos/3d/CCAnimation3D.cpp | 14 -------------- cocos/3d/CCAnimation3D.h | 3 --- 2 files changed, 17 deletions(-) diff --git a/cocos/3d/CCAnimation3D.cpp b/cocos/3d/CCAnimation3D.cpp index ec14d8493d..7530334e94 100644 --- a/cocos/3d/CCAnimation3D.cpp +++ b/cocos/3d/CCAnimation3D.cpp @@ -75,20 +75,6 @@ Animation3D::~Animation3D() for (auto itor : _boneCurves) { CC_SAFE_DELETE(itor.second); } -// for (auto itor : _boneTransCurves) { -// CC_SAFE_RELEASE(itor.second); -// } -// _boneTransCurves.clear(); -// -// for (auto itor : _boneRotCurves) { -// CC_SAFE_RELEASE(itor.second); -// } -// _boneRotCurves.clear(); -// -// for (auto itor : _boneScaleCurves) { -// CC_SAFE_RELEASE(itor.second); -// } -// _boneScaleCurves.clear(); } Animation3D::Curve::Curve() diff --git a/cocos/3d/CCAnimation3D.h b/cocos/3d/CCAnimation3D.h index 773d6398e3..75e61ff965 100644 --- a/cocos/3d/CCAnimation3D.h +++ b/cocos/3d/CCAnimation3D.h @@ -71,9 +71,6 @@ protected: std::unordered_map _boneCurves;//bone curves map, key bone name, value AnimationCurve -// std::unordered_map _boneTransCurves; -// std::unordered_map _boneRotCurves; -// std::unordered_map _boneScaleCurves; float _duration; //animation duration };