Browse Source

Allow SkeletonBinary and SkeletonJson to own externally created AttachmentLoader (#1846)

RH 4 years ago
parent
commit
63ef1938b9

+ 1 - 1
spine-cpp/spine-cpp/include/spine/SkeletonBinary.h

@@ -68,7 +68,7 @@ namespace spine {
 
 		explicit SkeletonBinary(Atlas* atlasArray);
 
-		explicit SkeletonBinary(AttachmentLoader* attachmentLoader);
+		explicit SkeletonBinary(AttachmentLoader* attachmentLoader, bool ownsLoader = false);
 
 		~SkeletonBinary();
 

+ 1 - 1
spine-cpp/spine-cpp/include/spine/SkeletonJson.h

@@ -57,7 +57,7 @@ class SP_API SkeletonJson : public SpineObject {
 public:
 	explicit SkeletonJson(Atlas *atlas);
 
-	explicit SkeletonJson(AttachmentLoader *attachmentLoader);
+	explicit SkeletonJson(AttachmentLoader *attachmentLoader, bool ownsLoader = false);
 
 	~SkeletonJson();
 

+ 2 - 2
spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp

@@ -98,8 +98,8 @@ SkeletonBinary::SkeletonBinary(Atlas *atlasArray) : _attachmentLoader(
 
 }
 
-SkeletonBinary::SkeletonBinary(AttachmentLoader *attachmentLoader) : _attachmentLoader(attachmentLoader), _error(),
-	_scale(1), _ownsLoader(false)
+SkeletonBinary::SkeletonBinary(AttachmentLoader* attachmentLoader, bool ownsLoader) : _attachmentLoader(attachmentLoader), _error(),
+_scale(1), _ownsLoader(ownsLoader)
 {
 	assert(_attachmentLoader != NULL);
 }

+ 2 - 2
spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp

@@ -84,8 +84,8 @@ SkeletonJson::SkeletonJson(Atlas *atlas) : _attachmentLoader(new(__FILE__, __LIN
 	_scale(1), _ownsLoader(true)
 {}
 
-SkeletonJson::SkeletonJson(AttachmentLoader *attachmentLoader) : _attachmentLoader(attachmentLoader), _scale(1),
-	_ownsLoader(false)
+SkeletonJson::SkeletonJson(AttachmentLoader *attachmentLoader, bool ownsLoader) : _attachmentLoader(attachmentLoader), _scale(1),
+	_ownsLoader(ownsLoader)
 {
 	assert(_attachmentLoader != NULL);
 }