mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-12 01:58:45 +08:00
[c] Fixed resizing of world vertices array for open paths in PathConstraint.c
This commit is contained in:
parent
3bbba1bd72
commit
f4f4c3ee91
@ -309,6 +309,7 @@ float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAtta
|
||||
self->world = MALLOC(float, verticesLength);
|
||||
self->worldCount = verticesLength;
|
||||
}
|
||||
world = self->world;
|
||||
spPathAttachment_computeWorldVertices1(path, target, 2, verticesLength, world, 0);
|
||||
}
|
||||
|
||||
|
||||
13
spine-sfml/data/vine.atlas
Normal file
13
spine-sfml/data/vine.atlas
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
vine.png
|
||||
size: 128,1024
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
images/vine
|
||||
rotate: false
|
||||
xy: 2, 2
|
||||
size: 68, 962
|
||||
orig: 68, 962
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
300
spine-sfml/data/vine.json
Normal file
300
spine-sfml/data/vine.json
Normal file
File diff suppressed because one or more lines are too long
BIN
spine-sfml/data/vine.png
Normal file
BIN
spine-sfml/data/vine.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
@ -271,6 +271,50 @@ void tank () {
|
||||
Atlas_dispose(atlas);
|
||||
}
|
||||
|
||||
void vine () {
|
||||
// Load atlas, skeleton, and animations.
|
||||
Atlas* atlas = Atlas_createFromFile("data/vine.atlas", 0);
|
||||
SkeletonJson* json = SkeletonJson_create(atlas);
|
||||
json->scale = 0.5f;
|
||||
SkeletonData *skeletonData = SkeletonJson_readSkeletonDataFile(json, "data/vine.json");
|
||||
if (!skeletonData) {
|
||||
printf("Error: %s\n", json->error);
|
||||
exit(0);
|
||||
}
|
||||
SkeletonJson_dispose(json);
|
||||
|
||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
||||
drawable->timeScale = 1;
|
||||
|
||||
Skeleton* skeleton = drawable->skeleton;
|
||||
skeleton->x = 320;
|
||||
skeleton->y = 590;
|
||||
Skeleton_updateWorldTransform(skeleton);
|
||||
|
||||
AnimationState_setAnimationByName(drawable->state, 0, "animation", true);
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - vine");
|
||||
window.setFramerateLimit(60);
|
||||
sf::Event event;
|
||||
sf::Clock deltaClock;
|
||||
while (window.isOpen()) {
|
||||
while (window.pollEvent(event))
|
||||
if (event.type == sf::Event::Closed) window.close();
|
||||
|
||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
||||
deltaClock.restart();
|
||||
|
||||
drawable->update(delta);
|
||||
|
||||
window.clear();
|
||||
window.draw(*drawable);
|
||||
window.display();
|
||||
}
|
||||
|
||||
SkeletonData_dispose(skeletonData);
|
||||
Atlas_dispose(atlas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for debugging purposes during runtime development
|
||||
*/
|
||||
@ -313,6 +357,7 @@ void test () {
|
||||
|
||||
int main () {
|
||||
test();
|
||||
vine();
|
||||
tank();
|
||||
raptor();
|
||||
spineboy();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user