mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-14 11:01:36 +08:00
Added new operator on SpineObject that doesn't require file and line number.
This commit is contained in:
parent
c2308a6794
commit
9415a9a27f
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -278,7 +278,7 @@ void SFMLTextureLoader::unload(void *texture) {
|
||||
deleteTexture(texture);
|
||||
}
|
||||
|
||||
SpineExtension *getDefaultExtension() {
|
||||
/*SpineExtension *getDefaultExtension() {
|
||||
return new DefaultSpineExtension();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user