mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
[libgdx] Added Skin#removeAttachment.
This commit is contained in:
parent
3c61589312
commit
b194dbf2c8
@ -34,6 +34,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.ObjectMap.Entry;
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
|
||||
import com.esotericsoftware.spine.attachments.Attachment;
|
||||
|
||||
/** Stores attachments by slot index and attachment name.
|
||||
@ -77,6 +78,15 @@ public class Skin {
|
||||
return attachments.get(lookup);
|
||||
}
|
||||
|
||||
/** Removes the attachment in the skin for the specified slot index and name, if any. */
|
||||
public void removeAttachment (int slotIndex, String name) {
|
||||
if (slotIndex < 0) throw new IllegalArgumentException("slotIndex must be >= 0.");
|
||||
Key key = keyPool.obtain();
|
||||
key.set(slotIndex, name);
|
||||
attachments.remove(key);
|
||||
keyPool.free(key);
|
||||
}
|
||||
|
||||
public void findNamesForSlot (int slotIndex, Array<String> names) {
|
||||
if (names == null) throw new IllegalArgumentException("names cannot be null.");
|
||||
if (slotIndex < 0) throw new IllegalArgumentException("slotIndex must be >= 0.");
|
||||
@ -97,6 +107,10 @@ public class Skin {
|
||||
attachments.clear(1024);
|
||||
}
|
||||
|
||||
public int size () {
|
||||
return attachments.size;
|
||||
}
|
||||
|
||||
/** The skin's name, which is unique within the skeleton. */
|
||||
public String getName () {
|
||||
return name;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user