mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-03 06:09:09 +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.backends.lwjgl.LwjglApplication;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
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;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
|
|
||||||
public class SimpleTest1 extends ApplicationAdapter {
|
public class SimpleTest1 extends ApplicationAdapter {
|
||||||
OrthographicCamera camera;
|
OrthographicCamera camera;
|
||||||
SpriteBatch batch;
|
PolygonSpriteBatch batch;
|
||||||
SkeletonRenderer renderer;
|
SkeletonRenderer renderer;
|
||||||
SkeletonRendererDebug debugRenderer;
|
SkeletonRendererDebug debugRenderer;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public class SimpleTest1 extends ApplicationAdapter {
|
|||||||
|
|
||||||
public void create () {
|
public void create () {
|
||||||
camera = new OrthographicCamera();
|
camera = new OrthographicCamera();
|
||||||
batch = new SpriteBatch();
|
batch = new PolygonSpriteBatch();
|
||||||
renderer = new SkeletonRenderer();
|
renderer = new SkeletonRenderer();
|
||||||
renderer.setPremultipliedAlpha(true); // PMA results in correct blending without outlines.
|
renderer.setPremultipliedAlpha(true); // PMA results in correct blending without outlines.
|
||||||
debugRenderer = new SkeletonRendererDebug();
|
debugRenderer = new SkeletonRendererDebug();
|
||||||
@ -57,9 +57,15 @@ public class SimpleTest1 extends ApplicationAdapter {
|
|||||||
debugRenderer.setRegionAttachments(false);
|
debugRenderer.setRegionAttachments(false);
|
||||||
|
|
||||||
atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy-pma.atlas"));
|
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.
|
SkeletonJson loader = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||||
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy-pro.skel"));
|
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 = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
||||||
skeleton.setPosition(250, 20);
|
skeleton.setPosition(250, 20);
|
||||||
|
|||||||
@ -63,9 +63,15 @@ public class SimpleTest2 extends ApplicationAdapter {
|
|||||||
debugRenderer = new SkeletonRendererDebug();
|
debugRenderer = new SkeletonRendererDebug();
|
||||||
|
|
||||||
atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy-pma.atlas"));
|
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.
|
SkeletonJson loader = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||||
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy-ess.json"));
|
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 = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
||||||
skeleton.setPosition(250, 20);
|
skeleton.setPosition(250, 20);
|
||||||
|
|||||||
@ -58,9 +58,15 @@ public class SimpleTest3 extends ApplicationAdapter {
|
|||||||
debugRenderer.setMeshHull(false);
|
debugRenderer.setMeshHull(false);
|
||||||
|
|
||||||
atlas = new TextureAtlas(Gdx.files.internal("raptor/raptor-pma.atlas"));
|
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.
|
SkeletonJson loader = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||||
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("raptor/raptor-pro.json"));
|
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 = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
||||||
skeleton.setPosition(250, 20);
|
skeleton.setPosition(250, 20);
|
||||||
@ -71,7 +77,7 @@ public class SimpleTest3 extends ApplicationAdapter {
|
|||||||
state.setTimeScale(0.6f); // Slow all animations down to 60% speed.
|
state.setTimeScale(0.6f); // Slow all animations down to 60% speed.
|
||||||
|
|
||||||
// Queue animations on tracks 0 and 1.
|
// 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.
|
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);
|
debugRenderer.setRegionAttachments(false);
|
||||||
|
|
||||||
atlas = new TextureAtlas(Gdx.files.internal("goblins/goblins-pma.atlas"));
|
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.
|
SkeletonJson loader = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||||
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("goblins/goblins-pro.json"));
|
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 = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
||||||
skeleton.setPosition(250, 20);
|
skeleton.setPosition(250, 20);
|
||||||
|
|
||||||
AnimationStateData stateData = new AnimationStateData(skeletonData); // Defines mixing (crossfading) between animations.
|
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 = 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.
|
state.setTimeScale(0.5f); // Slow all animations down to 50% speed.
|
||||||
|
|
||||||
// Queue animations on track 0.
|
// Queue animations on track 0.
|
||||||
state.setAnimation(0, "walk", true);
|
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 skin = new Skin("test");
|
||||||
skin.copySkin(skeletonData.findSkin("goblingirl"));
|
skin.copySkin(skeletonData.findSkin("goblingirl"));
|
||||||
skeleton.setSkin(skin);
|
skeleton.setSkin(skin);
|
||||||
|
|||||||
@ -137,8 +137,8 @@ public class SkeletonBinary {
|
|||||||
|
|
||||||
SkeletonInput input = new SkeletonInput(file);
|
SkeletonInput input = new SkeletonInput(file);
|
||||||
try {
|
try {
|
||||||
skeletonData.hash = input.readString();
|
long hash = input.readLong();
|
||||||
if (skeletonData.hash.isEmpty()) skeletonData.hash = null;
|
skeletonData.hash = hash == 0 ? null : Long.toString(hash);
|
||||||
skeletonData.version = input.readString();
|
skeletonData.version = input.readString();
|
||||||
if (skeletonData.version.isEmpty()) skeletonData.version = null;
|
if (skeletonData.version.isEmpty()) skeletonData.version = null;
|
||||||
if ("3.8.75".equals(skeletonData.version))
|
if ("3.8.75".equals(skeletonData.version))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user