axmol/cocos/editor-support/cocostudio/ext/SpineSkeletonDataCache.h

47 lines
1.1 KiB
C
Raw Normal View History

2019-11-24 23:15:56 +08:00
#ifndef _SPINESKELETONDATACACHE_H_
#define _SPINESKELETONDATACACHE_H_
#include <cocos2d.h>
#include "spine/spine.h"
#include "spine/spine-cocos2dx.h"
#include "editor-support/cocostudio/CocosStudioExport.h"
#include <functional>
2019-11-24 23:15:56 +08:00
class CC_STUDIO_DLL SpineSkeletonDataCache
{
public:
class SkeletonData : public cocos2d::Ref
{
public:
SkeletonData(spSkeletonData* d, spAttachmentLoader* loader) : data(d), attachmentLoader(loader) {}
~SkeletonData()
{
if (data != nullptr)
spSkeletonData_dispose(data);
if (attachmentLoader != nullptr)
spAttachmentLoader_dispose(attachmentLoader);
}
spAttachmentLoader* attachmentLoader;
spSkeletonData* data;
};
static SpineSkeletonDataCache* getInstance();
SpineSkeletonDataCache();
void setErrorReportFunc(void(*errorfunc)(const char* pszFormat, ...));
2019-11-24 23:15:56 +08:00
SkeletonData* addData(const char* dataFile, const char* atlasFile, float scale);
void removeData(const char* dataFile);
void removeAllData(void);
void removeAllUnusedData(void);
public:
std::map<std::string, SkeletonData*> _cacheTable;
void(*_reportError)(const char* pszFormat, ...);
2019-11-24 23:15:56 +08:00
};
#endif