mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-27 20:21:24 +08:00
25 lines
835 B
Java
25 lines
835 B
Java
|
|
package com.esotericsoftware.spine;
|
|
|
|
import com.esotericsoftware.spine.attachments.Attachment;
|
|
import com.esotericsoftware.spine.attachments.RegionAttachment;
|
|
|
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
|
import com.badlogic.gdx.utils.Array;
|
|
|
|
public class SkeletonRenderer {
|
|
public void draw (SpriteBatch batch, Skeleton skeleton) {
|
|
Array<Slot> drawOrder = skeleton.drawOrder;
|
|
for (int i = 0, n = drawOrder.size; i < n; i++) {
|
|
Slot slot = drawOrder.get(i);
|
|
Attachment attachment = slot.attachment;
|
|
if (attachment instanceof RegionAttachment) {
|
|
RegionAttachment regionAttachment = (RegionAttachment)attachment;
|
|
regionAttachment.updateVertices(slot);
|
|
float[] vertices = regionAttachment.getVertices();
|
|
batch.draw(regionAttachment.getRegion().getTexture(), vertices, 0, vertices.length);
|
|
}
|
|
}
|
|
}
|
|
}
|