当前位置: 首页>>代码示例>>C++>>正文


C++ CCSkeleton类代码示例

本文整理汇总了C++中CCSkeleton的典型用法代码示例。如果您正苦于以下问题:C++ CCSkeleton类的具体用法?C++ CCSkeleton怎么用?C++ CCSkeleton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CCSkeleton类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Atlas

bool ExampleLayer::init () {
	if (!CCLayer::init()) return false;

	atlas = new Atlas("spineboy.txt");
	SkeletonJson json(atlas);
	json.scale = 0.5;
	skeletonData = json.readSkeletonData("spineboy-skeleton.json");
	animation = json.readAnimation("spineboy-walk.json", skeletonData);

	CCSkeleton* skeletonNode = CCSkeleton::create(skeletonData);
	skeletonNode->state->setAnimation(animation, true);
	skeletonNode->debug = true;

	CCSize windowSize = CCDirector::sharedDirector()->getWinSize();
	skeletonNode->setPosition(ccp(windowSize.width / 2, 20));
	addChild(skeletonNode);

	return true;
}
开发者ID:r-lyeh-forks,项目名称:spine-runtimes,代码行数:19,代码来源:ExampleLayer.cpp

示例2: CCSkeleton

CCSkeleton* CCSkeleton::createWithFile (const char* skeletonDataFile, const char* atlasFile, float scale) {
	CCSkeleton* node = new CCSkeleton(skeletonDataFile, atlasFile, scale);
	node->autorelease();
	return node;
}
开发者ID:stnguyen,项目名称:spine-runtimes,代码行数:5,代码来源:CCSkeleton.cpp

示例3: CCARRAY_FOREACH

void CCSpineDebugDrawNode::draw()
{
  CCObject* obj;
  
  CCARRAY_FOREACH(mSkeletons, obj)
  {
    CCSkeleton* skeletonNode = (CCSkeleton*) obj;
    const CCPoint skeletonPosition = skeletonNode->getPosition();
    
    // Slots
    if (getIsDrawingSlotBoundingBoxes())
    {
      const std::vector<Slot*>& slots = skeletonNode->skeleton->slots;
      ccV3F_C4B_T2F_Quad quad;
      
      // Green color for slot attachment bounding box
      ccDrawColor4B(0, 0, 255, 10);
      glLineWidth(1);
      
      for (int i = 0; i < slots.size(); i++)
      {
        if (slots[i]->attachment == NULL) continue;
        
        quad = ((RegionAttachment*) slots[i]->attachment)->quad;
        
        CCPoint points[4];
        points[0] = ccpAdd(ccp(quad.bl.vertices.x, quad.bl.vertices.y), skeletonPosition);
        points[1] = ccpAdd(ccp(quad.br.vertices.x, quad.bl.vertices.y), skeletonPosition);
        points[2] = ccpAdd(ccp(quad.tr.vertices.x, quad.tr.vertices.y), skeletonPosition);
        points[3] = ccpAdd(ccp(quad.tl.vertices.x, quad.tl.vertices.y), skeletonPosition);
        
        ccDrawPoly(points, 4, true);
      }
    }
    
    // Bones
    if (getIsDrawingBones())
    {
      const std::vector<Bone*>& bones = skeletonNode->skeleton->bones;
      Bone* bone = NULL;
      
      // Green color for bones
      glLineWidth(3);
      ccDrawColor4B(0, 255, 0, 255);
      
      // Bone line
      for (int i = 0; i < bones.size(); i++)
      {
        bone = bones[i];
        float x = bone->data->length * bone->m00 + bone->worldX;
        float y = bone->data->length * bone->m10 + bone->worldY;
        ccDrawLine(ccpAdd(ccp(bone->worldX, bone->worldY), skeletonPosition),
                   ccpAdd(ccp(x, y), skeletonPosition));
      }
      
      // Bone head
      ccPointSize(5);
      // Root bone head is assigned blue color
      ccDrawColor4B(0, 0, 255, 255);
      for (int i = 0; i < bones.size(); i++)
      {
        bone = bones[i];
        ccDrawPoint(ccpAdd(ccp(bone->worldX, bone->worldY), skeletonPosition));
        
        // Restore green color for other bone heads
        if (i == 0)
          ccDrawColor4B(0, 255, 0, 255);
      }
    }
  }
开发者ID:nhanv,项目名称:spine-cocos2dx-debugdraw,代码行数:70,代码来源:CCSpineDebugDrawNode.cpp

示例4: CCSkeleton

CCSkeleton* CCSkeleton::create (SkeletonData* skeletonData) {
	CCSkeleton* node = new CCSkeleton(skeletonData);
	node->autorelease();
	return node;
}
开发者ID:Creativegame,项目名称:spine-runtimes,代码行数:5,代码来源:spine-cocos2dx.cpp

示例5: CCSkeleton

CCSkeleton* CCSkeleton::create (SkeletonData* skeletonData, AnimationStateData* stateData) {
	CCSkeleton* node = new CCSkeleton(skeletonData, stateData);
	node->autorelease();
	return node;
}
开发者ID:CocoaLab,项目名称:spine-runtimes,代码行数:5,代码来源:spine-cocos2dx.cpp


注:本文中的CCSkeleton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。