[libgdx] Javadoc.

This commit is contained in:
Nathan Sweet 2026-03-24 20:02:18 -04:00
parent dffbc043f1
commit ca5ff77a8f
21 changed files with 111 additions and 48 deletions

View File

@ -91,13 +91,13 @@ public class BonePose implements Pose<BonePose>, Update {
this.scaleY = scaleY;
}
/** Sets local x and y scale. */
/** Sets local scaleX and scaleY. */
public void setScale (float scaleX, float scaleY) {
this.scaleX = scaleX;
this.scaleY = scaleY;
}
/** Sets local x and y scale to the same value. */
/** Sets local scaleX and scaleY to the same value. */
public void setScale (float scale) {
scaleX = scale;
scaleY = scale;

View File

@ -29,10 +29,11 @@
package com.esotericsoftware.spine;
import com.esotericsoftware.spine.Animation.EventTimeline;
import com.esotericsoftware.spine.Animation.Timeline;
import com.esotericsoftware.spine.AnimationState.AnimationStateListener;
/** Stores the current pose values for an {@link Event}.
/** Fired by {@link EventTimeline} when specific animation times are reached.
* <p>
* See {@link Timeline#apply(Skeleton, float, float, com.badlogic.gdx.utils.Array, float, boolean, boolean, boolean, boolean)},
* {@link AnimationStateListener#event(com.esotericsoftware.spine.AnimationState.TrackEntry, Event)}, and

View File

@ -29,6 +29,8 @@
package com.esotericsoftware.spine;
import com.badlogic.gdx.utils.Null;
/** Stores the setup pose values for an {@link Event}.
* <p>
* See <a href="https://esotericsoftware.com/spine-events">Events</a> in the Spine User Guide. */
@ -36,7 +38,8 @@ public class EventData {
final String name;
int intValue;
float floatValue;
String stringValue, audioPath;
String stringValue;
@Null String audioPath;
float volume, balance;
public EventData (String name) {
@ -69,15 +72,17 @@ public class EventData {
this.stringValue = stringValue;
}
public String getAudioPath () {
/** Path to an audio file relative to the audio path in the Spine project. */
public @Null String getAudioPath () {
return audioPath;
}
public void setAudioPath (String audioPath) {
public void setAudioPath (@Null String audioPath) {
if (audioPath == null) throw new IllegalArgumentException("audioPath cannot be null.");
this.audioPath = audioPath;
}
/** If an audio path is set, the volume for the audio. */
public float getVolume () {
return volume;
}
@ -86,6 +91,7 @@ public class EventData {
this.volume = volume;
}
/** If an audio path is set, the left/right balance for the audio. */
public float getBalance () {
return balance;
}

View File

@ -35,8 +35,8 @@ import com.badlogic.gdx.utils.Array;
import com.esotericsoftware.spine.BoneData.Inherit;
/** Stores the current pose for an IK constraint. An IK constraint adjusts the rotation of 1 or 2 constrained bones so the tip of
* the last bone is as close to the target bone as possible.
/** Adjusts the local rotation of 1 or 2 constrained bones so the world position of the tip of the last bone is as close to the
* target bone as possible.
* <p>
* See <a href="https://esotericsoftware.com/spine-ik-constraints">IK constraints</a> in the Spine User Guide. */
public class IkConstraint extends Constraint<IkConstraint, IkConstraintData, IkConstraintPose> {

View File

@ -43,8 +43,7 @@ import com.esotericsoftware.spine.Skin.SkinEntry;
import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.PathAttachment;
/** Stores the current pose for a path constraint. A path constraint adjusts the rotation, translation, and scale of the
* constrained bones so they follow a {@link PathAttachment}.
/** Adjusts the rotation, translation, and scale of the constrained bones so they follow a {@link PathAttachment}.
* <p>
* See <a href="https://esotericsoftware.com/spine-path-constraints">Path constraints</a> in the Spine User Guide. */
public class PathConstraint extends Constraint<PathConstraint, PathConstraintData, PathConstraintPose> {

View File

@ -31,7 +31,7 @@ package com.esotericsoftware.spine;
import static com.esotericsoftware.spine.utils.SpineUtils.*;
/** Stores the current pose for a physics constraint. A physics constraint applies physics to bones.
/** Applies physics to a bone.
* <p>
* See <a href="https://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsConstraintData, PhysicsConstraintPose> {
@ -58,6 +58,8 @@ public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
return copy;
}
/** Resets all physics state that was the result of previous movement. Use this after moving a bone to prevent physics from
* reacting to the movement. */
public void reset (Skeleton skeleton) {
remaining = 0;
lastTime = skeleton.time;
@ -76,7 +78,7 @@ public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
scaleVelocity = 0;
}
/** Translates the physics constraint so next {@link #update(Skeleton, Physics)} forces are applied as if the bone moved an
/** Translates the physics constraint so the next {@link #update(Skeleton, Physics)} forces are applied as if the bone moved an
* additional amount in world space. */
public void translate (float x, float y) {
ux -= x;
@ -85,8 +87,8 @@ public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
cy -= y;
}
/** Rotates the physics constraint so next {@link #update(Skeleton, Physics)} forces are applied as if the bone rotated around
* the specified point in world space. */
/** Rotates the physics constraint so the next {@link #update(Skeleton, Physics)} forces are applied as if the bone rotated
* around the specified point in world space. */
public void rotate (float x, float y, float degrees) {
float r = degrees * degRad, cos = cos(r), sin = sin(r);
float dx = cx - x, dy = cy - y;

View File

@ -54,6 +54,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.bone = bone;
}
/** The time in milliseconds required to advanced the physics simulation one step. */
public float getStep () {
return step;
}
@ -62,6 +63,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.step = step;
}
/** Physics influence on x translation, 0-1. */
public float getX () {
return x;
}
@ -70,6 +72,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.x = x;
}
/** Physics influence on y translation, 0-1. */
public float getY () {
return y;
}
@ -78,6 +81,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.y = y;
}
/** Physics influence on rotation, 0-1. */
public float getRotate () {
return rotate;
}
@ -86,6 +90,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.rotate = rotate;
}
/** Physics influence on scaleX, 0-1. */
public float getScaleX () {
return scaleX;
}
@ -94,6 +99,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.scaleX = scaleX;
}
/** Physics influence on shearX, 0-1. */
public float getShearX () {
return shearX;
}
@ -102,6 +108,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.shearX = shearX;
}
/** Movement greater than the limit will not have a greater affect on physics. */
public float getLimit () {
return limit;
}
@ -110,6 +117,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.limit = limit;
}
/** True when this constraint's inertia is controlled by global slider timelines. */
public boolean getInertiaGlobal () {
return inertiaGlobal;
}
@ -118,6 +126,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.inertiaGlobal = inertiaGlobal;
}
/** True when this constraint's strength is controlled by global slider timelines. */
public boolean getStrengthGlobal () {
return strengthGlobal;
}
@ -126,6 +135,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.strengthGlobal = strengthGlobal;
}
/** True when this constraint's damping is controlled by global slider timelines. */
public boolean getDampingGlobal () {
return dampingGlobal;
}
@ -134,6 +144,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.dampingGlobal = dampingGlobal;
}
/** True when this constraint's mass is controlled by global slider timelines. */
public boolean getMassGlobal () {
return massGlobal;
}
@ -142,6 +153,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.massGlobal = massGlobal;
}
/** True when this constraint's wind is controlled by global slider timelines. */
public boolean getWindGlobal () {
return windGlobal;
}
@ -150,6 +162,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.windGlobal = windGlobal;
}
/** True when this constraint's gravity is controlled by global slider timelines. */
public boolean getGravityGlobal () {
return gravityGlobal;
}
@ -158,6 +171,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.gravityGlobal = gravityGlobal;
}
/** True when this constraint's mix is controlled by global slider timelines. */
public boolean getMixGlobal () {
return mixGlobal;
}

View File

@ -43,6 +43,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
mix = pose.mix;
}
/** Controls how much bone movement is converted into physics movement. */
public float getInertia () {
return inertia;
}
@ -51,6 +52,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.inertia = inertia;
}
/** The amount of force used to return properties to the unconstrained value. */
public float getStrength () {
return strength;
}
@ -59,6 +61,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.strength = strength;
}
/** Reduces the speed of physics movements, with more of a reduction at higher speeds. */
public float getDamping () {
return damping;
}
@ -67,6 +70,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.damping = damping;
}
/** Determines susceptibility to acceleration. */
public float getMassInverse () {
return massInverse;
}
@ -75,6 +79,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.massInverse = massInverse;
}
/** Applies a constant force along the world X axis. */
public float getWind () {
return wind;
}
@ -83,6 +88,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.wind = wind;
}
/** Applies a constant force along the world Y axis. */
public float getGravity () {
return gravity;
}
@ -91,7 +97,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.gravity = gravity;
}
/** A percentage (0-1) that controls the mix between the constrained and unconstrained poses. */
/** A percentage (0+) that controls the mix between the constrained and unconstrained poses. */
public float getMix () {
return mix;
}

View File

@ -45,6 +45,7 @@ abstract public class PosedData<P extends Pose> {
return name;
}
/** The setup pose that most animations are relative to. */
public P getSetupPose () {
return setup;
}

View File

@ -408,38 +408,38 @@ public class Skeleton {
* name.
* <p>
* See {@link #getAttachment(int, String)}. */
public @Null Attachment getAttachment (String slotName, String attachmentName) {
public @Null Attachment getAttachment (String slotName, String placeholderName) {
SlotData slot = data.findSlot(slotName);
if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName);
return getAttachment(slot.getIndex(), attachmentName);
return getAttachment(slot.getIndex(), placeholderName);
}
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and skin
* placeholder name. First the skin is checked and if the attachment was not found, the default skin is checked.
* <p>
* See <a href="https://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide. */
public @Null Attachment getAttachment (int slotIndex, String attachmentName) {
if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null.");
public @Null Attachment getAttachment (int slotIndex, String placeholderName) {
if (placeholderName == null) throw new IllegalArgumentException("placeholderName cannot be null.");
if (skin != null) {
Attachment attachment = skin.getAttachment(slotIndex, attachmentName);
Attachment attachment = skin.getAttachment(slotIndex, placeholderName);
if (attachment != null) return attachment;
}
if (data.defaultSkin != null) return data.defaultSkin.getAttachment(slotIndex, attachmentName);
if (data.defaultSkin != null) return data.defaultSkin.getAttachment(slotIndex, placeholderName);
return null;
}
/** A convenience method to set an attachment by finding the slot with {@link #findSlot(String)}, finding the attachment with
* {@link #getAttachment(int, String)}, then setting the slot's {@link SlotPose#attachment}.
* @param attachmentName May be null to clear the slot's attachment. */
public void setAttachment (String slotName, @Null String attachmentName) {
* @param placeholderName May be null to clear the slot's attachment. */
public void setAttachment (String slotName, @Null String placeholderName) {
if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
Slot slot = findSlot(slotName);
if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName);
Attachment attachment = null;
if (attachmentName != null) {
attachment = getAttachment(slot.data.index, attachmentName);
if (placeholderName != null) {
attachment = getAttachment(slot.data.index, placeholderName);
if (attachment == null)
throw new IllegalArgumentException("Attachment not found: " + attachmentName + ", for slot: " + slotName);
throw new IllegalArgumentException("Attachment not found: " + placeholderName + ", for slot: " + slotName);
}
slot.pose.setAttachment(attachment);
}
@ -449,10 +449,13 @@ public class Skeleton {
return constraints;
}
/** The skeleton's physics constraints. */
public Array<PhysicsConstraint> getPhysicsConstraints () {
return physics;
}
/** Finds a constraint of the specified type by comparing each constraints's name. It is more efficient to cache the results of
* this method than to call it multiple times. */
public @Null <T extends Constraint> T findConstraint (String constraintName, Class<T> type) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
@ -604,6 +607,7 @@ public class Skeleton {
this.y = y;
}
/** The x component of a vector that defines the direction {@link PhysicsConstraintPose#getWind()} is applied. */
public float getWindX () {
return windX;
}
@ -612,6 +616,7 @@ public class Skeleton {
this.windX = windX;
}
/** The y component of a vector that defines the direction {@link PhysicsConstraintPose#getWind()} is applied. */
public float getWindY () {
return windY;
}
@ -620,6 +625,7 @@ public class Skeleton {
this.windY = windY;
}
/** The x component of a vector that defines the direction {@link PhysicsConstraintPose#getGravity()} is applied. */
public float getGravityX () {
return gravityX;
}
@ -628,6 +634,7 @@ public class Skeleton {
this.gravityX = gravityX;
}
/** The y component of a vector that defines the direction {@link PhysicsConstraintPose#getGravity()} is applied. */
public float getGravityY () {
return gravityY;
}

View File

@ -168,6 +168,8 @@ public class SkeletonData {
return constraints;
}
/** Finds a constraint of the specified type by comparing each constraints's name. It is more efficient to cache the results of
* this method than to call it multiple times. */
public @Null <T extends ConstraintData> T findConstraint (String constraintName, Class<T> type) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
@ -255,7 +257,7 @@ public class SkeletonData {
this.hash = hash;
}
/** The path to the images directory as defined in Spine, or null if nonessential data was not exported. */
/** The path to the images folder as defined in Spine, or null if nonessential data was not exported. */
public @Null String getImagesPath () {
return imagesPath;
}
@ -264,7 +266,7 @@ public class SkeletonData {
this.imagesPath = imagesPath;
}
/** The path to the audio directory as defined in Spine, or null if nonessential data was not exported. */
/** The path to the audio folder as defined in Spine, or null if nonessential data was not exported. */
public @Null String getAudioPath () {
return audioPath;
}

View File

@ -186,6 +186,7 @@ public class Skin {
hashCode = placeholderName.hashCode() + slotIndex * 37;
}
/** The {@link Skeleton#getSlots()} index. */
public int getSlotIndex () {
return slotIndex;
}
@ -195,6 +196,7 @@ public class Skin {
return placeholderName;
}
/** The attachment for this skin entry. */
public Attachment getAttachment () {
return attachment;
}

View File

@ -34,9 +34,9 @@ import com.esotericsoftware.spine.Animation.PhysicsConstraintTimeline;
import com.esotericsoftware.spine.Animation.SlotTimeline;
import com.esotericsoftware.spine.Animation.Timeline;
/** Stores the setup pose for a {@link PhysicsConstraint}.
/** Applies an animation based on either the slider's {@link SliderPose#time} or a bone's transform property.
* <p>
* See <a href="https://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
* See <a href="https://esotericsoftware.com/spine-sliders">Sliders</a> in the Spine User Guide. */
public class Slider extends Constraint<Slider, SliderData, SliderPose> {
static private final float[] offsets = new float[6];
@ -114,6 +114,7 @@ public class Slider extends Constraint<Slider, SliderData, SliderPose> {
}
}
/** When set, the bone's transform property is used to set the slider's {@link SliderPose#time}. */
public Bone getBone () {
return bone;
}

View File

@ -50,6 +50,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
return new Slider(this, skeleton);
}
/** The animation the slider will apply. */
public Animation getAnimation () {
return animation;
}
@ -58,6 +59,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.animation = animation;
}
/** When true, the animation is applied by adding it to the current pose rather than overwriting it. */
public boolean getAdditive () {
return additive;
}
@ -66,6 +68,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.additive = additive;
}
/** When true, the animation repeats after its duration, otherwise the last frame is used. */
public boolean getLoop () {
return loop;
}
@ -74,6 +77,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.loop = loop;
}
/** When set, the bone's transform property is used to set the slider's {@link SliderPose#time}. */
public @Null BoneData getBone () {
return bone;
}
@ -82,6 +86,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.bone = bone;
}
/** When a bone is set, the specified transform property is used to set the slider's {@link SliderPose#time}. */
public @Null FromProperty getProperty () {
return property;
}
@ -90,6 +95,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.property = property;
}
/** When a bone is set, the offset is added to the property. */
public float getOffset () {
return offset;
}
@ -98,6 +104,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.offset = offset;
}
/** When a bone is set, this is the scale of the {@link #property} value in relation to the slider time. */
public float getScale () {
return scale;
}
@ -106,6 +113,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.scale = scale;
}
/** When true and a bone is set, the bone's local transform property is read instead of its world transform. */
public boolean getLocal () {
return local;
}

View File

@ -38,6 +38,7 @@ public class SliderPose implements Pose<SliderPose> {
mix = pose.mix;
}
/** The time in the {@link SliderData#animation} to apply the animation. */
public float getTime () {
return time;
}
@ -46,6 +47,7 @@ public class SliderPose implements Pose<SliderPose> {
this.time = time;
}
/** A percentage that controls the mix between the constrained and unconstrained poses. */
public float getMix () {
return mix;
}

View File

@ -31,9 +31,10 @@ package com.esotericsoftware.spine;
import com.badlogic.gdx.graphics.Color;
/** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store
* state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared
* across multiple skeletons. */
/** Organizes attachments for {@link Skeleton#drawOrder} purposes and provide a place to store state for an attachment.
* <p>
* State cannot be stored in an attachment itself because attachments are stateless and may be shared across multiple
* skeletons. */
public class Slot extends Posed<SlotData, SlotPose> {
final Skeleton skeleton;
final Bone bone;

View File

@ -38,9 +38,7 @@ import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.Sequence;
import com.esotericsoftware.spine.attachments.VertexAttachment;
/** Stores a slot's pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store state
* for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared across
* multiple skeletons. */
/** Stores a slot's pose. */
public class SlotPose implements Pose<SlotPose> {
final Color color = new Color(1, 1, 1, 1);
@Null Color darkColor;

View File

@ -36,8 +36,7 @@ import com.badlogic.gdx.utils.Array;
import com.esotericsoftware.spine.TransformConstraintData.FromProperty;
import com.esotericsoftware.spine.TransformConstraintData.ToProperty;
/** Stores the current pose for a transform constraint. A transform constraint adjusts the world transform of the constrained
* bones to match that of the source bone.
/** Adjusts the world transform of the constrained bones to match that of the source bone.
* <p>
* See <a href="https://esotericsoftware.com/spine-transform-constraints">Transform constraints</a> in the Spine User Guide. */
public class TransformConstraint extends Constraint<TransformConstraint, TransformConstraintData, TransformConstraintPose> {

View File

@ -42,7 +42,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
mixShearY = pose.mixShearY;
}
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotation. */
/** A percentage that controls the mix between the constrained and unconstrained rotation. */
public float getMixRotate () {
return mixRotate;
}
@ -51,7 +51,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixRotate = mixRotate;
}
/** A percentage (0-1) that controls the mix between the constrained and unconstrained translation X. */
/** A percentage that controls the mix between the constrained and unconstrained translation X. */
public float getMixX () {
return mixX;
}
@ -60,7 +60,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixX = mixX;
}
/** A percentage (0-1) that controls the mix between the constrained and unconstrained translation Y. */
/** A percentage that controls the mix between the constrained and unconstrained translation Y. */
public float getMixY () {
return mixY;
}
@ -69,7 +69,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixY = mixY;
}
/** A percentage (0-1) that controls the mix between the constrained and unconstrained scale X. */
/** A percentage that controls the mix between the constrained and unconstrained scale X. */
public float getMixScaleX () {
return mixScaleX;
}
@ -78,7 +78,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixScaleX = mixScaleX;
}
/** A percentage (0-1) that controls the mix between the constrained and unconstrained scale X. */
/** A percentage that controls the mix between the constrained and unconstrained scale X. */
public float getMixScaleY () {
return mixScaleY;
}
@ -87,7 +87,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixScaleY = mixScaleY;
}
/** A percentage (0-1) that controls the mix between the constrained and unconstrained shear Y. */
/** A percentage that controls the mix between the constrained and unconstrained shear Y. */
public float getMixShearY () {
return mixShearY;
}

View File

@ -60,7 +60,7 @@ public class PointAttachment extends Attachment {
color.set(other.color);
}
/** The local X position. */
/** The local x position. */
public float getX () {
return x;
}
@ -69,7 +69,7 @@ public class PointAttachment extends Attachment {
this.x = x;
}
/** The local Y position. */
/** The local y position. */
public float getY () {
return y;
}

View File

@ -46,6 +46,9 @@ public class Sequence {
private float[][] uvs, offsets;
private int start, digits, setupIndex;
/** @param count The number of texture regions this sequence will display.
* @param pathSuffix If true, the {@link #getPath(String, int) path} has a numeric suffix. If false, all regions will use the
* same path, so <code>count</code> should be 1. */
public Sequence (int count, boolean pathSuffix) {
regions = new TextureRegion[count];
this.pathSuffix = pathSuffix;
@ -95,10 +98,12 @@ public class Sequence {
}
}
/** The list of texture regions this sequence will display. */
public TextureRegion[] getRegions () {
return regions;
}
/** Returns the {@link #getRegions()} index for the {@link SlotPose#getSequenceIndex()}. */
public int resolveIndex (SlotPose pose) {
int index = pose.getSequenceIndex();
if (index == -1) index = setupIndex;
@ -106,10 +111,13 @@ public class Sequence {
return index;
}
/** Returns the texture region from {@link #getRegions()} for the specified index. */
public TextureRegion getRegion (int index) {
return regions[index];
}
/** Returns the UVs for the specified index. {@link #getRegions() Regions} must be populated and {@link #update(HasSequence)}
* called before calling this method. */
public float[] getUVs (int index) {
return uvs[index];
}
@ -119,6 +127,7 @@ public class Sequence {
return offsets[index];
}
/** The starting number for the numeric {@link #getPath(String, int) path} suffix. */
public int getStart () {
return start;
}
@ -127,6 +136,8 @@ public class Sequence {
this.start = start;
}
/** The minimum number of digits in the numeric {@link #getPath(String, int) path} suffix, for zero padding. 0 for no zero
* padding. */
public int getDigits () {
return digits;
}
@ -144,10 +155,12 @@ public class Sequence {
this.setupIndex = index;
}
/** Returns true if the {@link #getPath(String, int) path} has a numeric suffix. */
public boolean hasPathSuffix () {
return pathSuffix;
}
/** Returns the specified base path with an optional numeric suffix for the specified index. */
public String getPath (String basePath, int index) {
if (!pathSuffix) return basePath;
var buffer = new StringBuilder(basePath.length() + digits);
@ -168,6 +181,7 @@ public class Sequence {
return nextID++;
}
/** Controls how {@link Sequence#getRegions()} are displayed over time. */
static public enum SequenceMode {
hold, once, loop, pingpong, onceReverse, loopReverse, pingpongReverse;