From 2a32c3e113db293ce11656451df37ee7a414b4d3 Mon Sep 17 00:00:00 2001 From: badlogic Date: Mon, 1 Aug 2016 12:16:43 +0200 Subject: [PATCH] [cocos2d-x] Closes #612, added SkeletonBatch::destroyInstance for testing purposes --- spine-cocos2dx/src/spine/SkeletonBatch.cpp | 7 +++++++ spine-cocos2dx/src/spine/SkeletonBatch.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/spine-cocos2dx/src/spine/SkeletonBatch.cpp b/spine-cocos2dx/src/spine/SkeletonBatch.cpp index 5dcd621b0..1237f0d74 100644 --- a/spine-cocos2dx/src/spine/SkeletonBatch.cpp +++ b/spine-cocos2dx/src/spine/SkeletonBatch.cpp @@ -50,6 +50,13 @@ SkeletonBatch* SkeletonBatch::getInstance () { if (!instance) instance = new SkeletonBatch(8192); return instance; } + +void SkeletonBatch::destroyInstance () { + if (instance) { + delete instance; + instance = nullptr; + } +} SkeletonBatch::SkeletonBatch (int capacity) : _capacity(capacity), _position(0) diff --git a/spine-cocos2dx/src/spine/SkeletonBatch.h b/spine-cocos2dx/src/spine/SkeletonBatch.h index b0bc1370d..98419bef1 100644 --- a/spine-cocos2dx/src/spine/SkeletonBatch.h +++ b/spine-cocos2dx/src/spine/SkeletonBatch.h @@ -45,6 +45,8 @@ public: static void setBufferSize (int vertexCount); static SkeletonBatch* getInstance (); + + static void destroyInstance (); void update (float delta);