首页 > 代码库 > cocos2dx3.2 spine动画

cocos2dx3.2 spine动画


        NEWSkeletonAnimation* skeletonNode;
skeletonNode = NEWSkeletonAnimation::createWithFile("Maid.json", "Maid.atlas", 0.6f);

	skeletonNode->startListener = [this] (int trackIndex) {
		spTrackEntry* entry = spAnimationState_getCurrent(skeletonNode->state, trackIndex);
		const char* animationName = (entry && entry->animation) ? entry->animation->name : 0;
		log("%d start: %s", trackIndex, animationName);
	};
	skeletonNode->endListener = [=] (int trackIndex) {
		log("%d end", trackIndex);
		m_isSkeletonSiwtch = false;
	};
	skeletonNode->completeListener = [] (int trackIndex, int loopCount) {
		log("%d complete: %d", trackIndex, loopCount);
	};
	skeletonNode->eventListener = [] (int trackIndex, spEvent* event) {
		log("%d event: %s, %d, %f, %s", trackIndex, event->data->name, event->intValue, event->floatValue, event->stringValue);
	};

	skeletonNode->setPosition(100, 100);
	this->addChild(skeletonNode);
	//skeletonNode->setAnimation(0, "Event", false);








cocos2dx3.2 spine动画