/** Construct a degenerate "nine" patch with only a center component. */ public NinePatch (Texture texture) { this(new TextureRegion(texture)); }
/** Create a ninepatch by cutting up the given texture into nine patches. The subsequent parameters define the 4 lines that * will cut the texture region into 9 pieces. * * @param left Pixels from left edge. * @param right Pixels from right edge. * @param top Pixels from top edge. * @param bottom Pixels from bottom edge. */ public NinePatch (Texture texture, int left, int right, int top, int bottom) { this(new TextureRegion(texture), left, right, top, bottom); }
@Override public TextureRegion getImage (String name) { return new TextureRegion(images.get(name)); } }
@Override public TextureRegion getImage (String name) { return new TextureRegion(images.get(name)); } }
@Override public TextureRegion getImage (String name) { return new TextureRegion(assetManager.get(name, Texture.class)); } }
/** Helper function to create tiles out of the given {@link Texture} starting from the top left corner going to the right and * ending at the bottom right corner. Only complete tiles will be returned so if the texture's width or height are not a * multiple of the tile width and height not all of the texture will be used. * * @param texture the Texture * @param tileWidth a tile's width in pixels * @param tileHeight a tile's height in pixels * @return a 2D array of TextureRegions indexed by [row][column]. */ public static TextureRegion[][] split (Texture texture, int tileWidth, int tileHeight) { TextureRegion region = new TextureRegion(texture); return region.split(tileWidth, tileHeight); } }
@Override public TextureRegion getImage (String name) { return new TextureRegion(assetManager.get(name, Texture.class)); } }
public CullableActor (String name, Texture texture, OrthographicCamera camera) { super(new TextureRegion(texture)); setAlign(Align.center); setScaling(Scaling.none); this.camera = camera; }
@Override public void create () { batch = new SpriteBatch(); texture = new Texture(Gdx.files.internal("data/g2d/progressive-libgdx.jpg")); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); drawable = new TextureRegionDrawable(new TextureRegion(texture)); }
/** Calls {@link Page#updateTexture(TextureFilter, TextureFilter, boolean) updateTexture} for each page and adds a region to * the specified array for each page texture. */ public synchronized void updateTextureRegions (Array<TextureRegion> regions, TextureFilter minFilter, TextureFilter magFilter, boolean useMipMaps) { updatePageTextures(minFilter, magFilter, useMipMaps); while (regions.size < pages.size) regions.add(new TextureRegion(pages.get(regions.size).texture)); }
public TiledMapTileMapObject (TiledMapTile tile, boolean flipHorizontally, boolean flipVertically) { this.flipHorizontally = flipHorizontally; this.flipVertically = flipVertically; this.tile = tile; TextureRegion textureRegion = new TextureRegion(tile.getTextureRegion()); textureRegion.flip(flipHorizontally, flipVertically); setTextureRegion(textureRegion); }
public TiledMapTileMapObject (TiledMapTile tile, boolean flipHorizontally, boolean flipVertically) { this.flipHorizontally = flipHorizontally; this.flipVertically = flipVertically; this.tile = tile; TextureRegion textureRegion = new TextureRegion(tile.getTextureRegion()); textureRegion.flip(flipHorizontally, flipVertically); setTextureRegion(textureRegion); }
/** Creates a BitmapFont from a BMFont file, using the specified image for glyphs. Any image specified in the BMFont file is * ignored. * @param flip If true, the glyphs will be flipped for use with a perspective where 0,0 is the upper left corner. * @param integer If true, rendering positions will be at integer values to avoid filtering artifacts. */ public BitmapFont (FileHandle fontFile, FileHandle imageFile, boolean flip, boolean integer) { this(new BitmapFontData(fontFile, flip), new TextureRegion(new Texture(imageFile, false)), integer); ownsTexture = true; }
/** Calls {@link Page#updateTexture(TextureFilter, TextureFilter, boolean) updateTexture} for each page and adds a region to * the specified array for each page texture. */ public synchronized void updateTextureRegions (Array<TextureRegion> regions, TextureFilter minFilter, TextureFilter magFilter, boolean useMipMaps) { updatePageTextures(minFilter, magFilter, useMipMaps); while (regions.size < pages.size) regions.add(new TextureRegion(pages.get(regions.size).texture)); }
/** Creates a BitmapFont from a BMFont file, using the specified image for glyphs. Any image specified in the BMFont file is * ignored. * @param flip If true, the glyphs will be flipped for use with a perspective where 0,0 is the upper left corner. * @param integer If true, rendering positions will be at integer values to avoid filtering artifacts. */ public BitmapFont (FileHandle fontFile, FileHandle imageFile, boolean flip, boolean integer) { this(new BitmapFontData(fontFile, flip), new TextureRegion(new Texture(imageFile, false)), integer); ownsTexture = true; }
@Override public PolygonRegion load (AssetManager manager, String fileName, FileHandle file, PolygonRegionParameters parameter) { Texture texture = manager.get(manager.getDependencies(fileName).first()); return load(new TextureRegion(texture), file); }
@Override public PolygonRegion load (AssetManager manager, String fileName, FileHandle file, PolygonRegionParameters parameter) { Texture texture = manager.get(manager.getDependencies(fileName).first()); return load(new TextureRegion(texture), file); }
/** Returns a registered texture region. If no region is found but a texture exists with the name, a region is created from the * texture and stored in the skin. */ public TextureRegion getRegion (String name) { TextureRegion region = optional(name, TextureRegion.class); if (region != null) return region; Texture texture = optional(name, Texture.class); if (texture == null) throw new GdxRuntimeException("No TextureRegion or Texture registered with name: " + name); region = new TextureRegion(texture); add(name, region, TextureRegion.class); return region; }
@Override public void create () { texture = new Texture(Gdx.files.internal("data/black_marked_0.png")); region = new TextureRegion(texture); batch = new SpriteBatch(); batch.getTransformMatrix().setToTranslation(30.5f, 30.5f, 0); }
@Override public void create () { region = new TextureRegion(new Texture("data/badlogicsmall.jpg")); batch = new SpriteBatch(); renderer = new ShapeRenderer(); renderer.setProjectionMatrix(batch.getProjectionMatrix()); }