Browse Source

libgdx runtime, attachment loader instead of resolver.
Other minor fixes.

NathanSweet 12 năm trước cách đây
mục cha
commit
695db31d71
22 tập tin đã thay đổi với 138 bổ sung154 xóa
  1. 1 2
      spine-cpp/includes/spine-sfml/AtlasAttachmentLoader.h
  2. 1 0
      spine-cpp/includes/spine/Animation.h
  3. 1 1
      spine-cpp/includes/spine/BaseAtlas.h
  4. 8 14
      spine-cpp/src/spine-sfml/RegionAttachment.cpp
  5. 9 0
      spine-cpp/src/spine/Animation.cpp
  6. 1 0
      spine-cpp/src/spine/BaseSkeleton.cpp
  7. 2 3
      spine-libgdx/.classpath
  8. 3 3
      spine-libgdx/.settings/org.eclipse.jdt.core.prefs
  9. 0 11
      spine-libgdx/src/com/esotericsoftware/spine/Attachment.java
  10. 6 0
      spine-libgdx/src/com/esotericsoftware/spine/AttachmentLoader.java
  11. 0 6
      spine-libgdx/src/com/esotericsoftware/spine/AttachmentResolver.java
  12. 6 0
      spine-libgdx/src/com/esotericsoftware/spine/AttachmentType.java
  13. 8 10
      spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java
  14. 15 23
      spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java
  15. 0 10
      spine-libgdx/src/com/esotericsoftware/spine/SkeletonData.java
  16. 17 22
      spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java
  17. 11 7
      spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionSequenceAttachment.java
  18. 41 0
      spine-libgdx/src/com/esotericsoftware/spine/attachments/TextureAtlasAttachmentLoader.java
  19. 0 29
      spine-libgdx/src/com/esotericsoftware/spine/attachments/TextureAtlasAttachmentResolver.java
  20. 4 6
      spine-libgdx/test/com/esotericsoftware/spine/MixTest.java
  21. 4 4
      spine-libgdx/test/com/esotericsoftware/spine/SkeletonTest.java
  22. 0 3
      spine-libgdx/test/spineboy-skeleton.json

+ 1 - 2
spine-cpp/includes/spine-sfml/AtlasAttachmentLoader.h

@@ -14,8 +14,7 @@ public:
 	AtlasAttachmentLoader (Atlas *atlas);
 
 	virtual Attachment* newAttachment (AttachmentType type, const std::string &name);
-}
-;
+};
 
 } /* namespace spine */
 #endif /* SPINE_ATLASATTACHMENTLOADER_H_ */

+ 1 - 0
spine-cpp/includes/spine/Animation.h

@@ -18,6 +18,7 @@ public:
   ~Animation();
 
 	void apply (BaseSkeleton *skeleton, float time, bool loop);
+	void mix (BaseSkeleton *skeleton, float time, bool loop, float alpha);
 };
 
 //

+ 1 - 1
spine-cpp/includes/spine/BaseAtlas.h

@@ -27,7 +27,7 @@ public:
 
 private:
 	virtual BaseAtlasPage* newAtlasPage (std::string name) = 0;
-	virtual BaseAtlasRegion* newAtlasRegion (BaseAtlasPage*) = 0;
+	virtual BaseAtlasRegion* newAtlasRegion (BaseAtlasPage *page) = 0;
 };
 
 //

+ 8 - 14
spine-cpp/src/spine-sfml/RegionAttachment.cpp

@@ -70,20 +70,14 @@ void RegionAttachment::draw (Slot *slot) {
 }
 
 void RegionAttachment::updateWorldVertices (spine::Bone *bone) {
-	float x = bone->worldX;
-	float y = bone->worldY;
-	float m00 = bone->m00;
-	float m01 = bone->m01;
-	float m10 = bone->m10;
-	float m11 = bone->m11;
-	vertices[0].position.x = offset[0] * m00 + offset[1] * m01 + x;
-	vertices[0].position.y = offset[0] * m10 + offset[1] * m11 + y;
-	vertices[1].position.x = offset[2] * m00 + offset[3] * m01 + x;
-	vertices[1].position.y = offset[2] * m10 + offset[3] * m11 + y;
-	vertices[2].position.x = offset[4] * m00 + offset[5] * m01 + x;
-	vertices[2].position.y = offset[4] * m10 + offset[5] * m11 + y;
-	vertices[3].position.x = offset[6] * m00 + offset[7] * m01 + x;
-	vertices[3].position.y = offset[6] * m10 + offset[7] * m11 + y;
+	vertices[0].position.x = offset[0] * bone->m00 + offset[1] * bone->m01 + bone->worldX;
+	vertices[0].position.y = offset[0] * bone->m10 + offset[1] * bone->m11 + bone->worldY;
+	vertices[1].position.x = offset[2] * bone->m00 + offset[3] * bone->m01 + bone->worldX;
+	vertices[1].position.y = offset[2] * bone->m10 + offset[3] * bone->m11 + bone->worldY;
+	vertices[2].position.x = offset[4] * bone->m00 + offset[5] * bone->m01 + bone->worldX;
+	vertices[2].position.y = offset[4] * bone->m10 + offset[5] * bone->m11 + bone->worldY;
+	vertices[3].position.x = offset[6] * bone->m00 + offset[7] * bone->m01 + bone->worldX;
+	vertices[3].position.y = offset[6] * bone->m10 + offset[7] * bone->m11 + bone->worldY;
 }
 
 } /* namespace spine */

+ 9 - 0
spine-cpp/src/spine/Animation.cpp

@@ -35,6 +35,15 @@ void Animation::apply (BaseSkeleton *skeleton, float time, bool loop) {
 		timelines[i]->apply(skeleton, time, 1);
 }
 
+void Animation::mix (BaseSkeleton *skeleton, float time, bool loop, float alpha) {
+	if (!skeleton) throw std::invalid_argument("skeleton cannot be null.");
+
+	if (loop && duration) time = fmodf(time, duration);
+
+	for (int i = 0, n = timelines.size(); i < n; i++)
+		timelines[i]->apply(skeleton, time, alpha);
+}
+
 //
 
 static const float LINEAR = 0;

+ 1 - 0
spine-cpp/src/spine/BaseSkeleton.cpp

@@ -45,6 +45,7 @@ BaseSkeleton::BaseSkeleton (SkeletonData *data) :
 	drawOrder.reserve(slotCount);
 	for (int i = 0; i < slotCount; i++) {
 		SlotData *slotData = data->slots[i];
+		// Find bone for the slotData's boneData.
 		Bone *bone;
 		for (int ii = 0; ii < boneCount; ii++) {
 			if (data->bones[ii] == slotData->boneData) {

+ 2 - 3
spine-libgdx/.classpath

@@ -2,8 +2,7 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="test"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry combineaccessrules="false" exported="true" kind="src" path="/gdx"/>
-	<classpathentry combineaccessrules="false" exported="true" kind="src" path="/gdx-backend-lwjgl"/>
+	<classpathentry combineaccessrules="false" exported="true" kind="src" path="/gdx-backend-jglfw"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

+ 3 - 3
spine-libgdx/.settings/org.eclipse.jdt.core.prefs

@@ -5,9 +5,9 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
 org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
 org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -92,4 +92,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
 org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6

+ 0 - 11
spine-libgdx/src/com/esotericsoftware/spine/Attachment.java

@@ -5,25 +5,14 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 
 abstract public class Attachment {
 	final String name;
-	boolean resolved;
 
 	public Attachment (String name) {
 		if (name == null) throw new IllegalArgumentException("name cannot be null.");
 		this.name = name;
 	}
 
-	abstract public void updateOffset ();
-
 	abstract public void draw (SpriteBatch batch, Slot slot);
 
-	public boolean isResolved () {
-		return resolved;
-	}
-
-	public void setResolved (boolean resolved) {
-		this.resolved = resolved;
-	}
-
 	public String getName () {
 		return name;
 	}

+ 6 - 0
spine-libgdx/src/com/esotericsoftware/spine/AttachmentLoader.java

@@ -0,0 +1,6 @@
+
+package com.esotericsoftware.spine;
+
+public interface AttachmentLoader {
+	public Attachment newAttachment (AttachmentType type, String name);
+}

+ 0 - 6
spine-libgdx/src/com/esotericsoftware/spine/AttachmentResolver.java

@@ -1,6 +0,0 @@
-
-package com.esotericsoftware.spine;
-
-public interface AttachmentResolver {
-	public void resolve (Attachment attachment);
-}

+ 6 - 0
spine-libgdx/src/com/esotericsoftware/spine/AttachmentType.java

@@ -0,0 +1,6 @@
+
+package com.esotericsoftware.spine;
+
+public enum AttachmentType {
+	region, regionSequence
+}

+ 8 - 10
spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java

@@ -1,14 +1,11 @@
 
 package com.esotericsoftware.spine;
 
-import com.esotericsoftware.spine.Skin.Key;
-
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
 import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
 import com.badlogic.gdx.utils.Array;
-import com.badlogic.gdx.utils.ObjectMap.Entry;
 
 public class Skeleton {
 	final SkeletonData data;
@@ -101,11 +98,7 @@ public class Skeleton {
 		for (int i = 0, n = drawOrder.size; i < n; i++) {
 			Slot slot = drawOrder.get(i);
 			Attachment attachment = slot.attachment;
-			if (attachment != null) {
-				if (!attachment.resolved) data.attachmentResolver.resolve(attachment);
-				attachment.updateOffset();
-				attachment.draw(batch, slot);
-			}
+			if (attachment != null) attachment.draw(batch, slot);
 		}
 	}
 
@@ -234,11 +227,16 @@ public class Skeleton {
 	/** @param attachmentName May be null. */
 	public void setAttachment (String slotName, String attachmentName) {
 		if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
-		if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null.");
 		for (int i = 0, n = slots.size; i < n; i++) {
 			Slot slot = slots.get(i);
 			if (slot.data.name.equals(slotName)) {
-				slot.setAttachment(getAttachment(i, attachmentName));
+				Attachment attachment = null;
+				if (attachmentName != null) {
+					attachment = getAttachment(i, attachmentName);
+					if (attachment == null)
+						throw new IllegalArgumentException("Attachment not found: " + attachmentName + ", for slot: " + slotName);
+				}
+				slot.setAttachment(attachment);
 				return;
 			}
 		}

+ 15 - 23
spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java

@@ -11,7 +11,7 @@ import com.esotericsoftware.spine.Animation.TranslateTimeline;
 import com.esotericsoftware.spine.attachments.RegionAttachment;
 import com.esotericsoftware.spine.attachments.RegionSequenceAttachment;
 import com.esotericsoftware.spine.attachments.RegionSequenceAttachment.Mode;
-import com.esotericsoftware.spine.attachments.TextureAtlasAttachmentResolver;
+import com.esotericsoftware.spine.attachments.TextureAtlasAttachmentLoader;
 
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.graphics.Color;
@@ -29,22 +29,19 @@ public class SkeletonBinary {
 	static public final int TIMELINE_ATTACHMENT = 3;
 	static public final int TIMELINE_COLOR = 4;
 
-	static public final int ATTACHMENT_REGION = 0;
-	static public final int ATTACHMENT_REGION_SEQUENCE = 1;
-
 	static public final int CURVE_LINEAR = 0;
 	static public final int CURVE_STEPPED = 1;
 	static public final int CURVE_BEZIER = 2;
 
-	private final AttachmentResolver attachmentResolver;
+	private final AttachmentLoader attachmentLoader;
 	private float scale = 1;
 
 	public SkeletonBinary (TextureAtlas atlas) {
-		attachmentResolver = new TextureAtlasAttachmentResolver(atlas);
+		attachmentLoader = new TextureAtlasAttachmentLoader(atlas);
 	}
 
-	public SkeletonBinary (AttachmentResolver attachmentResolver) {
-		this.attachmentResolver = attachmentResolver;
+	public SkeletonBinary (AttachmentLoader attachmentLoader) {
+		this.attachmentLoader = attachmentLoader;
 	}
 
 	public float getScale () {
@@ -59,7 +56,7 @@ public class SkeletonBinary {
 	public SkeletonData readSkeletonData (FileHandle file) {
 		if (file == null) throw new IllegalArgumentException("file cannot be null.");
 
-		SkeletonData skeletonData = new SkeletonData(attachmentResolver);
+		SkeletonData skeletonData = new SkeletonData();
 		DataInput input = new DataInput(file.read(512));
 		try {
 			// Bones.
@@ -134,19 +131,13 @@ public class SkeletonBinary {
 		String name = input.readString();
 		if (name == null) name = attachmentName;
 
-		Attachment attachment;
-		int type = input.readByte();
-		switch (type) {
-		case ATTACHMENT_REGION:
-			attachment = new RegionAttachment(name);
-			break;
-		case ATTACHMENT_REGION_SEQUENCE:
-			float fps = input.readFloat();
-			Mode mode = Mode.values()[input.readInt(true)];
-			attachment = new RegionSequenceAttachment(name, 1 / fps, mode);
-			break;
-		default:
-			throw new SerializationException("Unknown attachment type: " + type + " (" + name + ")");
+		AttachmentType type = AttachmentType.values()[input.readByte()];
+		Attachment attachment = attachmentLoader.newAttachment(type, name);
+
+		if (attachment instanceof RegionSequenceAttachment) {
+			RegionSequenceAttachment regionSequenceAttachment = (RegionSequenceAttachment)attachment;
+			regionSequenceAttachment.setFrameTime(1 / input.readFloat());
+			regionSequenceAttachment.setMode(Mode.values()[input.readInt(true)]);
 		}
 
 		if (attachment instanceof RegionAttachment) {
@@ -158,8 +149,9 @@ public class SkeletonBinary {
 			regionAttachment.setRotation(input.readFloat());
 			regionAttachment.setWidth(input.readFloat() * scale);
 			regionAttachment.setHeight(input.readFloat() * scale);
+			regionAttachment.updateOffset();
 		}
-		
+
 		return attachment;
 	}
 

+ 0 - 10
spine-libgdx/src/com/esotericsoftware/spine/SkeletonData.java

@@ -8,12 +8,6 @@ public class SkeletonData {
 	final Array<SlotData> slots = new Array(); // Bind pose draw order.
 	final Array<Skin> skins = new Array();
 	Skin defaultSkin;
-	final AttachmentResolver attachmentResolver;
-
-	public SkeletonData (AttachmentResolver attachmentResolver) {
-		if (attachmentResolver == null) throw new IllegalArgumentException("attachmentResolver cannot be null.");
-		this.attachmentResolver = attachmentResolver;
-	}
 
 	public void clear () {
 		bones.clear();
@@ -22,10 +16,6 @@ public class SkeletonData {
 		defaultSkin = null;
 	}
 
-	public AttachmentResolver getAttachmentResolver () {
-		return attachmentResolver;
-	}
-
 	// --- Bones.
 
 	public void addBone (BoneData bone) {

+ 17 - 22
spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java

@@ -8,10 +8,10 @@ import com.esotericsoftware.spine.Animation.RotateTimeline;
 import com.esotericsoftware.spine.Animation.ScaleTimeline;
 import com.esotericsoftware.spine.Animation.Timeline;
 import com.esotericsoftware.spine.Animation.TranslateTimeline;
+import com.esotericsoftware.spine.attachments.RegionAttachment;
 import com.esotericsoftware.spine.attachments.RegionSequenceAttachment;
 import com.esotericsoftware.spine.attachments.RegionSequenceAttachment.Mode;
-import com.esotericsoftware.spine.attachments.RegionAttachment;
-import com.esotericsoftware.spine.attachments.TextureAtlasAttachmentResolver;
+import com.esotericsoftware.spine.attachments.TextureAtlasAttachmentLoader;
 
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.graphics.Color;
@@ -29,19 +29,16 @@ public class SkeletonJson {
 	static public final String TIMELINE_ATTACHMENT = "attachment";
 	static public final String TIMELINE_COLOR = "color";
 
-	static public final String ATTACHMENT_REGION = "region";
-	static public final String ATTACHMENT_REGION_SEQUENCE = "regionSequence";
-
 	private final Json json = new Json();
-	private final AttachmentResolver attachmentResolver;
+	private final AttachmentLoader attachmentLoader;
 	private float scale = 1;
 
 	public SkeletonJson (TextureAtlas atlas) {
-		attachmentResolver = new TextureAtlasAttachmentResolver(atlas);
+		attachmentLoader = new TextureAtlasAttachmentLoader(atlas);
 	}
 
-	public SkeletonJson (AttachmentResolver attachmentResolver) {
-		this.attachmentResolver = attachmentResolver;
+	public SkeletonJson (AttachmentLoader attachmentLoader) {
+		this.attachmentLoader = attachmentLoader;
 	}
 
 	public float getScale () {
@@ -56,7 +53,7 @@ public class SkeletonJson {
 	public SkeletonData readSkeletonData (FileHandle file) {
 		if (file == null) throw new IllegalArgumentException("file cannot be null.");
 
-		SkeletonData skeletonData = new SkeletonData(attachmentResolver);
+		SkeletonData skeletonData = new SkeletonData();
 
 		OrderedMap<String, ?> root = json.fromJson(OrderedMap.class, file);
 
@@ -122,23 +119,20 @@ public class SkeletonJson {
 
 	private Attachment readAttachment (String name, OrderedMap map) {
 		name = (String)map.get("name", name);
-		Attachment attachment;
-		String type = (String)map.get("type");
-		if (type == null) type = ATTACHMENT_REGION;
-		if (type.equals(ATTACHMENT_REGION)) {
-			attachment = new RegionAttachment(name);
 
-		} else if (type.equals(ATTACHMENT_REGION_SEQUENCE)) {
+		AttachmentType type = AttachmentType.valueOf((String)map.get("type", AttachmentType.region.name()));
+		Attachment attachment = attachmentLoader.newAttachment(type, name);
+
+		if (attachment instanceof RegionSequenceAttachment) {
+			RegionSequenceAttachment regionSequenceAttachment = (RegionSequenceAttachment)attachment;
+
 			Float fps = (Float)map.get("fps");
 			if (fps == null) throw new SerializationException("Region sequence attachment missing fps: " + name);
+			regionSequenceAttachment.setFrameTime(fps);
 
 			String modeString = (String)map.get("mode");
-			Mode mode = modeString == null ? Mode.forward : Mode.valueOf(modeString);
-
-			attachment = new RegionSequenceAttachment(name, 1 / fps, mode);
-
-		} else
-			throw new SerializationException("Unknown attachment type: " + type + " (" + name + ")");
+			regionSequenceAttachment.setMode(modeString == null ? Mode.forward : Mode.valueOf(modeString));
+		}
 
 		if (attachment instanceof RegionAttachment) {
 			RegionAttachment regionAttachment = (RegionAttachment)attachment;
@@ -149,6 +143,7 @@ public class SkeletonJson {
 			regionAttachment.setRotation(getFloat(map, "rotation", 0));
 			regionAttachment.setWidth(getFloat(map, "width", 32) * scale);
 			regionAttachment.setHeight(getFloat(map, "height", 32) * scale);
+			regionAttachment.updateOffset();
 		}
 
 		return attachment;

+ 11 - 7
spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionSequenceAttachment.java

@@ -9,17 +9,12 @@ import com.badlogic.gdx.math.MathUtils;
 
 /** Attachment that displays various texture regions over time. */
 public class RegionSequenceAttachment extends RegionAttachment {
-	private final Mode mode;
+	private Mode mode;
 	private float frameTime;
 	private TextureRegion[] regions;
 
-	/** @param frameTime Time in seconds each frame is shown. */
-	public RegionSequenceAttachment (String name, float frameTime, Mode mode) {
+	public RegionSequenceAttachment (String name) {
 		super(name);
-		if (mode == null) throw new IllegalArgumentException("mode cannot be null.");
-
-		this.frameTime = frameTime;
-		this.mode = mode;
 	}
 
 	public void draw (SpriteBatch batch, Slot slot) {
@@ -62,6 +57,15 @@ public class RegionSequenceAttachment extends RegionAttachment {
 		this.regions = regions;
 	}
 
+	/** Sets the time in seconds each frame is shown. */
+	public void setFrameTime (float frameTime) {
+		this.frameTime = frameTime;
+	}
+
+	public void setMode (Mode mode) {
+		this.mode = mode;
+	}
+
 	static public enum Mode {
 		forward, backward, forwardLoop, backwardLoop, pingPong, random
 	}

+ 41 - 0
spine-libgdx/src/com/esotericsoftware/spine/attachments/TextureAtlasAttachmentLoader.java

@@ -0,0 +1,41 @@
+
+package com.esotericsoftware.spine.attachments;
+
+import com.esotericsoftware.spine.Attachment;
+import com.esotericsoftware.spine.AttachmentLoader;
+import com.esotericsoftware.spine.AttachmentType;
+
+import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
+
+public class TextureAtlasAttachmentLoader implements AttachmentLoader {
+	private TextureAtlas atlas;
+
+	public TextureAtlasAttachmentLoader (TextureAtlas atlas) {
+		if (atlas == null) throw new IllegalArgumentException("atlas cannot be null.");
+		this.atlas = atlas;
+	}
+
+	public Attachment newAttachment (AttachmentType type, String name) {
+		Attachment attachment = null;
+		switch (type) {
+		case region:
+			attachment = new RegionAttachment(name);
+			break;
+		case regionSequence:
+			attachment = new RegionAttachment(name);
+			break;
+		default:
+			throw new IllegalArgumentException("Unknown attachment type: " + type);
+		}
+
+		if (attachment instanceof RegionAttachment) {
+			AtlasRegion region = atlas.findRegion(attachment.getName());
+			if (region == null)
+				throw new RuntimeException("Region not found in atlas: " + attachment + " (" + type + " attachment: " + name + ")");
+			((RegionAttachment)attachment).setRegion(region);
+		}
+
+		return attachment;
+	}
+}

+ 0 - 29
spine-libgdx/src/com/esotericsoftware/spine/attachments/TextureAtlasAttachmentResolver.java

@@ -1,29 +0,0 @@
-
-package com.esotericsoftware.spine.attachments;
-
-import com.esotericsoftware.spine.Attachment;
-import com.esotericsoftware.spine.AttachmentResolver;
-
-import com.badlogic.gdx.graphics.g2d.TextureAtlas;
-import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
-
-public class TextureAtlasAttachmentResolver implements AttachmentResolver {
-	private TextureAtlas atlas;
-
-	public TextureAtlasAttachmentResolver (TextureAtlas atlas) {
-		if (atlas == null) throw new IllegalArgumentException("atlas cannot be null.");
-		this.atlas = atlas;
-	}
-
-	public void resolve (Attachment attachment) {
-		if (attachment instanceof RegionAttachment) {
-			AtlasRegion region = atlas.findRegion(attachment.getName());
-			if (region == null) throw new RuntimeException("Region not found in atlas: " + attachment);
-			((RegionAttachment)attachment).setRegion(region);
-			attachment.setResolved(true);
-			return;
-		}
-
-		throw new IllegalArgumentException("Unable to resolve attachment of type: " + attachment.getClass().getName());
-	}
-}

+ 4 - 6
spine-libgdx/test/com/esotericsoftware/spine/MixTest.java

@@ -3,10 +3,8 @@ package com.esotericsoftware.spine;
 
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.Input.Keys;
-import com.badlogic.gdx.InputAdapter;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
+import com.badlogic.gdx.backends.jglfw.JglfwApplication;
+import com.badlogic.gdx.backends.jglfw.JglfwApplicationConfiguration;
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.g2d.SpriteBatch;
@@ -115,10 +113,10 @@ public class MixTest extends ApplicationAdapter {
 	}
 
 	public static void main (String[] args) throws Exception {
-		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
+		JglfwApplicationConfiguration config = new JglfwApplicationConfiguration();
 		config.title = "Mix Test";
 		config.width = 640;
 		config.height = 480;
-		new LwjglApplication(new MixTest(), config);
+		new JglfwApplication(new MixTest(), config);
 	}
 }

+ 4 - 4
spine-libgdx/test/com/esotericsoftware/spine/SkeletonTest.java

@@ -5,8 +5,8 @@ import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.Input.Keys;
 import com.badlogic.gdx.InputAdapter;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
+import com.badlogic.gdx.backends.jglfw.JglfwApplication;
+import com.badlogic.gdx.backends.jglfw.JglfwApplicationConfiguration;
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.GL10;
@@ -114,10 +114,10 @@ public class SkeletonTest extends ApplicationAdapter {
 	}
 
 	public static void main (String[] args) throws Exception {
-		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
+		JglfwApplicationConfiguration config = new JglfwApplicationConfiguration();
 		config.title = "Skeleton Test";
 		config.width = 640;
 		config.height = 480;
-		new LwjglApplication(new SkeletonTest(), config);
+		new JglfwApplication(new SkeletonTest(), config);
 	}
 }

+ 0 - 3
spine-libgdx/test/spineboy-skeleton.json

@@ -41,9 +41,6 @@
 ],
 "skins": {
 	"default": {
-		"template": {
-			"spineboy": { "y": 167.82, "width": 145, "height": 341 }
-		},
 		"left shoulder": {
 			"left-shoulder": { "x": 23.74, "y": 0.11, "rotation": 62.01, "width": 34, "height": 53 }
 		},