mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[libgdx] Fixed frame-by-frame test, added PNG export to spineboy example.
This commit is contained in:
parent
d0770a99cb
commit
58ac2fa67e
@ -16,7 +16,7 @@ fi
|
|||||||
echo "Spine exe: $SPINE_EXE"
|
echo "Spine exe: $SPINE_EXE"
|
||||||
|
|
||||||
if [ "$#" -eq 0 ]; then
|
if [ "$#" -eq 0 ]; then
|
||||||
echo "Enter the Spine editor version to use for the export (eg 3.8.99):"
|
echo "Enter the Spine editor version to use for the export (eg 4.1.xx):"
|
||||||
read version
|
read version
|
||||||
else
|
else
|
||||||
version=${1%/}
|
version=${1%/}
|
||||||
@ -100,6 +100,7 @@ echo "Exporting assets..."
|
|||||||
-i ../spineboy/spineboy-ess.spine -o ../spineboy/export -e binary.json \
|
-i ../spineboy/spineboy-ess.spine -o ../spineboy/export -e binary.json \
|
||||||
-i ../spineboy/spineboy-pro.spine -o ../spineboy/export -e json.json \
|
-i ../spineboy/spineboy-pro.spine -o ../spineboy/export -e json.json \
|
||||||
-i ../spineboy/spineboy-pro.spine -o ../spineboy/export -e binary.json \
|
-i ../spineboy/spineboy-pro.spine -o ../spineboy/export -e binary.json \
|
||||||
|
-i ../spineboy/spineboy-pro.spine -o ../spineboy/export/spineboy-run.atlas -e png-0.5-frame-by-frame.json \
|
||||||
-i ../spineboy/images -o ../spineboy/export -n spineboy -p atlas-0.5.json \
|
-i ../spineboy/images -o ../spineboy/export -n spineboy -p atlas-0.5.json \
|
||||||
-i ../spineboy/images -o ../spineboy/export -n spineboy-pma -p atlas-0.5-pma.json \
|
-i ../spineboy/images -o ../spineboy/export -n spineboy-pma -p atlas-0.5-pma.json \
|
||||||
\
|
\
|
||||||
|
|||||||
87
examples/export/png-0.5-frame-by-frame.json
Normal file
87
examples/export/png-0.5-frame-by-frame.json
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"class": "export-png",
|
||||||
|
"exportType": "animation",
|
||||||
|
"skeletonType": "single",
|
||||||
|
"skeleton": "spineboy-pro",
|
||||||
|
"animationType": "single",
|
||||||
|
"animation": "run",
|
||||||
|
"skinType": "current",
|
||||||
|
"skinNone": false,
|
||||||
|
"skin": null,
|
||||||
|
"maxBounds": false,
|
||||||
|
"renderImages": true,
|
||||||
|
"renderBones": false,
|
||||||
|
"renderOthers": false,
|
||||||
|
"scale": 50,
|
||||||
|
"fitWidth": 0,
|
||||||
|
"fitHeight": 0,
|
||||||
|
"enlarge": false,
|
||||||
|
"background": null,
|
||||||
|
"fps": 15,
|
||||||
|
"lastFrame": false,
|
||||||
|
"cropWidth": 0,
|
||||||
|
"cropHeight": 0,
|
||||||
|
"rangeStart": -1,
|
||||||
|
"rangeEnd": -1,
|
||||||
|
"packAtlas": {
|
||||||
|
"stripWhitespaceX": true,
|
||||||
|
"stripWhitespaceY": true,
|
||||||
|
"rotation": true,
|
||||||
|
"alias": true,
|
||||||
|
"ignoreBlankImages": false,
|
||||||
|
"alphaThreshold": 3,
|
||||||
|
"minWidth": 16,
|
||||||
|
"minHeight": 16,
|
||||||
|
"maxWidth": 2048,
|
||||||
|
"maxHeight": 2048,
|
||||||
|
"pot": false,
|
||||||
|
"multipleOfFour": false,
|
||||||
|
"square": false,
|
||||||
|
"outputFormat": "png",
|
||||||
|
"jpegQuality": 0.9,
|
||||||
|
"premultiplyAlpha": true,
|
||||||
|
"bleed": false,
|
||||||
|
"scale": [ 1 ],
|
||||||
|
"scaleSuffix": [ "" ],
|
||||||
|
"scaleResampling": [ "bicubic" ],
|
||||||
|
"paddingX": 2,
|
||||||
|
"paddingY": 2,
|
||||||
|
"edgePadding": true,
|
||||||
|
"duplicatePadding": false,
|
||||||
|
"filterMin": "Linear",
|
||||||
|
"filterMag": "Linear",
|
||||||
|
"wrapX": "ClampToEdge",
|
||||||
|
"wrapY": "ClampToEdge",
|
||||||
|
"format": "RGBA8888",
|
||||||
|
"atlasExtension": ".atlas",
|
||||||
|
"combineSubdirectories": false,
|
||||||
|
"flattenPaths": false,
|
||||||
|
"useIndexes": true,
|
||||||
|
"debug": false,
|
||||||
|
"fast": false,
|
||||||
|
"limitMemory": true,
|
||||||
|
"currentProject": true,
|
||||||
|
"packing": "rectangles",
|
||||||
|
"prettyPrint": true,
|
||||||
|
"legacyOutput": false,
|
||||||
|
"webp": null,
|
||||||
|
"bleedIterations": 2,
|
||||||
|
"ignore": false,
|
||||||
|
"separator": "_",
|
||||||
|
"silent": false
|
||||||
|
},
|
||||||
|
"compression": 9,
|
||||||
|
"bruteForce": true,
|
||||||
|
"quantize": true,
|
||||||
|
"quality": 100,
|
||||||
|
"speed": 1,
|
||||||
|
"dither": 0,
|
||||||
|
"maxColors": 256,
|
||||||
|
"pad": false,
|
||||||
|
"msaa": 4,
|
||||||
|
"smoothing": 8,
|
||||||
|
"renderSelection": false,
|
||||||
|
"cropX": 0,
|
||||||
|
"cropY": 0,
|
||||||
|
"open": false
|
||||||
|
}
|
||||||
60
examples/spineboy/export/spineboy-run.atlas
Normal file
60
examples/spineboy/export/spineboy-run.atlas
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
spineboy-run.png
|
||||||
|
size: 1181, 687
|
||||||
|
filter: Linear, Linear
|
||||||
|
pma: true
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 8
|
||||||
|
bounds: 2, 371, 303, 314
|
||||||
|
offsets: 11, 22, 316, 341
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 9
|
||||||
|
bounds: 2, 44, 278, 325
|
||||||
|
offsets: 30, 2, 316, 341
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 0
|
||||||
|
bounds: 307, 439, 246, 320
|
||||||
|
offsets: 67, 1, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 3
|
||||||
|
bounds: 629, 443, 242, 320
|
||||||
|
offsets: 12, 20, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 7
|
||||||
|
bounds: 951, 389, 228, 296
|
||||||
|
offsets: 36, 33, 316, 341
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 4
|
||||||
|
bounds: 307, 195, 242, 320
|
||||||
|
offsets: 2, 4, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 5
|
||||||
|
bounds: 629, 200, 241, 316
|
||||||
|
offsets: 8, 3, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 1
|
||||||
|
bounds: 282, 2, 191, 318
|
||||||
|
offsets: 70, 3, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 2
|
||||||
|
bounds: 947, 81, 226, 306
|
||||||
|
offsets: 34, 26, 316, 341
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 6
|
||||||
|
bounds: 629, 4, 194, 316
|
||||||
|
offsets: 68, 4, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
BIN
examples/spineboy/export/spineboy-run.png
Normal file
BIN
examples/spineboy/export/spineboy-run.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 336 KiB |
@ -0,0 +1,60 @@
|
|||||||
|
spineboy-run.png
|
||||||
|
size: 1181, 687
|
||||||
|
filter: Linear, Linear
|
||||||
|
pma: true
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 8
|
||||||
|
bounds: 2, 371, 303, 314
|
||||||
|
offsets: 11, 22, 316, 341
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 9
|
||||||
|
bounds: 2, 44, 278, 325
|
||||||
|
offsets: 30, 2, 316, 341
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 0
|
||||||
|
bounds: 307, 439, 246, 320
|
||||||
|
offsets: 67, 1, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 3
|
||||||
|
bounds: 629, 443, 242, 320
|
||||||
|
offsets: 12, 20, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 7
|
||||||
|
bounds: 951, 389, 228, 296
|
||||||
|
offsets: 36, 33, 316, 341
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 4
|
||||||
|
bounds: 307, 195, 242, 320
|
||||||
|
offsets: 2, 4, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 5
|
||||||
|
bounds: 629, 200, 241, 316
|
||||||
|
offsets: 8, 3, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 1
|
||||||
|
bounds: 282, 2, 191, 318
|
||||||
|
offsets: 70, 3, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 2
|
||||||
|
bounds: 947, 81, 226, 306
|
||||||
|
offsets: 34, 26, 316, 341
|
||||||
|
origin: 142, 3
|
||||||
|
spineboy-pro-run
|
||||||
|
index: 6
|
||||||
|
bounds: 629, 4, 194, 316
|
||||||
|
offsets: 68, 4, 316, 341
|
||||||
|
rotate: 90
|
||||||
|
origin: 142, 3
|
||||||
BIN
spine-libgdx/spine-libgdx-tests/assets/spineboy/spineboy-run.png
Normal file
BIN
spine-libgdx/spine-libgdx-tests/assets/spineboy/spineboy-run.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 336 KiB |
@ -46,32 +46,22 @@ public class FrameByFrameTest extends ApplicationAdapter {
|
|||||||
|
|
||||||
TextureAtlas atlas;
|
TextureAtlas atlas;
|
||||||
float time;
|
float time;
|
||||||
Animation<AtlasSprite> walkAnimation, deathAnimation, current;
|
Animation<AtlasSprite> walkAnimation, current;
|
||||||
|
|
||||||
public void create () {
|
public void create () {
|
||||||
camera = new OrthographicCamera();
|
camera = new OrthographicCamera();
|
||||||
batch = new PolygonSpriteBatch();
|
batch = new PolygonSpriteBatch();
|
||||||
|
|
||||||
atlas = new TextureAtlas("spineboy/frame-by-frame.atlas");
|
atlas = new TextureAtlas("spineboy/spineboy-run.atlas");
|
||||||
|
|
||||||
walkAnimation = new Animation(1 / 20f, atlas.createSprites("spineboy-pro-walk"));
|
walkAnimation = new Animation(1 / 15f, atlas.createSprites("spineboy-pro-run"));
|
||||||
walkAnimation.setPlayMode(PlayMode.LOOP);
|
walkAnimation.setPlayMode(PlayMode.LOOP);
|
||||||
|
|
||||||
deathAnimation = new Animation(1 / 20f, atlas.createSprites("spineboy-pro-death"));
|
|
||||||
|
|
||||||
current = walkAnimation;
|
current = walkAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render () {
|
public void render () {
|
||||||
time += Gdx.graphics.getDeltaTime();
|
time += Gdx.graphics.getDeltaTime();
|
||||||
if (current == deathAnimation && current.isAnimationFinished(time)) {
|
|
||||||
current = walkAnimation;
|
|
||||||
time = 0;
|
|
||||||
}
|
|
||||||
if (Gdx.input.justTouched()) {
|
|
||||||
current = deathAnimation;
|
|
||||||
time = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
AtlasSprite frame = current.getKeyFrame(time);
|
AtlasSprite frame = current.getKeyFrame(time);
|
||||||
float x = Math.round(Gdx.graphics.getWidth() / 2), y = 25;
|
float x = Math.round(Gdx.graphics.getWidth() / 2), y = 25;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user