mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
Merge branch '3.9-beta' of https://github.com/esotericsoftware/spine-runtimes into 3.9-beta
This commit is contained in:
commit
df6b4004f4
@ -34,12 +34,12 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
|
||||
public class SimpleTest1 extends ApplicationAdapter {
|
||||
OrthographicCamera camera;
|
||||
SpriteBatch batch;
|
||||
PolygonSpriteBatch batch;
|
||||
SkeletonRenderer renderer;
|
||||
SkeletonRendererDebug debugRenderer;
|
||||
|
||||
@ -49,7 +49,7 @@ public class SimpleTest1 extends ApplicationAdapter {
|
||||
|
||||
public void create () {
|
||||
camera = new OrthographicCamera();
|
||||
batch = new SpriteBatch();
|
||||
batch = new PolygonSpriteBatch();
|
||||
renderer = new SkeletonRenderer();
|
||||
renderer.setPremultipliedAlpha(true); // PMA results in correct blending without outlines.
|
||||
debugRenderer = new SkeletonRendererDebug();
|
||||
@ -57,9 +57,15 @@ public class SimpleTest1 extends ApplicationAdapter {
|
||||
debugRenderer.setRegionAttachments(false);
|
||||
|
||||
atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy-pma.atlas"));
|
||||
SkeletonBinary json = new SkeletonBinary(atlas); // This loads skeleton JSON data, which is stateless.
|
||||
json.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine.
|
||||
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy-pro.skel"));
|
||||
|
||||
SkeletonJson loader = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||
loader.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine.
|
||||
SkeletonData skeletonData = loader.readSkeletonData(Gdx.files.internal("spineboy/spineboy-pro.json"));
|
||||
|
||||
// Binary would be loaded similarly:
|
||||
// SkeletonBinary loader = new SkeletonBinary(atlas);
|
||||
// loader.setScale(0.6f);
|
||||
// SkeletonData skeletonData = loader.readSkeletonData(Gdx.files.internal("spineboy/spineboy-pro.skel"));
|
||||
|
||||
skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
||||
skeleton.setPosition(250, 20);
|
||||
|
||||
@ -63,9 +63,15 @@ public class SimpleTest2 extends ApplicationAdapter {
|
||||
debugRenderer = new SkeletonRendererDebug();
|
||||
|
||||
atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy-pma.atlas"));
|
||||
SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||
json.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine.
|
||||
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy-ess.json"));
|
||||
|
||||
SkeletonJson loader = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||
loader.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine.
|
||||
SkeletonData skeletonData = loader.readSkeletonData(Gdx.files.internal("spineboy/spineboy-ess.json"));
|
||||
|
||||
// Binary would be loaded similarly:
|
||||
// SkeletonBinary loader = new SkeletonBinary(atlas);
|
||||
// loader.setScale(0.6f);
|
||||
// SkeletonData skeletonData = loader.readSkeletonData(Gdx.files.internal("spineboy/spineboy-ess.skel"));
|
||||
|
||||
skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
||||
skeleton.setPosition(250, 20);
|
||||
|
||||
@ -58,9 +58,15 @@ public class SimpleTest3 extends ApplicationAdapter {
|
||||
debugRenderer.setMeshHull(false);
|
||||
|
||||
atlas = new TextureAtlas(Gdx.files.internal("raptor/raptor-pma.atlas"));
|
||||
SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||
json.setScale(0.5f); // Load the skeleton at 50% the size it was in Spine.
|
||||
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("raptor/raptor-pro.json"));
|
||||
|
||||
SkeletonJson loader = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||
loader.setScale(0.5f); // Load the skeleton at 50% the size it was in Spine.
|
||||
SkeletonData skeletonData = loader.readSkeletonData(Gdx.files.internal("raptor/raptor-pro.json"));
|
||||
|
||||
// Binary would be loaded similarly:
|
||||
// SkeletonBinary loader = new SkeletonBinary(atlas);
|
||||
// loader.setScale(0.5f);
|
||||
// SkeletonData skeletonData = loader.readSkeletonData(Gdx.files.internal("raptor/raptor-pro.skel"));
|
||||
|
||||
skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
||||
skeleton.setPosition(250, 20);
|
||||
@ -71,7 +77,7 @@ public class SimpleTest3 extends ApplicationAdapter {
|
||||
state.setTimeScale(0.6f); // Slow all animations down to 60% speed.
|
||||
|
||||
// Queue animations on tracks 0 and 1.
|
||||
state.setAnimation(0, "walk", true);
|
||||
state.setAnimation(0, "walk", true);
|
||||
state.addAnimation(1, "gun-grab", false, 2); // Keys in higher tracks override the pose from lower tracks.
|
||||
}
|
||||
|
||||
|
||||
@ -57,25 +57,23 @@ public class SimpleTest4 extends ApplicationAdapter {
|
||||
debugRenderer.setRegionAttachments(false);
|
||||
|
||||
atlas = new TextureAtlas(Gdx.files.internal("goblins/goblins-pma.atlas"));
|
||||
SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||
json.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine.
|
||||
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("goblins/goblins-pro.json"));
|
||||
|
||||
SkeletonJson loader = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||
loader.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine.
|
||||
SkeletonData skeletonData = loader.readSkeletonData(Gdx.files.internal("goblins/goblins-pro.json"));
|
||||
|
||||
skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
||||
skeleton.setPosition(250, 20);
|
||||
|
||||
AnimationStateData stateData = new AnimationStateData(skeletonData); // Defines mixing (crossfading) between animations.
|
||||
// stateData.setMix("run", "jump", 0.2f);
|
||||
// stateData.setMix("jump", "run", 0.2f);
|
||||
|
||||
state = new AnimationState(stateData); // Holds the animation state for a skeleton (current animation, time, etc).
|
||||
state.setTimeScale(0.5f); // Slow all animations down to 50% speed.
|
||||
|
||||
// Queue animations on track 0.
|
||||
state.setAnimation(0, "walk", true);
|
||||
// state.addAnimation(0, "jump", false, 2); // Jump after 2 seconds.
|
||||
// state.addAnimation(0, "run", true, 0); // Run after the jump.
|
||||
|
||||
// Create an empty skin and copy the goblingirl skin into it.
|
||||
Skin skin = new Skin("test");
|
||||
skin.copySkin(skeletonData.findSkin("goblingirl"));
|
||||
skeleton.setSkin(skin);
|
||||
|
||||
@ -137,8 +137,8 @@ public class SkeletonBinary {
|
||||
|
||||
SkeletonInput input = new SkeletonInput(file);
|
||||
try {
|
||||
skeletonData.hash = input.readString();
|
||||
if (skeletonData.hash.isEmpty()) skeletonData.hash = null;
|
||||
long hash = input.readLong();
|
||||
skeletonData.hash = hash == 0 ? null : Long.toString(hash);
|
||||
skeletonData.version = input.readString();
|
||||
if (skeletonData.version.isEmpty()) skeletonData.version = null;
|
||||
if ("3.8.75".equals(skeletonData.version))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user