- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
namespace spine {
static SkeletonBatch* instance = nullptr;
void SkeletonBatch::setBufferSize (int vertexCount) {
if (instance) delete instance;
instance = new SkeletonBatch(vertexCount);
}
SkeletonBatch* SkeletonBatch::getInstance () {
if (!instance) instance = new SkeletonBatch(8192);
return instance;
}
SkeletonBatch::SkeletonBatch (int capacity) :
_capacity(capacity), _position(0)
{
_buffer = new V3F_C4B_T2F[capacity];
_firstCommand = new Command();
_command = _firstCommand;
Director::getInstance()->getScheduler()->scheduleUpdate(this, -1, false);
}
SkeletonBatch::~SkeletonBatch () {
Director::getInstance()->getScheduler()->unscheduleUpdate(this);
Command* command = _firstCommand;
while (command) {
Command* next = command->next;
delete command;
command = next;
}
delete [] _buffer;
}
https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-cocos2dx/3/src/spine/SkeletonBatch.cpp
Это просто шедевЕр! Течет как ссаные тряпки...