- Edited
frame width
Hi,
How can I check the total width and height of the currently displayed frame in runtime?
float minX = Float.MAX_VALUE, minY = Float.MAX_VALUE, maxX = Float.MIN_VALUE, maxY = Float.MIN_VALUE;
for (int i = 0, n = skeleton.skeleton.getSlots().size; i < n; i++) {
Slot slot = skeleton.getSlots().get(i);
Attachment attachment = slot.getAttachment();
if (attachment == null) continue;
if (!(attachment instanceof RegionAttachment)) continue;
RegionAttachment imageRegion = (RegionAttachment)attachment;
imageRegion.updateWorldVertices(slot.getBone());
float[] vertices = imageRegion.getWorldVertices();
for (int ii = 0, nn = vertices.length; ii < nn; ii += 5) {
minX = Math.min(minX, vertices[ii]);
minY = Math.min(minY, vertices[ii + 1]);
maxX = Math.max(maxX, vertices[ii]);
maxY = Math.max(maxY, vertices[ii + 1]);
}
}
Maybe I'll add a method to Skeleton to do this.
9 months later
Sorry to drag up an old post, but was this method ever added?
Is it possible to get the current width and height of the current frame at runtime?
see http://esotericsoftware.com/forum/viewtopic.php?f=3&t=1465 afraid I don't know if the method was added.
12 days later
No, I haven't gotten to it. You'll have to use code similar to the above for now.