mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
TextureRegionAttachment -> HasTextureRegion.
This commit is contained in:
parent
f4e893ef88
commit
920604dff7
@ -87,7 +87,7 @@ import com.esotericsoftware.spine.attachments.PointAttachment;
|
|||||||
import com.esotericsoftware.spine.attachments.RegionAttachment;
|
import com.esotericsoftware.spine.attachments.RegionAttachment;
|
||||||
import com.esotericsoftware.spine.attachments.SequenceAttachment;
|
import com.esotericsoftware.spine.attachments.SequenceAttachment;
|
||||||
import com.esotericsoftware.spine.attachments.SequenceAttachment.SequenceMode;
|
import com.esotericsoftware.spine.attachments.SequenceAttachment.SequenceMode;
|
||||||
import com.esotericsoftware.spine.attachments.TextureRegionAttachment;
|
import com.esotericsoftware.spine.attachments.HasTextureRegion;
|
||||||
import com.esotericsoftware.spine.attachments.VertexAttachment;
|
import com.esotericsoftware.spine.attachments.VertexAttachment;
|
||||||
|
|
||||||
/** Loads skeleton data in the Spine binary format.
|
/** Loads skeleton data in the Spine binary format.
|
||||||
@ -543,7 +543,7 @@ public class SkeletonBinary extends SkeletonLoader {
|
|||||||
SequenceMode mode = SequenceMode.values[input.readInt(true)];
|
SequenceMode mode = SequenceMode.values[input.readInt(true)];
|
||||||
|
|
||||||
if (attachment == null) return null;
|
if (attachment == null) return null;
|
||||||
String path = ((TextureRegionAttachment)attachment).getPath();
|
String path = ((HasTextureRegion)attachment).getPath();
|
||||||
|
|
||||||
SequenceAttachment sequence = attachmentLoader.newSequenceAttachment(skin, name, path, frameCount);
|
SequenceAttachment sequence = attachmentLoader.newSequenceAttachment(skin, name, path, frameCount);
|
||||||
if (sequence == null) return null;
|
if (sequence == null) return null;
|
||||||
|
|||||||
@ -86,7 +86,7 @@ import com.esotericsoftware.spine.attachments.PointAttachment;
|
|||||||
import com.esotericsoftware.spine.attachments.RegionAttachment;
|
import com.esotericsoftware.spine.attachments.RegionAttachment;
|
||||||
import com.esotericsoftware.spine.attachments.SequenceAttachment;
|
import com.esotericsoftware.spine.attachments.SequenceAttachment;
|
||||||
import com.esotericsoftware.spine.attachments.SequenceAttachment.SequenceMode;
|
import com.esotericsoftware.spine.attachments.SequenceAttachment.SequenceMode;
|
||||||
import com.esotericsoftware.spine.attachments.TextureRegionAttachment;
|
import com.esotericsoftware.spine.attachments.HasTextureRegion;
|
||||||
import com.esotericsoftware.spine.attachments.VertexAttachment;
|
import com.esotericsoftware.spine.attachments.VertexAttachment;
|
||||||
|
|
||||||
/** Loads skeleton data in the Spine JSON format.
|
/** Loads skeleton data in the Spine JSON format.
|
||||||
@ -475,7 +475,7 @@ public class SkeletonJson extends SkeletonLoader {
|
|||||||
case sequence:
|
case sequence:
|
||||||
Attachment attachment = readAttachment(map.getChild("attachment"), skin, slotIndex, name, skeletonData);
|
Attachment attachment = readAttachment(map.getChild("attachment"), skin, slotIndex, name, skeletonData);
|
||||||
if (attachment == null) return null;
|
if (attachment == null) return null;
|
||||||
String path = ((TextureRegionAttachment)attachment).getPath();
|
String path = ((HasTextureRegion)attachment).getPath();
|
||||||
int frameCount = map.getInt("count");
|
int frameCount = map.getInt("count");
|
||||||
SequenceAttachment sequence = attachmentLoader.newSequenceAttachment(skin, name, path, frameCount);
|
SequenceAttachment sequence = attachmentLoader.newSequenceAttachment(skin, name, path, frameCount);
|
||||||
if (sequence == null) return null;
|
if (sequence == null) return null;
|
||||||
|
|||||||
@ -4,7 +4,12 @@ package com.esotericsoftware.spine.attachments;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
|
||||||
public interface TextureRegionAttachment {
|
public interface HasTextureRegion {
|
||||||
|
/** The name used to find the {@link #getRegion()}. */
|
||||||
|
public String getPath ();
|
||||||
|
|
||||||
|
public void setPath (String path);
|
||||||
|
|
||||||
/** Sets the region used to draw the attachment. If the region or its properties are changed, {@link #updateRegion()} must be
|
/** Sets the region used to draw the attachment. If the region or its properties are changed, {@link #updateRegion()} must be
|
||||||
* called. */
|
* called. */
|
||||||
public void setRegion (TextureRegion region);
|
public void setRegion (TextureRegion region);
|
||||||
@ -17,9 +22,4 @@ public interface TextureRegionAttachment {
|
|||||||
|
|
||||||
/** The color to tint the attachment. */
|
/** The color to tint the attachment. */
|
||||||
public Color getColor ();
|
public Color getColor ();
|
||||||
|
|
||||||
/** The name used to find the {@link #getRegion()}. */
|
|
||||||
public String getPath ();
|
|
||||||
|
|
||||||
public void setPath (String path);
|
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ import com.badlogic.gdx.utils.Null;
|
|||||||
* supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh.
|
* supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh.
|
||||||
* <p>
|
* <p>
|
||||||
* See <a href="http://esotericsoftware.com/spine-meshes">Mesh attachments</a> in the Spine User Guide. */
|
* See <a href="http://esotericsoftware.com/spine-meshes">Mesh attachments</a> in the Spine User Guide. */
|
||||||
public class MeshAttachment extends VertexAttachment implements TextureRegionAttachment {
|
public class MeshAttachment extends VertexAttachment implements HasTextureRegion {
|
||||||
private TextureRegion region;
|
private TextureRegion region;
|
||||||
private String path;
|
private String path;
|
||||||
private float[] regionUVs, uvs;
|
private float[] regionUVs, uvs;
|
||||||
|
|||||||
@ -40,7 +40,7 @@ import com.esotericsoftware.spine.Bone;
|
|||||||
/** An attachment that displays a textured quadrilateral.
|
/** An attachment that displays a textured quadrilateral.
|
||||||
* <p>
|
* <p>
|
||||||
* See <a href="http://esotericsoftware.com/spine-regions">Region attachments</a> in the Spine User Guide. */
|
* See <a href="http://esotericsoftware.com/spine-regions">Region attachments</a> in the Spine User Guide. */
|
||||||
public class RegionAttachment extends Attachment implements TextureRegionAttachment {
|
public class RegionAttachment extends Attachment implements HasTextureRegion {
|
||||||
static public final int BLX = 0;
|
static public final int BLX = 0;
|
||||||
static public final int BLY = 1;
|
static public final int BLY = 1;
|
||||||
static public final int ULX = 2;
|
static public final int ULX = 2;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ import com.esotericsoftware.spine.Slot;
|
|||||||
/** An attachment that applies a sequence of texture atlas regions to a region or mesh attachment.
|
/** An attachment that applies a sequence of texture atlas regions to a region or mesh attachment.
|
||||||
* <p>
|
* <p>
|
||||||
* See <a href="http://esotericsoftware.com/spine-sequences">Sequence attachments</a> in the Spine User Guide. */
|
* See <a href="http://esotericsoftware.com/spine-sequences">Sequence attachments</a> in the Spine User Guide. */
|
||||||
public class SequenceAttachment<T extends Attachment & TextureRegionAttachment> extends Attachment {
|
public class SequenceAttachment<T extends Attachment & HasTextureRegion> extends Attachment {
|
||||||
private T attachment;
|
private T attachment;
|
||||||
private String path;
|
private String path;
|
||||||
private int frameCount;
|
private int frameCount;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user