[libgdx] Add dragon sequence smoke test.

see #2989
This commit is contained in:
Nathan Sweet 2026-03-03 13:40:19 -04:00
parent 1dac7ed019
commit 8943ac56e0
9 changed files with 221 additions and 0 deletions

View File

@ -36,6 +36,12 @@ cp -f ../spineboy/export/*.json "$ROOT/spine-libgdx/spine-libgdx-tests/assets/sp
cp -r ../spineboy/export/*.skel "$ROOT/spine-libgdx/spine-libgdx-tests/assets/spineboy/"
cp -r ../spineboy/export/*-pma.* "$ROOT/spine-libgdx/spine-libgdx-tests/assets/spineboy/"
rm -f "$ROOT/spine-libgdx/spine-libgdx-tests/assets/dragon/"*
mkdir -p "$ROOT/spine-libgdx/spine-libgdx-tests/assets/dragon/"
cp -f ../dragon/export/*.skel "$ROOT/spine-libgdx/spine-libgdx-tests/assets/dragon/"
cp -f ../dragon/export/dragon-pma.atlas "$ROOT/spine-libgdx/spine-libgdx-tests/assets/dragon/"
cp -f ../dragon/export/dragon-pma*.png "$ROOT/spine-libgdx/spine-libgdx-tests/assets/dragon/"
rm -f "$ROOT/spine-libgdx/spine-libgdx-tests/assets/coin/"*
cp -f ../coin/export/*.json "$ROOT/spine-libgdx/spine-libgdx-tests/assets/coin/"
cp -f ../coin/export/*.skel "$ROOT/spine-libgdx/spine-libgdx-tests/assets/coin/"

View File

@ -0,0 +1,114 @@
dragon-pma.png
size: 1024, 1024
filter: Linear, Linear
pma: true
front-toe-a
bounds: 300, 929, 29, 50
front-toe-b
bounds: 258, 660, 56, 57
head
bounds: 2, 719, 296, 260
left-front-leg
bounds: 99, 660, 84, 57
left-wing09
bounds: 2, 15, 264, 589
rotate: 90
right-wing07
bounds: 647, 2, 365, 643
right-wing08
bounds: 2, 281, 365, 643
rotate: 90
right-wing09
bounds: 354, 647, 365, 643
rotate: 90
tail04
bounds: 185, 661, 56, 71
rotate: 90
tail06
bounds: 2, 649, 95, 68
thiagobrayner
bounds: 2, 981, 350, 31
dragon-pma_2.png
size: 1024, 1024
filter: Linear, Linear
pma: true
back
bounds: 647, 57, 190, 185
chin
bounds: 839, 28, 214, 146
rotate: 90
left-rear-leg
bounds: 736, 244, 206, 177
left-wing08
bounds: 736, 423, 264, 589
right-rear-toe
bounds: 944, 312, 109, 77
rotate: 90
right-wing04
bounds: 2, 2, 365, 643
rotate: 90
right-wing05
bounds: 369, 369, 365, 643
right-wing06
bounds: 2, 369, 365, 643
tail03
bounds: 647, 275, 73, 92
tail05
bounds: 944, 251, 52, 59
dragon-pma_3.png
size: 1024, 1024
filter: Linear, Linear
pma: true
chest
bounds: 858, 299, 136, 122
left-front-thigh
bounds: 647, 295, 84, 72
left-rear-thigh
bounds: 647, 117, 91, 149
left-wing07
bounds: 736, 423, 264, 589
right-front-leg
bounds: 647, 14, 101, 89
rotate: 90
right-front-thigh
bounds: 740, 158, 108, 108
right-rear-leg
bounds: 740, 46, 116, 100
right-rear-thigh
bounds: 858, 148, 91, 149
right-wing01
bounds: 2, 2, 365, 643
rotate: 90
right-wing02
bounds: 369, 369, 365, 643
right-wing03
bounds: 2, 369, 365, 643
tail01
bounds: 736, 268, 120, 153
tail02
bounds: 858, 26, 95, 120
dragon-pma_4.png
size: 1024, 1024
filter: Linear, Linear
pma: true
left-wing03
bounds: 2, 2, 264, 589
rotate: 90
left-wing04
bounds: 534, 268, 264, 589
left-wing05
bounds: 268, 268, 264, 589
left-wing06
bounds: 2, 268, 264, 589
dragon-pma_5.png
size: 1024, 1024
filter: Linear, Linear
pma: true
left-wing01
bounds: 268, 2, 264, 589
left-wing02
bounds: 2, 2, 264, 589

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,101 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
package com.esotericsoftware.spine;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
/** Smoke test for sequence attachments using the Dragon example. Mirrors the old runtime Sequence example setup: dragon-ess.skel
* + dragon-pma.atlas + flying animation. */
public class SequenceTest extends ApplicationAdapter {
OrthographicCamera camera;
PolygonSpriteBatch batch;
SkeletonRenderer renderer;
TextureAtlas atlas;
Skeleton skeleton;
AnimationState state;
public void create () {
camera = new OrthographicCamera();
camera.setToOrtho(false);
batch = new PolygonSpriteBatch();
renderer = new SkeletonRenderer();
renderer.setPremultipliedAlpha(true);
atlas = new TextureAtlas(Gdx.files.internal("dragon/dragon-pma.atlas"));
SkeletonBinary binary = new SkeletonBinary(atlas);
SkeletonData skeletonData = binary.readSkeletonData(Gdx.files.internal("dragon/dragon-ess.skel"));
skeleton = new Skeleton(skeletonData);
skeleton.setScale(0.6f, 0.6f);
skeleton.setPosition(Gdx.graphics.getWidth() / 2f, 120);
state = new AnimationState(new AnimationStateData(skeletonData));
state.setAnimation(0, "flying", true);
}
public void render () {
float delta = Gdx.graphics.getDeltaTime();
state.update(delta);
state.apply(skeleton);
skeleton.update(delta);
skeleton.updateWorldTransform(Physics.update);
Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
batch.getProjectionMatrix().set(camera.combined);
batch.begin();
renderer.draw(batch, skeleton);
batch.end();
}
public void resize (int width, int height) {
camera.setToOrtho(false);
skeleton.setPosition(width / 2f, 120);
}
public void dispose () {
atlas.dispose();
batch.dispose();
}
static public void main (String[] args) throws Exception {
new Lwjgl3Application(new SequenceTest());
}
}