Merge pull request #4977 from dumganhar/jsb-armature-fix

Jsb armature fix
This commit is contained in:
James Chen 2014-01-07 05:18:45 -08:00
commit 5a31680211
4 changed files with 11 additions and 9 deletions

View File

@ -101,7 +101,7 @@ Armature::~Armature(void)
bool Armature::init()
{
return init(nullptr);
return init("");
}

View File

@ -1023,7 +1023,7 @@ void TestColliderDetector::update(float delta)
// This code is just telling how to get the vertex.
// For a more accurate collider detection, you need to implemente yourself.
const Map<std::string, Bone*>& map = armature2->getBoneDic();
for(auto element : map)
for(const auto& element : map)
{
Bone *bone = element.second;
ColliderDetector *detector = bone->getColliderDetector();
@ -1033,12 +1033,12 @@ void TestColliderDetector::update(float delta)
const cocos2d::Vector<ColliderBody*>& bodyList = detector->getColliderBodyList();
for (auto object : bodyList)
for (const auto& object : bodyList)
{
ColliderBody *body = static_cast<ColliderBody*>(object);
const std::vector<Point> &vertexList = body->getCalculatedVertexList();
float minx, miny, maxx, maxy = 0;
float minx = 0, miny = 0, maxx = 0, maxy = 0;
int length = vertexList.size();
for (int i = 0; i<length; i++)
{
@ -1264,7 +1264,7 @@ void TestArmatureNesting2::onEnter()
touchedMenu = false;
LabelTTF* label = CCLabelTTF::create("Change Mount", "Arial", 20);
MenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, CC_CALLBACK_1(TestArmatureNesting2::ChangeMountCallback, this));
MenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, CC_CALLBACK_1(TestArmatureNesting2::changeMountCallback, this));
Menu* pMenu =Menu::create(pMenuItem, nullptr);
@ -1321,7 +1321,7 @@ void TestArmatureNesting2::onTouchesEnded(const std::vector<Touch*>& touches, Ev
armature->runAction(Sequence::create(move, nullptr));
}
void TestArmatureNesting2::ChangeMountCallback(Object* pSender)
void TestArmatureNesting2::changeMountCallback(Object* pSender)
{
hero->stopAllActions();

View File

@ -336,15 +336,16 @@ public:
class TestArmatureNesting2 : public ArmatureTestLayer
{
public:
virtual void onEnter();
virtual void onExit();
virtual void onEnter() override;
virtual void onExit() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
virtual void ChangeMountCallback(Object* pSender);
void changeMountCallback(Object* pSender);
virtual cocostudio::Armature *createMount(const char *name, Point position);
private:
Hero *hero;
cocostudio::Armature *horse;

View File

@ -79,3 +79,4 @@ abstract_classes = ColliderDetector ColliderBody ArmatureDataManager ComAttribut
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no
classes_need_extend = Armature