|
@@ -34,19 +34,18 @@ import com.badlogic.gdx.Gdx;
|
|
|
import com.badlogic.gdx.InputAdapter;
|
|
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
|
|
import com.badlogic.gdx.graphics.Color;
|
|
|
+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.TextureAtlas;
|
|
|
import com.badlogic.gdx.math.Vector3;
|
|
|
-import com.badlogic.gdx.utils.ScreenUtils;
|
|
|
-
|
|
|
import com.esotericsoftware.spine.AnimationState.AnimationStateListener;
|
|
|
import com.esotericsoftware.spine.AnimationState.TrackEntry;
|
|
|
import com.esotericsoftware.spine.attachments.BoundingBoxAttachment;
|
|
|
+import com.esotericsoftware.spine.utils.TwoColorPolygonBatch;
|
|
|
|
|
|
public class SimpleTest2 extends ApplicationAdapter {
|
|
|
OrthographicCamera camera;
|
|
|
- SpriteBatch batch;
|
|
|
+ TwoColorPolygonBatch batch;
|
|
|
SkeletonRenderer renderer;
|
|
|
SkeletonRendererDebug debugRenderer;
|
|
|
|
|
@@ -57,17 +56,15 @@ public class SimpleTest2 extends ApplicationAdapter {
|
|
|
|
|
|
public void create () {
|
|
|
camera = new OrthographicCamera();
|
|
|
- batch = new SpriteBatch();
|
|
|
+ batch = new TwoColorPolygonBatch();
|
|
|
renderer = new SkeletonRenderer();
|
|
|
renderer.setPremultipliedAlpha(true);
|
|
|
debugRenderer = new SkeletonRendererDebug();
|
|
|
|
|
|
atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy-pma.atlas"));
|
|
|
-
|
|
|
- SkeletonJson loader = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
|
|
- // SkeletonLoader loader = new SkeletonBinary(atlas); // Or use SkeletonBinary to load binary data.
|
|
|
- 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"));
|
|
|
+ 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"));
|
|
|
|
|
|
skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
|
|
skeleton.setPosition(250, 20);
|
|
@@ -145,7 +142,7 @@ public class SimpleTest2 extends ApplicationAdapter {
|
|
|
public void render () {
|
|
|
state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
|
|
|
|
|
|
- ScreenUtils.clear(0, 0, 0, 0);
|
|
|
+ Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
|
|
|
|
if (state.apply(skeleton)) // Poses skeleton using current animations. This sets the bones' local SRT.
|
|
|
skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.
|