blob: 9421f79a72dcf2f72f864de61ce59daa56c5d625 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package kz.ilotterytea.maxon.anim;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import java.util.ArrayList;
public class SpriteUtils {
public static ArrayList<TextureRegion> splitToTextureRegions(
Texture texture,
int tileWidth,
int tileHeight
) {
TextureRegion[][] tmp = TextureRegion.split(texture, tileWidth, tileHeight);
ArrayList<TextureRegion> frames = new ArrayList<>();
for (TextureRegion[] regArray : tmp) {
for (TextureRegion reg : regArray) {
if (reg != null) {
frames.add(reg);
}
}
}
return frames;
}
}
|