From 371aaefa9fc8cb041d59f727ad9e7f2ad31cd405 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Mon, 16 Mar 2015 20:02:11 +0100 Subject: [PATCH] Added const char* methods so NULL can be passed. --- spine-cocos2dx/3/src/spine/SkeletonRenderer.cpp | 6 ++++++ spine-cocos2dx/3/src/spine/SkeletonRenderer.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/spine-cocos2dx/3/src/spine/SkeletonRenderer.cpp b/spine-cocos2dx/3/src/spine/SkeletonRenderer.cpp index 07c7b3144..3b48f2b7d 100644 --- a/spine-cocos2dx/3/src/spine/SkeletonRenderer.cpp +++ b/spine-cocos2dx/3/src/spine/SkeletonRenderer.cpp @@ -348,6 +348,9 @@ spSlot* SkeletonRenderer::findSlot (const std::string& slotName) const { bool SkeletonRenderer::setSkin (const std::string& skinName) { return spSkeleton_setSkinByName(_skeleton, skinName.empty() ? 0 : skinName.c_str()) ? true : false; } +bool SkeletonRenderer::setSkin (const char* skinName) { + return spSkeleton_setSkinByName(_skeleton, skinName) ? true : false; +} spAttachment* SkeletonRenderer::getAttachment (const std::string& slotName, const std::string& attachmentName) const { return spSkeleton_getAttachmentForSlotName(_skeleton, slotName.c_str(), attachmentName.c_str()); @@ -355,6 +358,9 @@ spAttachment* SkeletonRenderer::getAttachment (const std::string& slotName, cons bool SkeletonRenderer::setAttachment (const std::string& slotName, const std::string& attachmentName) { return spSkeleton_setAttachment(_skeleton, slotName.c_str(), attachmentName.empty() ? 0 : attachmentName.c_str()) ? true : false; } +bool SkeletonRenderer::setAttachment (const std::string& slotName, const char* attachmentName) { + return spSkeleton_setAttachment(_skeleton, slotName.c_str(), attachmentName) ? true : false; +} spSkeleton* SkeletonRenderer::getSkeleton () { return _skeleton; diff --git a/spine-cocos2dx/3/src/spine/SkeletonRenderer.h b/spine-cocos2dx/3/src/spine/SkeletonRenderer.h index 9a7696817..7d6055d7b 100644 --- a/spine-cocos2dx/3/src/spine/SkeletonRenderer.h +++ b/spine-cocos2dx/3/src/spine/SkeletonRenderer.h @@ -79,12 +79,16 @@ public: * attached if the corresponding attachment from the old skin was attached. Returns false if the skin was not found. * @param skin May be empty string ("") for no skin.*/ bool setSkin (const std::string& skinName); + /** @param skin May be 0 for no skin.*/ + bool setSkin (const char* skinName); /* Returns 0 if the slot or attachment was not found. */ spAttachment* getAttachment (const std::string& slotName, const std::string& attachmentName) const; /* Returns false if the slot or attachment was not found. * @param attachmentName May be empty string ("") for no attachment. */ bool setAttachment (const std::string& slotName, const std::string& attachmentName); + /* @param attachmentName May be 0 for no attachment. */ + bool setAttachment (const std::string& slotName, const char* attachmentName); // --- BlendProtocol virtual void setBlendFunc (const cocos2d::BlendFunc& blendFunc);