Browse Source

Merge branch '4.0-beta' of https://github.com/esotericsoftware/spine-runtimes into 4.0-beta

badlogic 4 years ago
parent
commit
f0255427aa
21 changed files with 225 additions and 95 deletions
  1. 1 0
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/AttachmentTimelineTests.java
  2. 3 2
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/BonePlotting.java
  3. 7 7
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/Box2DExample.java
  4. 5 4
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/EventTimelineTests.java
  5. 106 0
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/FboTest.java
  6. 2 2
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/FrameByFrameTest.java
  7. 18 20
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/IKTest.java
  8. 4 3
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/MixTest.java
  9. 4 3
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/NormalMapTest.java
  10. 2 2
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SimpleTest1.java
  11. 6 6
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SimpleTest2.java
  12. 2 2
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SimpleTest3.java
  13. 2 2
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SimpleTest4.java
  14. 2 2
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkeletonAssetManagerTest.java
  15. 3 2
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkeletonAttachmentTest.java
  16. 2 2
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkinBonesMixAndMatchTest.java
  17. 21 21
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/TestHarness.java
  18. 4 3
      spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/VertexEffectTest.java
  19. 13 3
      spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java
  20. 14 9
      spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java
  21. 4 0
      spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonLoader.java

+ 1 - 0
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/AttachmentTimelineTests.java

@@ -30,6 +30,7 @@
 package com.esotericsoftware.spine;
 package com.esotericsoftware.spine;
 
 
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.Array;
+
 import com.esotericsoftware.spine.Animation.AttachmentTimeline;
 import com.esotericsoftware.spine.Animation.AttachmentTimeline;
 import com.esotericsoftware.spine.Animation.Timeline;
 import com.esotericsoftware.spine.Animation.Timeline;
 import com.esotericsoftware.spine.attachments.Attachment;
 import com.esotericsoftware.spine.attachments.Attachment;

+ 3 - 2
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/BonePlotting.java

@@ -30,15 +30,16 @@
 package com.esotericsoftware.spine;
 package com.esotericsoftware.spine;
 
 
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.files.FileHandle;
-import com.esotericsoftware.spine.Animation.MixDirection;
+
 import com.esotericsoftware.spine.Animation.MixBlend;
 import com.esotericsoftware.spine.Animation.MixBlend;
+import com.esotericsoftware.spine.Animation.MixDirection;
 import com.esotericsoftware.spine.attachments.AttachmentLoader;
 import com.esotericsoftware.spine.attachments.AttachmentLoader;
 import com.esotericsoftware.spine.attachments.BoundingBoxAttachment;
 import com.esotericsoftware.spine.attachments.BoundingBoxAttachment;
 import com.esotericsoftware.spine.attachments.ClippingAttachment;
 import com.esotericsoftware.spine.attachments.ClippingAttachment;
-import com.esotericsoftware.spine.attachments.RegionAttachment;
 import com.esotericsoftware.spine.attachments.MeshAttachment;
 import com.esotericsoftware.spine.attachments.MeshAttachment;
 import com.esotericsoftware.spine.attachments.PathAttachment;
 import com.esotericsoftware.spine.attachments.PathAttachment;
 import com.esotericsoftware.spine.attachments.PointAttachment;
 import com.esotericsoftware.spine.attachments.PointAttachment;
+import com.esotericsoftware.spine.attachments.RegionAttachment;
 
 
 public class BonePlotting {
 public class BonePlotting {
 	static public void main (String[] args) throws Exception {
 	static public void main (String[] args) throws Exception {

+ 7 - 7
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/Box2DExample.java

@@ -29,16 +29,10 @@
 
 
 package com.esotericsoftware.spine;
 package com.esotericsoftware.spine;
 
 
-import com.esotericsoftware.spine.Animation.MixDirection;
-import com.esotericsoftware.spine.Animation.MixBlend;
-import com.esotericsoftware.spine.attachments.AtlasAttachmentLoader;
-import com.esotericsoftware.spine.attachments.RegionAttachment;
-
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-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.SpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
@@ -55,6 +49,12 @@ import com.badlogic.gdx.physics.box2d.FixtureDef;
 import com.badlogic.gdx.physics.box2d.PolygonShape;
 import com.badlogic.gdx.physics.box2d.PolygonShape;
 import com.badlogic.gdx.physics.box2d.World;
 import com.badlogic.gdx.physics.box2d.World;
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.Array;
+import com.badlogic.gdx.utils.ScreenUtils;
+
+import com.esotericsoftware.spine.Animation.MixBlend;
+import com.esotericsoftware.spine.Animation.MixDirection;
+import com.esotericsoftware.spine.attachments.AtlasAttachmentLoader;
+import com.esotericsoftware.spine.attachments.RegionAttachment;
 
 
 public class Box2DExample extends ApplicationAdapter {
 public class Box2DExample extends ApplicationAdapter {
 	SpriteBatch batch;
 	SpriteBatch batch;
@@ -140,7 +140,7 @@ public class Box2DExample extends ApplicationAdapter {
 
 
 		camera.update();
 		camera.update();
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 		batch.setProjectionMatrix(camera.projection);
 		batch.setProjectionMatrix(camera.projection);
 		batch.setTransformMatrix(camera.view);
 		batch.setTransformMatrix(camera.view);
 		batch.begin();
 		batch.begin();

+ 5 - 4
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/EventTimelineTests.java

@@ -29,13 +29,14 @@
 
 
 package com.esotericsoftware.spine;
 package com.esotericsoftware.spine;
 
 
-import com.esotericsoftware.spine.Animation.EventTimeline;
-import com.esotericsoftware.spine.Animation.MixDirection;
-import com.esotericsoftware.spine.Animation.MixBlend;
+import java.util.Arrays;
+
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.StringBuilder;
 import com.badlogic.gdx.utils.StringBuilder;
 
 
-import java.util.Arrays;
+import com.esotericsoftware.spine.Animation.EventTimeline;
+import com.esotericsoftware.spine.Animation.MixBlend;
+import com.esotericsoftware.spine.Animation.MixDirection;
 
 
 /** Unit tests for {@link EventTimeline}. */
 /** Unit tests for {@link EventTimeline}. */
 public class EventTimelineTests {
 public class EventTimelineTests {

+ 106 - 0
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/FboTest.java

@@ -0,0 +1,106 @@
+
+package com.esotericsoftware.spine;
+
+import com.badlogic.gdx.ApplicationAdapter;
+import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.Input;
+import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
+import com.badlogic.gdx.graphics.Color;
+import com.badlogic.gdx.graphics.OrthographicCamera;
+import com.badlogic.gdx.graphics.Pixmap;
+import com.badlogic.gdx.graphics.g2d.BitmapFont;
+import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.graphics.g2d.TextureRegion;
+import com.badlogic.gdx.graphics.glutils.FrameBuffer;
+import com.badlogic.gdx.utils.ScreenUtils;
+
+import com.esotericsoftware.spine.utils.TwoColorPolygonBatch;
+
+public class FboTest extends ApplicationAdapter {
+	OrthographicCamera camera;
+	TwoColorPolygonBatch batch;
+	SkeletonRenderer renderer;
+	BitmapFont font;
+
+	TextureAtlas atlas;
+	Skeleton skeleton;
+
+	FrameBuffer fbo;
+	TextureRegion fboRegion;
+	boolean drawFbo = true;
+
+	public void create () {
+		camera = new OrthographicCamera();
+		batch = new TwoColorPolygonBatch();
+		renderer = new SkeletonRenderer();
+		renderer.setPremultipliedAlpha(true);
+		font = new BitmapFont();
+		font.setColor(Color.BLACK);
+
+		// Load the atlas and skeleton.
+		atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy-pma.atlas"));
+		SkeletonJson json = new SkeletonJson(atlas);
+		json.setScale(0.66f);
+		SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy-ess.json"));
+
+		// Create a skeleton instance, set the position of its root bone, and update its world transform.
+		skeleton = new Skeleton(skeletonData);
+		skeleton.setPosition(250, 20);
+		skeleton.updateWorldTransform();
+
+		// Create an FBO and a texture region with Y flipped.
+		fbo = new FrameBuffer(Pixmap.Format.RGBA8888, 512, 512, false);
+		fboRegion = new TextureRegion(fbo.getColorBufferTexture());
+		fboRegion.flip(false, true);
+
+		// Configure the camera and batch for rendering to the FBO's size.
+		camera.setToOrtho(false, fbo.getWidth(), fbo.getHeight());
+		camera.update();
+		batch.getProjectionMatrix().set(camera.combined);
+
+		// Render the skeleton to the FBO.
+		fbo.begin();
+		ScreenUtils.clear(0, 0, 0, 0);
+		batch.begin();
+		renderer.draw(batch, skeleton);
+		batch.end();
+		fbo.end();
+
+		// Configure the camera and batch for rendering to the screen's size.
+		camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
+		camera.update();
+		batch.getProjectionMatrix().set(camera.combined);
+	}
+
+	public void render () {
+		ScreenUtils.clear(1, 1, 1, 1);
+
+		batch.begin();
+
+		if (drawFbo) {
+			// Render the FBO color buffer texture to screen.
+			batch.draw(fboRegion, 0, 0);
+		} else {
+			// Render the skeleton directly to the screen.
+			renderer.draw(batch, skeleton);
+		}
+
+		font.draw(batch, drawFbo ? "Drawing FBO." : "Not drawing FBO.", 10, 10 + font.getCapHeight());
+		batch.end();
+
+		if (Gdx.input.justTouched() || Gdx.input.isKeyJustPressed(Input.Keys.SPACE)) {
+			drawFbo = !drawFbo;
+			Gdx.app.log("SpineFBOTest", "Using FBO: " + drawFbo);
+		}
+	}
+
+	public void resize (int width, int height) {
+		camera.setToOrtho(false, width, height);
+		camera.update();
+		batch.getProjectionMatrix().set(camera.combined);
+	}
+
+	static public void main (String[] args) throws Exception {
+		new LwjglApplication(new FboTest());
+	}
+}

+ 2 - 2
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/FrameByFrameTest.java

@@ -32,13 +32,13 @@ package com.esotericsoftware.spine;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 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.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.Animation;
 import com.badlogic.gdx.graphics.g2d.Animation;
 import com.badlogic.gdx.graphics.g2d.Animation.PlayMode;
 import com.badlogic.gdx.graphics.g2d.Animation.PlayMode;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasSprite;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasSprite;
+import com.badlogic.gdx.utils.ScreenUtils;
 
 
 public class FrameByFrameTest extends ApplicationAdapter {
 public class FrameByFrameTest extends ApplicationAdapter {
 	OrthographicCamera camera;
 	OrthographicCamera camera;
@@ -80,7 +80,7 @@ public class FrameByFrameTest extends ApplicationAdapter {
 		y -= origin[1];
 		y -= origin[1];
 		frame.setPosition(x, y);
 		frame.setPosition(x, y);
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		camera.update();
 		camera.update();
 		batch.getProjectionMatrix().set(camera.combined);
 		batch.getProjectionMatrix().set(camera.combined);

+ 18 - 20
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/IKTest.java

@@ -32,18 +32,16 @@ package com.esotericsoftware.spine;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 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.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.math.Vector2;
 import com.badlogic.gdx.math.Vector2;
 import com.badlogic.gdx.math.Vector3;
 import com.badlogic.gdx.math.Vector3;
+import com.badlogic.gdx.utils.ScreenUtils;
+
 import com.esotericsoftware.spine.utils.TwoColorPolygonBatch;
 import com.esotericsoftware.spine.utils.TwoColorPolygonBatch;
 
 
-/** Demonstrates how to let the target bone of an IK constraint
- * follow the mouse or touch position, which in turn repositions
- * part of the skeleton, in this case Spineboy's back arm including
- * his gun.
- */
+/** Demonstrates how to let the target bone of an IK constraint follow the mouse or touch position, which in turn repositions part
+ * of the skeleton, in this case Spineboy's back arm including his gun. */
 public class IKTest extends ApplicationAdapter {
 public class IKTest extends ApplicationAdapter {
 	OrthographicCamera camera;
 	OrthographicCamera camera;
 	TwoColorPolygonBatch batch;
 	TwoColorPolygonBatch batch;
@@ -52,7 +50,7 @@ public class IKTest extends ApplicationAdapter {
 	TextureAtlas atlas;
 	TextureAtlas atlas;
 	Skeleton skeleton;
 	Skeleton skeleton;
 	AnimationState state;
 	AnimationState state;
-	
+
 	Vector3 cameraCoords = new Vector3();
 	Vector3 cameraCoords = new Vector3();
 	Vector2 boneCoords = new Vector2();
 	Vector2 boneCoords = new Vector2();
 
 
@@ -66,21 +64,21 @@ public class IKTest extends ApplicationAdapter {
 		// Load the texture atlas and skeleton data
 		// Load the texture atlas and skeleton data
 		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);
 		SkeletonBinary json = new SkeletonBinary(atlas);
-		json.setScale(0.6f);		
+		json.setScale(0.6f);
 		SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy-pro.skel"));
 		SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy-pro.skel"));
 
 
 		// Create a skeleton from the skeleton data
 		// Create a skeleton from the skeleton data
 		skeleton = new Skeleton(skeletonData);
 		skeleton = new Skeleton(skeletonData);
 		skeleton.setPosition(250, 20);
 		skeleton.setPosition(250, 20);
-		
+
 		// Create an animation satte
 		// Create an animation satte
 		AnimationStateData stateData = new AnimationStateData(skeletonData);
 		AnimationStateData stateData = new AnimationStateData(skeletonData);
 		state = new AnimationState(stateData);
 		state = new AnimationState(stateData);
-		
+
 		// Queue the "walk" animation on the first track.
 		// Queue the "walk" animation on the first track.
 		state.setAnimation(0, "walk", true);
 		state.setAnimation(0, "walk", true);
-		
-		// Queue the "aim" animation on a higher track. 
+
+		// Queue the "aim" animation on a higher track.
 		// It consists of a single frame that positions
 		// It consists of a single frame that positions
 		// the back arm and gun such that they point at
 		// the back arm and gun such that they point at
 		// the "crosshair" bone. By setting this
 		// the "crosshair" bone. By setting this
@@ -97,10 +95,10 @@ public class IKTest extends ApplicationAdapter {
 		// then calculate the world transforms of every bone.
 		// then calculate the world transforms of every bone.
 		// This is needed so we can call Bone#worldToLocal()
 		// This is needed so we can call Bone#worldToLocal()
 		// later.
 		// later.
-		state.update(Gdx.graphics.getDeltaTime());		
+		state.update(Gdx.graphics.getDeltaTime());
 		state.apply(skeleton);
 		state.apply(skeleton);
 		skeleton.updateWorldTransform();
 		skeleton.updateWorldTransform();
-		
+
 		// Position the "crosshair" bone at the mouse
 		// Position the "crosshair" bone at the mouse
 		// location. We do this before calling
 		// location. We do this before calling
 		// skeleton.updateWorldTransform() below, so
 		// skeleton.updateWorldTransform() below, so
@@ -110,18 +108,18 @@ public class IKTest extends ApplicationAdapter {
 		// When setting the crosshair bone position
 		// When setting the crosshair bone position
 		// to the mouse position, we need to translate
 		// to the mouse position, we need to translate
 		// from "mouse space" to "camera space"
 		// from "mouse space" to "camera space"
-		// and then to "local bone space". Note that the local 
+		// and then to "local bone space". Note that the local
 		// bone space is calculated using the bone's parent
 		// bone space is calculated using the bone's parent
 		// worldToLocal() function!
 		// worldToLocal() function!
 		cameraCoords.set(Gdx.input.getX(), Gdx.input.getY(), 0);
 		cameraCoords.set(Gdx.input.getX(), Gdx.input.getY(), 0);
-		camera.unproject(cameraCoords); // mouse space to camera space		
-		
+		camera.unproject(cameraCoords); // mouse space to camera space
+
 		Bone crosshair = skeleton.findBone("crosshair"); // Should be cached.
 		Bone crosshair = skeleton.findBone("crosshair"); // Should be cached.
 		boneCoords.set(cameraCoords.x, cameraCoords.y);
 		boneCoords.set(cameraCoords.x, cameraCoords.y);
 		crosshair.getParent().worldToLocal(boneCoords); // camera space to local bone space
 		crosshair.getParent().worldToLocal(boneCoords); // camera space to local bone space
 		crosshair.setPosition(boneCoords.x, boneCoords.y); // override the crosshair position
 		crosshair.setPosition(boneCoords.x, boneCoords.y); // override the crosshair position
 		crosshair.setAppliedValid(false);
 		crosshair.setAppliedValid(false);
-		
+
 		// Calculate final world transform with the
 		// Calculate final world transform with the
 		// crosshair bone set to the mouse cursor
 		// crosshair bone set to the mouse cursor
 		// position.
 		// position.
@@ -129,9 +127,9 @@ public class IKTest extends ApplicationAdapter {
 
 
 		// Clear the screen, update the camera and
 		// Clear the screen, update the camera and
 		// render the skeleton.
 		// render the skeleton.
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 		camera.update();
 		camera.update();
-		
+
 		batch.getProjectionMatrix().set(camera.combined);
 		batch.getProjectionMatrix().set(camera.combined);
 		batch.begin();
 		batch.begin();
 		renderer.draw(batch, skeleton);
 		renderer.draw(batch, skeleton);

+ 4 - 3
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/MixTest.java

@@ -32,12 +32,13 @@ package com.esotericsoftware.spine;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 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.g2d.SpriteBatch;
 import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.Array;
-import com.esotericsoftware.spine.Animation.MixDirection;
+import com.badlogic.gdx.utils.ScreenUtils;
+
 import com.esotericsoftware.spine.Animation.MixBlend;
 import com.esotericsoftware.spine.Animation.MixBlend;
+import com.esotericsoftware.spine.Animation.MixDirection;
 
 
 public class MixTest extends ApplicationAdapter {
 public class MixTest extends ApplicationAdapter {
 	SpriteBatch batch;
 	SpriteBatch batch;
@@ -95,7 +96,7 @@ public class MixTest extends ApplicationAdapter {
 		if (time > beforeJump + blendIn && time < blendOutStart) speed = 360;
 		if (time > beforeJump + blendIn && time < blendOutStart) speed = 360;
 		skeleton.setX(skeleton.getX() + speed * delta);
 		skeleton.setX(skeleton.getX() + speed * delta);
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		// This shows how to manage state manually. See SimpleTest1 for a higher level API using AnimationState.
 		// This shows how to manage state manually. See SimpleTest1 for a higher level API using AnimationState.
 		if (time > total) {
 		if (time > total) {

+ 4 - 3
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/NormalMapTest.java

@@ -36,7 +36,6 @@ import com.badlogic.gdx.InputMultiplexer;
 import com.badlogic.gdx.Preferences;
 import com.badlogic.gdx.Preferences;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.files.FileHandle;
-import com.badlogic.gdx.graphics.GL20;
 import com.badlogic.gdx.graphics.Texture;
 import com.badlogic.gdx.graphics.Texture;
 import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
@@ -55,8 +54,10 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
 import com.badlogic.gdx.scenes.scene2d.ui.Window;
 import com.badlogic.gdx.scenes.scene2d.ui.Window;
 import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
 import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
 import com.badlogic.gdx.utils.Align;
 import com.badlogic.gdx.utils.Align;
-import com.esotericsoftware.spine.Animation.MixDirection;
+import com.badlogic.gdx.utils.ScreenUtils;
+
 import com.esotericsoftware.spine.Animation.MixBlend;
 import com.esotericsoftware.spine.Animation.MixBlend;
+import com.esotericsoftware.spine.Animation.MixDirection;
 
 
 public class NormalMapTest extends ApplicationAdapter {
 public class NormalMapTest extends ApplicationAdapter {
 	String skeletonPath, animationName;
 	String skeletonPath, animationName;
@@ -138,7 +139,7 @@ public class NormalMapTest extends ApplicationAdapter {
 		lightPosition.x = Gdx.input.getX();
 		lightPosition.x = Gdx.input.getX();
 		lightPosition.y = (Gdx.graphics.getHeight() - 1 - Gdx.input.getY());
 		lightPosition.y = (Gdx.graphics.getHeight() - 1 - Gdx.input.getY());
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		ambientColor.x = ui.ambientColorR.getValue();
 		ambientColor.x = ui.ambientColorR.getValue();
 		ambientColor.y = ui.ambientColorG.getValue();
 		ambientColor.y = ui.ambientColorG.getValue();

+ 2 - 2
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SimpleTest1.java

@@ -32,10 +32,10 @@ package com.esotericsoftware.spine;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 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.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.utils.ScreenUtils;
 
 
 public class SimpleTest1 extends ApplicationAdapter {
 public class SimpleTest1 extends ApplicationAdapter {
 	OrthographicCamera camera;
 	OrthographicCamera camera;
@@ -82,7 +82,7 @@ public class SimpleTest1 extends ApplicationAdapter {
 	public void render () {
 	public void render () {
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		state.apply(skeleton); // Poses skeleton using current animations. This sets the bones' local SRT.
 		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.
 		skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.

+ 6 - 6
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SimpleTest2.java

@@ -29,20 +29,20 @@
 
 
 package com.esotericsoftware.spine;
 package com.esotericsoftware.spine;
 
 
-import com.esotericsoftware.spine.AnimationState.AnimationStateListener;
-import com.esotericsoftware.spine.AnimationState.TrackEntry;
-import com.esotericsoftware.spine.attachments.BoundingBoxAttachment;
-
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.InputAdapter;
 import com.badlogic.gdx.InputAdapter;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.Color;
-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.SpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.math.Vector3;
 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;
 
 
 public class SimpleTest2 extends ApplicationAdapter {
 public class SimpleTest2 extends ApplicationAdapter {
 	OrthographicCamera camera;
 	OrthographicCamera camera;
@@ -145,7 +145,7 @@ public class SimpleTest2 extends ApplicationAdapter {
 	public void render () {
 	public void render () {
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		if (state.apply(skeleton)) // Poses skeleton using current animations. This sets the bones' local SRT.
 		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.
 			skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.

+ 2 - 2
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SimpleTest3.java

@@ -32,10 +32,10 @@ package com.esotericsoftware.spine;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 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.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.utils.ScreenUtils;
 
 
 public class SimpleTest3 extends ApplicationAdapter {
 public class SimpleTest3 extends ApplicationAdapter {
 	OrthographicCamera camera;
 	OrthographicCamera camera;
@@ -80,7 +80,7 @@ public class SimpleTest3 extends ApplicationAdapter {
 	public void render () {
 	public void render () {
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		if (state.apply(skeleton)) // Poses skeleton using current animations. This sets the bones' local SRT.
 		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.
 			skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.

+ 2 - 2
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SimpleTest4.java

@@ -32,9 +32,9 @@ package com.esotericsoftware.spine;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 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.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.utils.ScreenUtils;
 
 
 import com.esotericsoftware.spine.utils.TwoColorPolygonBatch;
 import com.esotericsoftware.spine.utils.TwoColorPolygonBatch;
 
 
@@ -85,7 +85,7 @@ public class SimpleTest4 extends ApplicationAdapter {
 	public void render () {
 	public void render () {
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		state.apply(skeleton); // Poses skeleton using current animations. This sets the bones' local SRT.
 		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.
 		skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.

+ 2 - 2
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkeletonAssetManagerTest.java

@@ -33,10 +33,10 @@ import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.assets.AssetManager;
 import com.badlogic.gdx.assets.AssetManager;
 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.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.utils.ScreenUtils;
 
 
 import com.esotericsoftware.spine.utils.SkeletonDataLoader;
 import com.esotericsoftware.spine.utils.SkeletonDataLoader;
 import com.esotericsoftware.spine.utils.SkeletonDataLoader.SkeletonDataParameter;
 import com.esotericsoftware.spine.utils.SkeletonDataLoader.SkeletonDataParameter;
@@ -71,7 +71,7 @@ public class SkeletonAssetManagerTest extends ApplicationAdapter {
 	}
 	}
 
 
 	public void render () {
 	public void render () {
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		if (skeleton == null) {
 		if (skeleton == null) {
 			// Not loaded yet.
 			// Not loaded yet.

+ 3 - 2
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkeletonAttachmentTest.java

@@ -32,10 +32,11 @@ package com.esotericsoftware.spine;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 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.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.utils.ScreenUtils;
+
 import com.esotericsoftware.spine.attachments.SkeletonAttachment;
 import com.esotericsoftware.spine.attachments.SkeletonAttachment;
 
 
 public class SkeletonAttachmentTest extends ApplicationAdapter {
 public class SkeletonAttachmentTest extends ApplicationAdapter {
@@ -97,7 +98,7 @@ public class SkeletonAttachmentTest extends ApplicationAdapter {
 		goblinState.apply(goblin);
 		goblinState.apply(goblin);
 		goblin.updateWorldTransform(attachmentBone);
 		goblin.updateWorldTransform(attachmentBone);
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		camera.update();
 		camera.update();
 		batch.getProjectionMatrix().set(camera.combined);
 		batch.getProjectionMatrix().set(camera.combined);

+ 2 - 2
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkinBonesMixAndMatchTest.java

@@ -32,10 +32,10 @@ package com.esotericsoftware.spine;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 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.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.utils.ScreenUtils;
 
 
 public class SkinBonesMixAndMatchTest extends ApplicationAdapter {
 public class SkinBonesMixAndMatchTest extends ApplicationAdapter {
 	OrthographicCamera camera;
 	OrthographicCamera camera;
@@ -90,7 +90,7 @@ public class SkinBonesMixAndMatchTest extends ApplicationAdapter {
 	public void render () {
 	public void render () {
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 		state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		state.apply(skeleton); // Poses skeleton using current animations. This sets the bones' local SRT.
 		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.
 		skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.

+ 21 - 21
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/TestHarness.java

@@ -32,42 +32,43 @@ package com.esotericsoftware.spine;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 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.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
 import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
 import com.badlogic.gdx.math.Interpolation;
 import com.badlogic.gdx.math.Interpolation;
+import com.badlogic.gdx.utils.ScreenUtils;
+
 import com.esotericsoftware.spine.vertexeffects.SwirlEffect;
 import com.esotericsoftware.spine.vertexeffects.SwirlEffect;
 
 
 public class TestHarness extends ApplicationAdapter {
 public class TestHarness extends ApplicationAdapter {
-//	static String JSON = "coin/coin-pro.json";
-//	static String ATLAS = "coin/coin-pma.atlas";
-	
+// static String JSON = "coin/coin-pro.json";
+// static String ATLAS = "coin/coin-pma.atlas";
+
 	static String JSON = "raptor/raptor-pro.json";
 	static String JSON = "raptor/raptor-pro.json";
 	static String ATLAS = "raptor/raptor-pma.atlas";
 	static String ATLAS = "raptor/raptor-pma.atlas";
-	
+
 	OrthographicCamera camera;
 	OrthographicCamera camera;
 	PolygonSpriteBatch batch;
 	PolygonSpriteBatch batch;
 	SkeletonRenderer renderer;
 	SkeletonRenderer renderer;
-	
+
 	ShapeRenderer shapes;
 	ShapeRenderer shapes;
 
 
 	TextureAtlas atlas;
 	TextureAtlas atlas;
 	Skeleton skeleton;
 	Skeleton skeleton;
 	AnimationState state;
 	AnimationState state;
-	
+
 	SwirlEffect swirl;
 	SwirlEffect swirl;
 	float swirlTime;
 	float swirlTime;
 
 
-	public void create () {		
+	public void create () {
 		camera = new OrthographicCamera();
 		camera = new OrthographicCamera();
 		camera.setToOrtho(true);
 		camera.setToOrtho(true);
 		batch = new PolygonSpriteBatch();
 		batch = new PolygonSpriteBatch();
 		renderer = new SkeletonRenderer();
 		renderer = new SkeletonRenderer();
-		renderer.setPremultipliedAlpha(true);		
+		renderer.setPremultipliedAlpha(true);
 		shapes = new ShapeRenderer();
 		shapes = new ShapeRenderer();
-		
+
 		swirl = new SwirlEffect(400);
 		swirl = new SwirlEffect(400);
 		swirl.setCenterY(-200);
 		swirl.setCenterY(-200);
 		renderer.setVertexEffect(swirl);
 		renderer.setVertexEffect(swirl);
@@ -76,13 +77,13 @@ public class TestHarness extends ApplicationAdapter {
 		SkeletonJson json = new SkeletonJson(atlas);
 		SkeletonJson json = new SkeletonJson(atlas);
 		json.setScale(0.5f);
 		json.setScale(0.5f);
 		SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal(JSON));
 		SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal(JSON));
-		
-		skeleton = new Skeleton(skeletonData);		
+
+		skeleton = new Skeleton(skeletonData);
 		skeleton.setPosition(320, 590);
 		skeleton.setPosition(320, 590);
 		skeleton.setScaleY(-1);
 		skeleton.setScaleY(-1);
 
 
-		AnimationStateData stateData = new AnimationStateData(skeletonData);		
-		state = new AnimationState(stateData);		
+		AnimationStateData stateData = new AnimationStateData(skeletonData);
+		state = new AnimationState(stateData);
 		// state.setAnimation(0, "rotate", false);
 		// state.setAnimation(0, "rotate", false);
 		state.update(0);
 		state.update(0);
 		state.apply(skeleton);
 		state.apply(skeleton);
@@ -91,30 +92,29 @@ public class TestHarness extends ApplicationAdapter {
 
 
 	public void render () {
 	public void render () {
 		if (Gdx.input.justTouched()) {
 		if (Gdx.input.justTouched()) {
-			state.update(0.25f); // Update the animation time.			
+			state.update(0.25f); // Update the animation time.
 		}
 		}
 		state.apply(skeleton); // Poses skeleton using current animations. This sets the bones' local SRT.
 		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.
 		skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
-		
+		ScreenUtils.clear(0, 0, 0, 0);
+
 		swirlTime += Gdx.graphics.getDeltaTime();
 		swirlTime += Gdx.graphics.getDeltaTime();
 		float percent = swirlTime % 2;
 		float percent = swirlTime % 2;
 		if (percent > 1) percent = 1 - (percent - 1);
 		if (percent > 1) percent = 1 - (percent - 1);
 		swirl.setAngle(Interpolation.pow2.apply(-60, 60, percent));
 		swirl.setAngle(Interpolation.pow2.apply(-60, 60, percent));
 
 
-
 		// Configure the camera, SpriteBatch, and SkeletonRendererDebug.
 		// Configure the camera, SpriteBatch, and SkeletonRendererDebug.
 		camera.update();
 		camera.update();
-		batch.getProjectionMatrix().set(camera.combined);		
+		batch.getProjectionMatrix().set(camera.combined);
 
 
 		batch.begin();
 		batch.begin();
 		renderer.draw(batch, skeleton); // Draw the skeleton images.
 		renderer.draw(batch, skeleton); // Draw the skeleton images.
-		batch.end();		
+		batch.end();
 	}
 	}
 
 
 	public void resize (int width, int height) {
 	public void resize (int width, int height) {
-		camera.setToOrtho(true); // Update camera with new size.		
+		camera.setToOrtho(true); // Update camera with new size.
 	}
 	}
 
 
 	public void dispose () {
 	public void dispose () {

+ 4 - 3
spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/VertexEffectTest.java

@@ -33,11 +33,12 @@ import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
 import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-import com.badlogic.gdx.graphics.GL20;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.OrthographicCamera;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.math.Interpolation;
 import com.badlogic.gdx.math.Interpolation;
+import com.badlogic.gdx.utils.ScreenUtils;
+
 import com.esotericsoftware.spine.vertexeffects.SwirlEffect;
 import com.esotericsoftware.spine.vertexeffects.SwirlEffect;
 
 
 public class VertexEffectTest extends ApplicationAdapter {
 public class VertexEffectTest extends ApplicationAdapter {
@@ -74,7 +75,7 @@ public class VertexEffectTest extends ApplicationAdapter {
 		// 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.
-		
+
 		swirl = new SwirlEffect(400);
 		swirl = new SwirlEffect(400);
 		swirl.setCenter(0, 200);
 		swirl.setCenter(0, 200);
 		renderer.setVertexEffect(swirl);
 		renderer.setVertexEffect(swirl);
@@ -92,7 +93,7 @@ public class VertexEffectTest extends ApplicationAdapter {
 		if (percent > 1) percent = 1 - (percent - 1);
 		if (percent > 1) percent = 1 - (percent - 1);
 		swirl.setAngle(Interpolation.pow2.apply(-60, 60, percent));
 		swirl.setAngle(Interpolation.pow2.apply(-60, 60, percent));
 
 
-		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+		ScreenUtils.clear(0, 0, 0, 0);
 
 
 		state.apply(skeleton); // Poses skeleton using current animations. This sets the bones' local SRT.
 		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.
 		skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.

+ 13 - 3
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java

@@ -31,6 +31,7 @@ package com.esotericsoftware.spine;
 
 
 import java.io.EOFException;
 import java.io.EOFException;
 import java.io.IOException;
 import java.io.IOException;
+import java.io.InputStream;
 
 
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.Color;
@@ -128,13 +129,18 @@ public class SkeletonBinary extends SkeletonLoader {
 
 
 	public SkeletonData readSkeletonData (FileHandle file) {
 	public SkeletonData readSkeletonData (FileHandle file) {
 		if (file == null) throw new IllegalArgumentException("file cannot be null.");
 		if (file == null) throw new IllegalArgumentException("file cannot be null.");
+		SkeletonData skeletonData = readSkeletonData(file.read());
+		skeletonData.name = file.nameWithoutExtension();
+		return skeletonData;
+	}
+
+	public SkeletonData readSkeletonData (InputStream dataInput) {
+		if (dataInput == null) throw new IllegalArgumentException("dataInput cannot be null.");
 
 
 		float scale = this.scale;
 		float scale = this.scale;
 
 
+		SkeletonInput input = new SkeletonInput(dataInput);
 		SkeletonData skeletonData = new SkeletonData();
 		SkeletonData skeletonData = new SkeletonData();
-		skeletonData.name = file.nameWithoutExtension();
-
-		SkeletonInput input = new SkeletonInput(file);
 		try {
 		try {
 			long hash = input.readLong();
 			long hash = input.readLong();
 			skeletonData.hash = hash == 0 ? null : Long.toString(hash);
 			skeletonData.hash = hash == 0 ? null : Long.toString(hash);
@@ -1054,6 +1060,10 @@ public class SkeletonBinary extends SkeletonLoader {
 		private char[] chars = new char[32];
 		private char[] chars = new char[32];
 		String[] strings;
 		String[] strings;
 
 
+		public SkeletonInput (InputStream input) {
+			super(input);
+		}
+
 		public SkeletonInput (FileHandle file) {
 		public SkeletonInput (FileHandle file) {
 			super(file.read(512));
 			super(file.read(512));
 		}
 		}

+ 14 - 9
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java

@@ -31,6 +31,8 @@ package com.esotericsoftware.spine;
 
 
 import static com.esotericsoftware.spine.utils.SpineUtils.*;
 import static com.esotericsoftware.spine.utils.SpineUtils.*;
 
 
+import java.io.InputStream;
+
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
@@ -100,22 +102,25 @@ public class SkeletonJson extends SkeletonLoader {
 		super(atlas);
 		super(atlas);
 	}
 	}
 
 
-	protected JsonValue parse (FileHandle file) {
-		if (file == null) throw new IllegalArgumentException("file cannot be null.");
-		return new JsonReader().parse(file);
-	}
-
 	public SkeletonData readSkeletonData (FileHandle file) {
 	public SkeletonData readSkeletonData (FileHandle file) {
 		if (file == null) throw new IllegalArgumentException("file cannot be null.");
 		if (file == null) throw new IllegalArgumentException("file cannot be null.");
+		SkeletonData skeletonData = readSkeletonData(new JsonReader().parse(file));
+		skeletonData.name = file.nameWithoutExtension();
+		return skeletonData;
+	}
 
 
-		float scale = this.scale;
+	public SkeletonData readSkeletonData (InputStream input) {
+		if (input == null) throw new IllegalArgumentException("dataInput cannot be null.");
+		return readSkeletonData(new JsonReader().parse(input));
+	}
 
 
-		SkeletonData skeletonData = new SkeletonData();
-		skeletonData.name = file.nameWithoutExtension();
+	public SkeletonData readSkeletonData (JsonValue root) {
+		if (root == null) throw new IllegalArgumentException("root cannot be null.");
 
 
-		JsonValue root = parse(file);
+		float scale = this.scale;
 
 
 		// Skeleton.
 		// Skeleton.
+		SkeletonData skeletonData = new SkeletonData();
 		JsonValue skeletonMap = root.get("skeleton");
 		JsonValue skeletonMap = root.get("skeleton");
 		if (skeletonMap != null) {
 		if (skeletonMap != null) {
 			skeletonData.hash = skeletonMap.getString("hash", null);
 			skeletonData.hash = skeletonMap.getString("hash", null);

+ 4 - 0
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonLoader.java

@@ -1,6 +1,8 @@
 
 
 package com.esotericsoftware.spine;
 package com.esotericsoftware.spine;
 
 
+import java.io.InputStream;
+
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.Array;
@@ -46,4 +48,6 @@ abstract public class SkeletonLoader {
 	}
 	}
 
 
 	abstract public SkeletonData readSkeletonData (FileHandle file);
 	abstract public SkeletonData readSkeletonData (FileHandle file);
+
+	abstract public SkeletonData readSkeletonData (InputStream input);
 }
 }