mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
[cocos2dx] Fixed formatting, removed printf...
This commit is contained in:
parent
6fdded7bf8
commit
ca23700db0
@ -65,7 +65,7 @@ bool BatchingExample::init () {
|
|||||||
|
|
||||||
int xMin = _contentSize.width * 0.10f, xMax = _contentSize.width * 0.90f;
|
int xMin = _contentSize.width * 0.10f, xMax = _contentSize.width * 0.90f;
|
||||||
int yMin = 0, yMax = _contentSize.height * 0.7f;
|
int yMin = 0, yMax = _contentSize.height * 0.7f;
|
||||||
for (int i = 0; i < 500; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
// Each skeleton node shares the same atlas, skeleton data, and mix times.
|
// Each skeleton node shares the same atlas, skeleton data, and mix times.
|
||||||
SkeletonAnimation* skeletonNode = SkeletonAnimation::createWithData(_skeletonData, false);
|
SkeletonAnimation* skeletonNode = SkeletonAnimation::createWithData(_skeletonData, false);
|
||||||
skeletonNode->setAnimationStateData(_stateData);
|
skeletonNode->setAnimationStateData(_stateData);
|
||||||
@ -73,6 +73,8 @@ bool BatchingExample::init () {
|
|||||||
skeletonNode->setAnimation(0, "walk", true);
|
skeletonNode->setAnimation(0, "walk", true);
|
||||||
skeletonNode->addAnimation(0, "jump", true, RandomHelper::random_int(0, 300) / 100.0f);
|
skeletonNode->addAnimation(0, "jump", true, RandomHelper::random_int(0, 300) / 100.0f);
|
||||||
skeletonNode->addAnimation(0, "run", true);
|
skeletonNode->addAnimation(0, "run", true);
|
||||||
|
|
||||||
|
skeletonNode->setTwoColorTint(true);
|
||||||
|
|
||||||
skeletonNode->setPosition(Vec2(
|
skeletonNode->setPosition(Vec2(
|
||||||
RandomHelper::random_int(xMin, xMax),
|
RandomHelper::random_int(xMin, xMax),
|
||||||
|
|||||||
@ -43,11 +43,11 @@ Scene* GoblinsExample::scene () {
|
|||||||
bool GoblinsExample::init () {
|
bool GoblinsExample::init () {
|
||||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||||
|
|
||||||
skeletonNode = SkeletonAnimation::createWithJsonFile("goblins-mesh.json", "goblins.atlas", 1.5f);
|
skeletonNode = SkeletonAnimation::createWithBinaryFile("TwoColorTest.skel", "TwoColorTest.atlas", 0.5f);
|
||||||
skeletonNode->setAnimation(0, "walk", true);
|
skeletonNode->setAnimation(0, "animation", true);
|
||||||
skeletonNode->setSkin("goblin");
|
// skeletonNode->setSkin("goblin");
|
||||||
|
|
||||||
skeletonNode->setPosition(Vec2(_contentSize.width / 2, 20));
|
skeletonNode->setPosition(Vec2(_contentSize.width / 2, _contentSize.height / 2));
|
||||||
addChild(skeletonNode);
|
addChild(skeletonNode);
|
||||||
|
|
||||||
scheduleUpdate();
|
scheduleUpdate();
|
||||||
|
|||||||
@ -44,7 +44,7 @@ bool TankExample::init () {
|
|||||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||||
|
|
||||||
skeletonNode = SkeletonAnimation::createWithJsonFile("tank.json", "tank.atlas", 0.5f);
|
skeletonNode = SkeletonAnimation::createWithJsonFile("tank.json", "tank.atlas", 0.5f);
|
||||||
skeletonNode->setAnimation(0, "drive", true);
|
skeletonNode->setAnimation(0, "drive", true);
|
||||||
|
|
||||||
skeletonNode->setPosition(Vec2(_contentSize.width / 2 + 400, 20));
|
skeletonNode->setPosition(Vec2(_contentSize.width / 2 + 400, 20));
|
||||||
addChild(skeletonNode);
|
addChild(skeletonNode);
|
||||||
|
|||||||
@ -43,13 +43,7 @@ using std::max;
|
|||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
|
|
||||||
TwoColorTrianglesCommand::TwoColorTrianglesCommand()
|
TwoColorTrianglesCommand::TwoColorTrianglesCommand() :_materialID(0), _textureID(0), _glProgramState(nullptr), _glProgram(nullptr), _blendType(BlendFunc::DISABLE), _alphaTextureID(0) {
|
||||||
:_materialID(0)
|
|
||||||
,_textureID(0)
|
|
||||||
,_glProgramState(nullptr)
|
|
||||||
,_glProgram(nullptr)
|
|
||||||
,_blendType(BlendFunc::DISABLE)
|
|
||||||
,_alphaTextureID(0) {
|
|
||||||
_type = RenderCommand::Type::CUSTOM_COMMAND;
|
_type = RenderCommand::Type::CUSTOM_COMMAND;
|
||||||
func = [this]() { draw(); };
|
func = [this]() { draw(); };
|
||||||
}
|
}
|
||||||
@ -83,8 +77,7 @@ void TwoColorTrianglesCommand::init(float globalOrder, GLuint textureID, GLProgr
|
|||||||
TwoColorTrianglesCommand::~TwoColorTrianglesCommand() {
|
TwoColorTrianglesCommand::~TwoColorTrianglesCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwoColorTrianglesCommand::generateMaterialID()
|
void TwoColorTrianglesCommand::generateMaterialID() {
|
||||||
{
|
|
||||||
// do not batch if using custom uniforms (since we cannot batch) it
|
// do not batch if using custom uniforms (since we cannot batch) it
|
||||||
if(_glProgramState->getUniformCount() > 0) {
|
if(_glProgramState->getUniformCount() > 0) {
|
||||||
_materialID = Renderer::MATERIAL_ID_DO_NOT_BATCH;
|
_materialID = Renderer::MATERIAL_ID_DO_NOT_BATCH;
|
||||||
@ -97,8 +90,7 @@ void TwoColorTrianglesCommand::generateMaterialID()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwoColorTrianglesCommand::useMaterial() const
|
void TwoColorTrianglesCommand::useMaterial() const {
|
||||||
{
|
|
||||||
//Set texture
|
//Set texture
|
||||||
GL::bindTexture2D(_textureID);
|
GL::bindTexture2D(_textureID);
|
||||||
|
|
||||||
@ -212,8 +204,7 @@ SkeletonTwoColorBatch::~SkeletonTwoColorBatch () {
|
|||||||
delete _indexBuffer;
|
delete _indexBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonTwoColorBatch::update (float delta) {
|
void SkeletonTwoColorBatch::update (float delta) {
|
||||||
printf("Num batches: %i\n", _numBatches);
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user