示例#1
0
int main (void) {
	Atlas* atlas = Atlas_readAtlasFile("data/spineboy.atlas");
	printf("First region name: %s, x: %d, y: %d\n", atlas->regions->name, atlas->regions->x, atlas->regions->y);
	printf("First page name: %s, size: %d, %d\n", atlas->pages->name, atlas->pages->width, atlas->pages->height);

	SkeletonJson* json = SkeletonJson_create(atlas);
	SkeletonData *skeletonData = SkeletonJson_readSkeletonDataFile(json, "data/spineboy.json");
	if (!skeletonData) {
		printf("Error: %s\n", json->error);
		exit(0);
	}
	printf("Default skin name: %s\n", skeletonData->defaultSkin->name);

	Skeleton* skeleton = Skeleton_create(skeletonData);

	Animation* animation = SkeletonData_findAnimation(skeletonData, "walk");
	if (!animation) {
		printf("Error: Animation not found: walk\n");
		exit(0);
	}
	printf("Animation timelineCount: %d\n", animation->timelineCount);

	Skeleton_dispose(skeleton);
	SkeletonData_dispose(skeletonData);
	SkeletonJson_dispose(json);
	Atlas_dispose(atlas);

	return 0;
}
示例#2
0
SkeletonDrawable::SkeletonDrawable (SkeletonData* skeletonData, AnimationStateData* stateData) :
				timeScale(1),
				vertexArray(new VertexArray(Quads, skeletonData->boneCount * 4)) {
	Bone_setYDown(true);

	skeleton = Skeleton_create(skeletonData);
	state = AnimationState_create(stateData);
}
示例#3
0
SkeletonDrawable::SkeletonDrawable (SkeletonData* skeletonData, AnimationStateData* stateData) :
				timeScale(1),
				vertexArray(skeletonData->boneCount * 4),
				indices(skeletonData->boneCount * 6),
				lastUpdate(-1)
{
	Bone_setYDown(true);

	skeleton = Skeleton_create(skeletonData);
	state = AnimationState_create(stateData);
}
示例#4
0
void ofxSkeleton::setup(string atlasPath, string jsonPath){
    
	Bone_setYDown(true);
    
	atlas = Atlas_readAtlasFile(atlasPath.c_str());
    
	SkeletonJson * json = SkeletonJson_create(atlas);
	skeletonData = SkeletonJson_readSkeletonDataFile(json, jsonPath.c_str());
	SkeletonJson_dispose(json);
    
	skeleton = Skeleton_create(skeletonData);
	skeleton->flipX = false;
	skeleton->flipY = false;
	Skeleton_setToSetupPose(skeleton);
    
	stateData = AnimationStateData_create(skeletonData);
    
	state = AnimationState_create(stateData);
}
示例#5
0
int main (void) {
	Atlas* atlas = Atlas_readAtlasFile("data/spineboy.atlas");
	printf("First region name: %s, x: %d, y: %d\n", atlas->regions->name, atlas->regions->x, atlas->regions->y);
	printf("First page name: %s, extraData: %d\n", atlas->pages->name, ((ExampleAtlasPage*)atlas->pages)->extraData);

	SkeletonJson* json = SkeletonJson_create(atlas);
	SkeletonData *skeletonData = SkeletonJson_readSkeletonDataFile(json, "data/spineboy-skeleton.json");
	if (!skeletonData) printf("Error: %s\n", json->error);
	printf("Attachment extraData: %d\n", ((ExampleRegionAttachment*)skeletonData->defaultSkin->entries->attachment)->extraData);

	Skeleton* skeleton = Skeleton_create(skeletonData);
	printf("Skeleton extraData: %d\n", ((ExampleSkeleton*)skeleton)->extraData);

	Animation* animation = SkeletonJson_readAnimationFile(json, "data/spineboy-walk.json", skeletonData);
	if (!animation) printf("Error: %s\n", json->error);
	printf("Animation timelineCount: %d\n", animation->timelineCount);

	Skeleton_dispose(skeleton);
	SkeletonData_dispose(skeletonData);
	SkeletonJson_dispose(json);
	Atlas_dispose(atlas);

	return 0;
}
示例#6
0
void CCSkeleton::setSkeletonData (SkeletonData *skeletonData, bool ownsSkeletonData) {
	skeleton = Skeleton_create(skeletonData);
	rootBone = skeleton->bones[0];
	this->ownsSkeletonData = ownsSkeletonData;	
}