@Override public void loadAsync (AssetManager manager, String fileName, FileHandle fileHandle, TextureParameter parameter) { if (parameter == null || (parameter != null && parameter.textureData == null)) { Pixmap pixmap = null; Format format = null; boolean genMipMaps = false; texture = null; if (parameter != null) { format = parameter.format; genMipMaps = parameter.genMipMaps; texture = parameter.texture; } FileHandle handle = resolve(fileName); pixmap = new Pixmap(handle); data = new FileTextureData(handle, pixmap, format, genMipMaps); } else { data = parameter.textureData; if (!data.isPrepared()) data.prepare(); texture = parameter.texture; } }
public static TextureAtlas getAtlas(String path) { if(textureAtlasMap.containsKey(path)) { return textureAtlasMap.get(path); } else { TextureAtlas textureAtlas = new TextureAtlas(Gdx.files.internal("data/images/" + path)); textureAtlasMap.put(path.substring(path.lastIndexOf("/") + 1, path.length()), textureAtlas); for(Texture texture : textureAtlas.getTextures()) { String name = "" + texture; if(texture.getTextureData() instanceof FileTextureData) name = ((FileTextureData)texture.getTextureData()).getFileHandle().name(); textureMap.put(name, texture); textureDataMap.put(texture, texture.getTextureData()); } return textureAtlas; } }
private static TextureData c(String paramString, boolean paramBoolean) { String str; if (paramBoolean) str = "-useMipMaps"; try { aj.a("AssetUtils.getTextureData", str); FileTextureData localFileTextureData = new FileTextureData((FileHandle)an.a(a(paramString)), null, null, paramBoolean); return localFileTextureData; str = ""; } finally { aj.b(); } }
protected Pixmap ensurePot(Pixmap pixmap) { if (Gdx.gl20 == null && FileTextureData.copyToPOT) { int pixmapWidth = pixmap.getWidth(); int pixmapHeight = pixmap.getHeight(); int potWidth = MathUtils.nextPowerOfTwo(pixmapWidth); int potHeight = MathUtils.nextPowerOfTwo(pixmapHeight); if (pixmapWidth != potWidth || pixmapHeight != potHeight) { Pixmap copy = PixmapUtil.resizedCopy(pixmap, Dim.of(potWidth, potHeight), Filter.BiLinear); pixmap.dispose(); return copy; } } return pixmap; }
void fromSpriteComponent(SpriteComponent component){ layer = component.layer; for (ObjectMap.Entry<String,Sprite> entry : component.spriteMap.entries()){ FileTextureData data = (FileTextureData) entry.value.getTexture().getTextureData(); spriteMap.put(entry.key,data.getFileHandle().name()); } }
public static TextureData loadFromFile (FileHandle file, Format format, boolean useMipMaps) { if (file == null) return null; if (file.name().endsWith(".cim")) return new FileTextureData(file, PixmapIO.readCIM(file), format, useMipMaps); if (file.name().endsWith(".etc1")) return new ETC1TextureData(file, useMipMaps); if (file.name().endsWith(".ktx") || file.name().endsWith(".zktx")) return new KTXTextureData(file, useMipMaps); return new FileTextureData(file, new Pixmap(file), format, useMipMaps); }
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 static void addExistingAtlas(String path, TextureAtlas textureAtlas) { textureAtlasMap.put(path, textureAtlas); for(Texture texture : textureAtlas.getTextures()) { String name = "" + texture; if(texture.getTextureData() instanceof FileTextureData) name = ((FileTextureData)texture.getTextureData()).getFileHandle().name(); textureMap.put(name, texture); textureDataMap.put(texture, texture.getTextureData()); } }
public Texture(FileHandle paramFileHandle, Pixmap.Format paramFormat, boolean paramBoolean) { if (paramFileHandle.name().contains(".etc1")) { create(new ETC1TextureData(paramFileHandle, paramBoolean)); return; } create(new FileTextureData(paramFileHandle, null, paramFormat, paramBoolean)); }
public void loadAsync(AssetManager paramAssetManager, String paramString, TextureLoader.TextureParameter paramTextureParameter) { if ((paramTextureParameter == null) || ((paramTextureParameter != null) && (paramTextureParameter.textureData == null))) { this.texture = null; boolean bool = false; Pixmap.Format localFormat = null; if (paramTextureParameter != null) { localFormat = paramTextureParameter.format; bool = paramTextureParameter.genMipMaps; this.texture = paramTextureParameter.texture; } FileHandle localFileHandle = resolve(paramString); if (!paramString.contains(".etc1")) { if (paramString.contains(".cim")); for (Pixmap localPixmap = PixmapIO.readCIM(localFileHandle); ; localPixmap = new Pixmap(localFileHandle)) { this.data = new FileTextureData(localFileHandle, localPixmap, localFormat, bool); return; } } this.data = new ETC1TextureData(localFileHandle, bool); return; } this.data = paramTextureParameter.textureData; if (!this.data.isPrepared()) this.data.prepare(); this.texture = paramTextureParameter.texture; }
public void create() { int width = 800; int height = 600; Tilo.width = width; Tilo.height = height; script = new lua(); // LOAD PLUGINS g.plugin_load(); script.put("graphics", g); script.put("timer", t); script.put("window", w); script.put("math", m); script.put("input", i); script.put("audio", a); if (getPlatform().equalsIgnoreCase("desktop")) { width = 800; height = 600; Tilo.width = width; Tilo.height = height; boolean fullscreen = false; Gdx.graphics.setDisplayMode(width, height, fullscreen); } assets = new AssetManager(); Gdx.input.setInputProcessor(this); // LOAD SCRIPT FileHandle main = file("main.lua"); if (main.exists()) { script.eval(main.readString()); } else { error(TAG, E_RESOURCE + main.name()); quit(); } // Enable non power of two textures. FileTextureData.copyToPOT = true; // Set OpenGL features Gdx.gl.glDisable(GL20.GL_CULL_FACE); Gdx.gl.glDisable(GL20.GL_DITHER); Gdx.gl.glDisable(GL20.GL_DEPTH_TEST); Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST); script.invoke("tilo", "load", assets); ready = true; }
public static TextureData loadFromFile(FileHandle file, Format format, boolean useMipMaps) { if (file == null) { return null; } return new FileTextureData(file, new Pixmap(file), format, useMipMaps); }
public static TextureData loadFromFile (FileHandle file, Format format, boolean useMipMaps) { if (file == null) return null; return new FileTextureData(file, new Pixmap(file), format, useMipMaps); }
public void setTexture(Texture texture){ if(this.texture == texture) return; this.texture = texture; FileTextureData data = (FileTextureData)texture.getTextureData(); setImage(data.getFileHandle().file().getAbsolutePath()); }
public void create () { spriteBatch = new SpriteBatch(); // texture = new Texture(new PixmapTextureData(new Pixmap(Gdx.files.internal("data/t8890.png")), null, false, true)); texture = new Texture(new FileTextureData(Gdx.files.internal("data/t8890.png"), null, null, false)); }
private static Texture b(TextureData paramTextureData) { int i = 0; Object localObject1 = null; Texture localTexture; while (true) { Object localObject2; int k; try { localTexture = new Texture(paramTextureData); int j = i; localObject2 = localObject1; k = j; if (localObject2 == null) break; boolean bool = paramTextureData instanceof FileTextureData; FileHandle localFileHandle = null; if (bool) localFileHandle = ((FileTextureData)paramTextureData).getFileHandle(); aa localaa = a; Object[] arrayOfObject = new Object[4]; arrayOfObject[0] = localFileHandle; arrayOfObject[1] = Integer.valueOf(k); arrayOfObject[2] = Texture.getManagedStatus(); arrayOfObject[3] = localTexture; localaa.c(localObject2, "Exception in create texture. file(%s) try(%d) status(%s) texture(%s)", arrayOfObject); if (localTexture != null) break; throw localObject2; } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException1) { i++; } if (i >= 2) { ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException2 = localArrayIndexOutOfBoundsException1; k = i; localObject2 = localArrayIndexOutOfBoundsException2; localTexture = null; } } return localTexture; }