[cocos2dx] Fixed formatting, removed printf...

This commit is contained in:
badlogic 2017-02-28 15:40:07 +01:00
parent 6fdded7bf8
commit ca23700db0
4 changed files with 12 additions and 19 deletions

View File

@ -65,7 +65,7 @@ bool BatchingExample::init () {
int xMin = _contentSize.width * 0.10f, xMax = _contentSize.width * 0.90f;
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.
SkeletonAnimation* skeletonNode = SkeletonAnimation::createWithData(_skeletonData, false);
skeletonNode->setAnimationStateData(_stateData);
@ -74,6 +74,8 @@ bool BatchingExample::init () {
skeletonNode->addAnimation(0, "jump", true, RandomHelper::random_int(0, 300) / 100.0f);
skeletonNode->addAnimation(0, "run", true);
skeletonNode->setTwoColorTint(true);
skeletonNode->setPosition(Vec2(
RandomHelper::random_int(xMin, xMax),
RandomHelper::random_int(yMin, yMax)

View File

@ -43,11 +43,11 @@ Scene* GoblinsExample::scene () {
bool GoblinsExample::init () {
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
skeletonNode = SkeletonAnimation::createWithJsonFile("goblins-mesh.json", "goblins.atlas", 1.5f);
skeletonNode->setAnimation(0, "walk", true);
skeletonNode->setSkin("goblin");
skeletonNode = SkeletonAnimation::createWithBinaryFile("TwoColorTest.skel", "TwoColorTest.atlas", 0.5f);
skeletonNode->setAnimation(0, "animation", true);
// skeletonNode->setSkin("goblin");
skeletonNode->setPosition(Vec2(_contentSize.width / 2, 20));
skeletonNode->setPosition(Vec2(_contentSize.width / 2, _contentSize.height / 2));
addChild(skeletonNode);
scheduleUpdate();

View File

@ -43,13 +43,7 @@ using std::max;
namespace spine {
TwoColorTrianglesCommand::TwoColorTrianglesCommand()
:_materialID(0)
,_textureID(0)
,_glProgramState(nullptr)
,_glProgram(nullptr)
,_blendType(BlendFunc::DISABLE)
,_alphaTextureID(0) {
TwoColorTrianglesCommand::TwoColorTrianglesCommand() :_materialID(0), _textureID(0), _glProgramState(nullptr), _glProgram(nullptr), _blendType(BlendFunc::DISABLE), _alphaTextureID(0) {
_type = RenderCommand::Type::CUSTOM_COMMAND;
func = [this]() { draw(); };
}
@ -83,8 +77,7 @@ void TwoColorTrianglesCommand::init(float globalOrder, GLuint textureID, GLProgr
TwoColorTrianglesCommand::~TwoColorTrianglesCommand() {
}
void TwoColorTrianglesCommand::generateMaterialID()
{
void TwoColorTrianglesCommand::generateMaterialID() {
// do not batch if using custom uniforms (since we cannot batch) it
if(_glProgramState->getUniformCount() > 0) {
_materialID = Renderer::MATERIAL_ID_DO_NOT_BATCH;
@ -97,8 +90,7 @@ void TwoColorTrianglesCommand::generateMaterialID()
}
}
void TwoColorTrianglesCommand::useMaterial() const
{
void TwoColorTrianglesCommand::useMaterial() const {
//Set texture
GL::bindTexture2D(_textureID);
@ -213,7 +205,6 @@ SkeletonTwoColorBatch::~SkeletonTwoColorBatch () {
}
void SkeletonTwoColorBatch::update (float delta) {
printf("Num batches: %i\n", _numBatches);
reset();
}