List of usage examples for com.badlogic.gdx.graphics.g2d TextureAtlas dispose
public void dispose()
From source file:com.bladecoder.engineeditor.ui.SceneList.java
License:Apache License
private TextureRegion createBgIcon(String atlas, String region) { TextureAtlas a = new TextureAtlas(Gdx.files .absolute(Ctx.project.getProjectPath() + "/" + Project.ATLASES_PATH + "/1/" + atlas + ".atlas")); AtlasRegion r = a.findRegion(region); if (r == null) { a.dispose(); return null; }/*from w w w .j av a 2s.c o m*/ FrameBuffer fbo = new FrameBuffer(Format.RGBA8888, 200, (int) (r.getRegionHeight() * 200f / r.getRegionWidth()), false); SpriteBatch fboBatch = new SpriteBatch(); fboBatch.setColor(Color.WHITE); OrthographicCamera camera = new OrthographicCamera(); camera.setToOrtho(false, fbo.getWidth(), fbo.getHeight()); fboBatch.setProjectionMatrix(camera.combined); Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST); fbo.begin(); fboBatch.begin(); fboBatch.draw(r, 0, 0, fbo.getWidth(), fbo.getHeight()); fboBatch.end(); TextureRegion tex = ScreenUtils.getFrameBufferTexture(0, 0, fbo.getWidth(), fbo.getHeight()); // tex.flip(false, true); fbo.end(); Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST); fbo.dispose(); a.dispose(); fboBatch.dispose(); return tex; }
From source file:com.johnogel.astrobros.support.TextureHandler.java
public void disposeAtlases() { for (TextureAtlas a : atlases) { a.dispose(); } atlases.clear(); }
From source file:com.johnogel.astrobros.support.TextureHandler.java
@Override public void dispose() { for (Texture t : textures) { t.dispose();//from ww w. ja v a 2 s .c o m } for (TextureAtlas a : atlases) { a.dispose(); } //atlas.dispose(); }
From source file:com.kotcrab.vis.editor.module.project.TextureCacheModule.java
License:Apache License
private void disposeCacheLater(final TextureAtlas oldCache) { Timer.instance().scheduleTask(new Task() { @Override//from ww w . j av a 2s . c o m public void run() { if (oldCache != null) oldCache.dispose(); } }, 0.5f); }
From source file:com.kotcrab.vis.editor.module.project.TextureCacheModule.java
License:Apache License
private void updateAtlas(FileHandle file) { String relativePath = fileAccess.relativizeToAssetsFolder(file); TextureAtlas atlas = atlases.get(relativePath); if (atlas != null) { atlases.remove(relativePath);//w w w. ja v a2s .co m spriteSheetHelpers.remove(atlas); atlas.dispose(); } if (file.exists()) { try { atlases.put(relativePath, new TextureAtlas(file)); } catch (GdxRuntimeException e) { Log.exception(e); } App.eventBus.post(new ResourceReloadedEvent(EnumSet.of(ResourceType.TEXTURES))); App.eventBus.post(new ResourceReloadedEvent(EnumSet.of(ResourceType.TEXTURE_ATLASES))); } }
From source file:com.kotcrab.vis.editor.module.project.TextureCacheModule.java
License:Apache License
@Override public void dispose() { watcher.removeListener(this); if (cache != null) { cache.dispose();/*from ww w .ja v a2 s . c o m*/ } for (TextureAtlas atlas : atlases.values()) { atlas.dispose(); } for (Texture texture : textures.values()) { texture.dispose(); } }
From source file:com.kotcrab.vis.plugin.spine.SpineCacheExtension.java
License:Open Source License
@Override public void dispose() { for (TextureAtlas atlas : atlases.values()) atlas.dispose(); }
From source file:com.mygdx.managers.ResourceManager.java
public void disposeAtlas(String key) { TextureAtlas atlas = atlases.get(key); if (atlas != null) atlas.dispose(); }