[cpp][glfw] Fix reading bounding box attachments in SkeletonBinary, closes #2668, add binary Spineboy to example

This commit is contained in:
Mario Zechner 2024-11-05 13:48:53 +01:00
parent 28fb83d1d7
commit 9207cd2a40
4 changed files with 10 additions and 3 deletions

View File

@ -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/"

View File

@ -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());
}

Binary file not shown.

View File

@ -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.