/** Adds a region to the atlas. The texture for the specified region will be disposed when the atlas is disposed. */ public AtlasRegion addRegion (String name, TextureRegion textureRegion) { return addRegion(name, textureRegion.texture, textureRegion.getRegionX(), textureRegion.getRegionY(), textureRegion.getRegionWidth(), textureRegion.getRegionHeight()); }
public TextureRegion getTextureRegion2(String name) { TextureRegion regin; if (atlas != null) { regin = atlas.findRegion(name); if (regin != null) { return regin; } else { PixmapPro pro = new PixmapPro(Gdx.files.internal(name)); Texture texture = pro.getTextrue(); texture.setFilter(filter, filter); regin = new TextureRegion(texture); atlas.addRegion(name, regin); return regin; } } else { atlas = new TextureAtlas(); PixmapPro pro = new PixmapPro(Gdx.files.internal(name)); Texture texture = pro.getTextrue(); texture.setFilter(filter, filter); regin = new TextureRegion(texture); atlas.addRegion(name, regin); return regin; } }
Texture texture = pix.getTextrue(); texture.setFilter(filter, filter); atlas.addRegion(pix.getName(), new TextureRegion(texture)); assets.unload(pix.getName());