List of usage examples for com.badlogic.gdx.graphics.g2d TextureRegion split
public static TextureRegion[][] split(Texture texture, int tileWidth, int tileHeight)
From source file:spaceisnear.game.objects.items.ItemsArchive.java
public ItemsArchive(ItemBundle[] bundles) { super(bundles); sprites = new Texture(Gdx.files.classpath("res").child("sprites.png")); TextureRegion[][] split = TextureRegion.split(sprites, GameContext.TILE_WIDTH, GameContext.TILE_HEIGHT); regions = new TextureRegion[split.length * split[0].length]; int index = 0; for (TextureRegion[] textureRegions : split) { for (TextureRegion textureRegion : textureRegions) { textureRegion.flip(false, true); regions[index++] = textureRegion; }//from www. ja va 2 s. c om } }