Warning clean up.

This commit is contained in:
NathanSweet 2014-05-17 17:25:46 +02:00
parent 1d85ad6bd6
commit 8cdb2062c7
6 changed files with 16 additions and 17 deletions

View File

@ -218,7 +218,6 @@ void SkeletonRenderer::draw () {
ccDrawColor4B(0, 0, 255, 255); ccDrawColor4B(0, 0, 255, 255);
glLineWidth(1); glLineWidth(1);
CCPoint points[4]; CCPoint points[4];
ccV3F_C4B_T2F_Quad quad;
for (int i = 0, n = skeleton->slotCount; i < n; i++) { for (int i = 0, n = skeleton->slotCount; i < n; i++) {
spSlot* slot = skeleton->drawOrder[i]; spSlot* slot = skeleton->drawOrder[i];
if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue; if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue;

View File

@ -52,7 +52,7 @@ bool GoblinsExample::init () {
skeletonNode->setSkin("goblin"); skeletonNode->setSkin("goblin");
Size windowSize = Director::getInstance()->getWinSize(); Size windowSize = Director::getInstance()->getWinSize();
skeletonNode->setPosition(ccp(windowSize.width / 2, 20)); skeletonNode->setPosition(Point(windowSize.width / 2, 20));
addChild(skeletonNode); addChild(skeletonNode);
scheduleUpdate(); scheduleUpdate();

View File

@ -224,10 +224,10 @@ void SkeletonRenderer::drawSkeleton (const kmMat4& transform, bool transformUpda
kmGLLoadMatrix(&transform); kmGLLoadMatrix(&transform);
if (debugSlots) { if (debugSlots) {
// Slots. // Slots.
ccDrawColor4B(0, 0, 255, 255); DrawPrimitives::setDrawColor4B(0, 0, 255, 255);
glLineWidth(1); glLineWidth(1);
CCPoint points[4]; Point points[4];
ccV3F_C4B_T2F_Quad quad; V3F_C4B_T2F_Quad quad;
for (int i = 0, n = skeleton->slotCount; i < n; i++) { for (int i = 0, n = skeleton->slotCount; i < n; i++) {
spSlot* slot = skeleton->drawOrder[i]; spSlot* slot = skeleton->drawOrder[i];
if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue; if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue;
@ -237,26 +237,26 @@ void SkeletonRenderer::drawSkeleton (const kmMat4& transform, bool transformUpda
points[1] = Point(worldVertices[2], worldVertices[3]); points[1] = Point(worldVertices[2], worldVertices[3]);
points[2] = Point(worldVertices[4], worldVertices[5]); points[2] = Point(worldVertices[4], worldVertices[5]);
points[3] = Point(worldVertices[6], worldVertices[7]); points[3] = Point(worldVertices[6], worldVertices[7]);
ccDrawPoly(points, 4, true); DrawPrimitives::drawPoly(points, 4, true);
} }
} }
if (debugBones) { if (debugBones) {
// Bone lengths. // Bone lengths.
glLineWidth(2); glLineWidth(2);
ccDrawColor4B(255, 0, 0, 255); DrawPrimitives::setDrawColor4B(255, 0, 0, 255);
for (int i = 0, n = skeleton->boneCount; i < n; i++) { for (int i = 0, n = skeleton->boneCount; i < n; i++) {
spBone *bone = skeleton->bones[i]; spBone *bone = skeleton->bones[i];
float x = bone->data->length * bone->m00 + bone->worldX; float x = bone->data->length * bone->m00 + bone->worldX;
float y = bone->data->length * bone->m10 + bone->worldY; float y = bone->data->length * bone->m10 + bone->worldY;
ccDrawLine(Point(bone->worldX, bone->worldY), Point(x, y)); DrawPrimitives::drawLine(Point(bone->worldX, bone->worldY), Point(x, y));
} }
// Bone origins. // Bone origins.
ccPointSize(4); DrawPrimitives::setPointSize(4);
ccDrawColor4B(0, 0, 255, 255); // Root bone is blue. DrawPrimitives::setDrawColor4B(0, 0, 255, 255); // Root bone is blue.
for (int i = 0, n = skeleton->boneCount; i < n; i++) { for (int i = 0, n = skeleton->boneCount; i < n; i++) {
spBone *bone = skeleton->bones[i]; spBone *bone = skeleton->bones[i];
ccDrawPoint(Point(bone->worldX, bone->worldY)); DrawPrimitives::drawPoint(Point(bone->worldX, bone->worldY));
if (i == 0) ccDrawColor4B(0, 255, 0, 255); if (i == 0) DrawPrimitives::setDrawColor4B(0, 255, 0, 255);
} }
} }
kmGLPopMatrix(); kmGLPopMatrix();

View File

@ -39,7 +39,7 @@ namespace spine {
class PolygonBatch; class PolygonBatch;
/** Draws a skeleton. */ /** Draws a skeleton. */
class SkeletonRenderer: public cocos2d::NodeRGBA, public cocos2d::BlendProtocol { class SkeletonRenderer: public cocos2d::Node, public cocos2d::BlendProtocol {
public: public:
spSkeleton* skeleton; spSkeleton* skeleton;
spBone* rootBone; spBone* rootBone;

View File

@ -74,7 +74,7 @@ void SkeletonRenderer::initialize () {
blendFunc = BlendFunc::ALPHA_PREMULTIPLIED; blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
setOpacityModifyRGB(true); setOpacityModifyRGB(true);
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR)); setGLProgram(ShaderCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
scheduleUpdate(); scheduleUpdate();
} }
@ -139,8 +139,8 @@ void SkeletonRenderer::draw (Renderer* renderer, const Matrix& transform, bool t
} }
void SkeletonRenderer::drawSkeleton (const Matrix &transform, bool transformUpdated) { void SkeletonRenderer::drawSkeleton (const Matrix &transform, bool transformUpdated) {
getShaderProgram()->use(); getGLProgram()->use();
getShaderProgram()->setUniformsForBuiltins(transform); getGLProgram()->setUniformsForBuiltins(transform);
Color3B nodeColor = getColor(); Color3B nodeColor = getColor();
skeleton->r = nodeColor.r / (float)255; skeleton->r = nodeColor.r / (float)255;

View File

@ -39,7 +39,7 @@ namespace spine {
class PolygonBatch; class PolygonBatch;
/** Draws a skeleton. */ /** Draws a skeleton. */
class SkeletonRenderer: public cocos2d::NodeRGBA, public cocos2d::BlendProtocol { class SkeletonRenderer: public cocos2d::Node, public cocos2d::BlendProtocol {
public: public:
spSkeleton* skeleton; spSkeleton* skeleton;
spBone* rootBone; spBone* rootBone;