public void setAtlas(TextureAtlas atlas){ //currentAtlas = atlas; setTexture(atlas.getTextures().first()); }
public void setAtlas(TextureAtlas atlas){ //currentAtlas = atlas; setTexture(atlas.getTextures().first()); }
public TextureAtlas getAtlas(Texture texture){ Array<TextureAtlas> atlases = assetManager.getAll(TextureAtlas.class, new Array<TextureAtlas>()); for(TextureAtlas atlas : atlases){ if(atlas.getTextures().contains(texture)) return atlas; } return null; }
public TextureAtlas getAtlas(Texture texture){ Array<TextureAtlas> atlases = assetManager.getAll(TextureAtlas.class, new Array<TextureAtlas>()); for(TextureAtlas atlas : atlases){ if(atlas.getTextures().contains(texture)) return atlas; } return null; }
public void setAtlas(TextureAtlas atlas){ if(atlas == this.atlas) return; regionsPanel.removeAll(); Array<AtlasRegion> atlasRegions = atlas.getRegions(); CustomCardLayout layout = (CustomCardLayout)regionsPanel.getLayout(); Array<TextureRegion> regions = new Array<TextureRegion>(); for(Texture texture : atlas.getTextures()){ FileTextureData file = (FileTextureData)texture.getTextureData(); regionsPanel.add(new TexturePanel( texture, getRegions(texture, atlasRegions, regions))); } layout.first(regionsPanel); this.atlas = atlas; }
public void setAtlas(TextureAtlas atlas){ if(atlas == this.atlas) return; regionsPanel.removeAll(); Array<AtlasRegion> atlasRegions = atlas.getRegions(); CustomCardLayout layout = (CustomCardLayout)regionsPanel.getLayout(); Array<TextureRegion> regions = new Array<TextureRegion>(); for(Texture texture : atlas.getTextures()){ FileTextureData file = (FileTextureData)texture.getTextureData(); regionsPanel.add(new TexturePanel( texture, getRegions(texture, atlasRegions, regions))); } layout.first(regionsPanel); this.atlas = atlas; }
atlas.getTextures().add(page.texture);
atlas.getTextures().add(page.texture);
Gdx.app.log("PixmapPackerTest", "Number of initial textures: " + atlas.getTextures().size); textureRegions = new Array<TextureRegion>(); packer.updateTextureRegions(textureRegions, TextureFilter.Nearest, TextureFilter.Nearest, false); Gdx.app.log("PixmapPackerTest", "Number of updated textures: " + atlas.getTextures().size); Gdx.input.setInputProcessor(new InputAdapter() { @Override
Gdx.app.log("PixmapPackerTest", "Number of initial textures: " + atlas.getTextures().size); Gdx.app.log("PixmapPackerTest", "Number of updated textures: " + atlas.getTextures().size); Gdx.input.setInputProcessor(new InputAdapter() { @Override
String regionsName = name; for (Texture texture : atlas.getTextures()) { trackedTextures.add(texture);
String regionsName = name; for (Texture texture : atlas.getTextures()) { trackedTextures.add(texture);
renderer = new ShapeRenderer(); skin = new Skin(Gdx.files.internal("data/uiskin.json")); skin.getAtlas().getTextures().iterator().next().setFilter(TextureFilter.Nearest, TextureFilter.Nearest); skin.getFont("default-font").getData().markupEnabled = true; skin.getFont("default-font").getData().setScale(scale);
// load texture atlas final String spriteSheet = "images/spritesheet.pack"; assetManager.load(spriteSheet, TextureAtlas.class); // blocks until all assets are loaded assetManager.finishedLoading(); // all assets are loaded, we can now create our TextureAtlas object TextureAtlas atlas = assetManager.get(spriteSheet); // (optional) enable texture filtering for pixel smoothing for (Texture t: atlas.getTextures()) t.setFilter(TextureFilter.Linear, TextureFilter.Linear);
public void setAtlas(TextureAtlas atlas){ //currentAtlas = atlas; setTexture(atlas.getTextures().first()); }
public TextureAtlas getAtlas(Texture texture){ Array<TextureAtlas> atlases = assetManager.getAll(TextureAtlas.class, new Array<TextureAtlas>()); for(TextureAtlas atlas : atlases){ if(atlas.getTextures().contains(texture)) return atlas; } return null; }
public void setAtlas(TextureAtlas atlas){ if(atlas == this.atlas) return; regionsPanel.removeAll(); Array<AtlasRegion> atlasRegions = atlas.getRegions(); CustomCardLayout layout = (CustomCardLayout)regionsPanel.getLayout(); Array<TextureRegion> regions = new Array<TextureRegion>(); for(Texture texture : atlas.getTextures()){ FileTextureData file = (FileTextureData)texture.getTextureData(); regionsPanel.add(new TexturePanel( texture, getRegions(texture, atlasRegions, regions))); } layout.first(regionsPanel); this.atlas = atlas; }
/** Updates the {@link TextureAtlas}, adding any new {@link Pixmap} instances packed since the last call to this method. This * can be used to insert Pixmap instances on a separate thread via {@link #pack(String, Pixmap)} and update the TextureAtlas on * the rendering thread. This method must be called on the rendering thread. After calling this method, disposing the packer * will no longer dispose the page pixmaps. */ public synchronized void updateTextureAtlas (TextureAtlas atlas, TextureFilter minFilter, TextureFilter magFilter, boolean useMipMaps) { updatePageTextures(minFilter, magFilter, useMipMaps); for (Page page : pages) { if (page.addedRects.size > 0) { for (String name : page.addedRects) { PixmapPackerRectangle rect = page.rects.get(name); TextureAtlas.AtlasRegion region = new TextureAtlas.AtlasRegion(page.texture, (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); if (rect.splits != null) { region.splits = rect.splits; region.pads = rect.pads; } region.name = name; region.index = -1; region.offsetX = rect.offsetX; region.offsetY = (int)(rect.originalHeight - rect.height - rect.offsetY); region.originalWidth = rect.originalWidth; region.originalHeight = rect.originalHeight; atlas.getRegions().add(region); } page.addedRects.clear(); atlas.getTextures().add(page.texture); } } }
for (Texture texture : atlas.getTextures()) { trackedTextures.add(texture);
skin.getAtlas().getTextures().iterator().next().setFilter(TextureFilter.Nearest, TextureFilter.Nearest); float scale = 1; skin.getFont("default-font").getData().setScale(scale);