Skip to content

Commit

Permalink
[cpp][glfw] Fix reading bounding box attachments in SkeletonBinary, c…
Browse files Browse the repository at this point in the history
…loses #2668, add binary Spineboy to example
  • Loading branch information
badlogic committed Nov 5, 2024
1 parent 28fb83d commit 9207cd2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions examples/export/runtimes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ cp -f ../spineboy/export/spineboy-pro.json "$ROOT/spine-sdl/data/"
cp -f ../spineboy/export/spineboy-pma.atlas "$ROOT/spine-sdl/data/"
cp -f ../spineboy/export/spineboy-pma.png "$ROOT/spine-sdl/data/"

echo "spine-glfw"
rm -f "$ROOT/spine-glfw/data/"*
cp -f ../spineboy/export/spineboy-pro.json "$ROOT/spine-glfw/data/"
cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-glfw/data/"
cp -f ../spineboy/export/spineboy-pma.atlas "$ROOT/spine-glfw/data/"
cp -f ../spineboy/export/spineboy-pma.png "$ROOT/spine-glfw/data/"

echo "spine-sfml-c"
rm "$ROOT/spine-sfml/c/data/"*
cp -f ../coin/export/coin-pro.json "$ROOT/spine-sfml/c/data/"
Expand Down
4 changes: 2 additions & 2 deletions spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo
setError("Error reading attachment: ", name.buffer());
return NULL;
}
readVertices(input, box->getVertices(), box->getBones(), (flags & 16) != 0);
box->setWorldVerticesLength(box->getVertices().size());
int verticesLength = readVertices(input, box->getVertices(), box->getBones(), (flags & 16) != 0);
box->setWorldVerticesLength(verticesLength);
if (nonessential) {
readColor(input, box->getColor());
}
Expand Down
Binary file added spine-glfw/data/spineboy-pro.skel
Binary file not shown.
2 changes: 1 addition & 1 deletion spine-glfw/example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int main() {
GlTextureLoader textureLoader;
Atlas *atlas = new Atlas("data/spineboy-pma.atlas", &textureLoader);
SkeletonJson json(atlas);
SkeletonData *skeletonData = json.readSkeletonDataFile("data/spineboy-pro.json");
SkeletonData *skeletonData = json.readSkeletonDataFile("data/spineboy-pro.skel");

// Create a skeleton from the data, set the skeleton's position to the bottom center of
// the screen and scale it to make it smaller.
Expand Down

0 comments on commit 9207cd2

Please sign in to comment.