Added new operator on SpineObject that doesn't require file and line number.

This commit is contained in:
badlogic 2018-06-11 14:52:35 +02:00
parent c2308a6794
commit 9415a9a27f
4 changed files with 13 additions and 7 deletions

View File

@ -39,6 +39,8 @@ class String;
class SpineObject {
public:
void *operator new(size_t sz);
void *operator new(size_t sz, const char *file, int line);
void *operator new(size_t sz, void *ptr);

View File

@ -37,6 +37,10 @@
using namespace spine;
void *SpineObject::operator new(size_t sz) {
return SpineExtension::calloc<SpineObject>(sz, __FILE__, __LINE__);
}
void *SpineObject::operator new(size_t sz, const char *file, int line) {
return SpineExtension::calloc<SpineObject>(sz, file, line);
}

View File

@ -66,14 +66,13 @@ void callback (AnimationState* state, EventType type, TrackEntry* entry, Event*
}
SkeletonData* readSkeletonJsonData (const String& filename, Atlas* atlas, float scale) {
SkeletonJson* json = new (__FILE__, __LINE__) SkeletonJson(atlas);
json->setScale(scale);
SkeletonData* skeletonData = json->readSkeletonDataFile(filename);
SkeletonJson json(atlas);
json.setScale(scale);
SkeletonData* skeletonData = json.readSkeletonDataFile(filename);
if (!skeletonData) {
printf("%s\n", json->getError().buffer());
printf("%s\n", json.getError().buffer());
exit(0);
}
delete json;
return skeletonData;
}
@ -83,6 +82,7 @@ SkeletonData* readSkeletonBinaryData (const char* filename, Atlas* atlas, float
SkeletonData *skeletonData = binary->readSkeletonDataFile(filename);
if (!skeletonData) {
printf("%s\n", binary->getError().buffer());
delete binary;
exit(0);
}
delete binary;

View File

@ -278,7 +278,7 @@ void SFMLTextureLoader::unload(void *texture) {
deleteTexture(texture);
}
SpineExtension *getDefaultExtension() {
/*SpineExtension *getDefaultExtension() {
return new DefaultSpineExtension();
}
}*/
}