public AtlasRegion (TextureRegion region) { setRegion(region); packedWidth = region.getRegionWidth(); packedHeight = region.getRegionHeight(); originalWidth = packedWidth; originalHeight = packedHeight; }
/** Creates a decal assuming the dimensions of the texture region and adding transparency * * @param textureRegion Texture region to use * @param hasTransparency Whether or not this sprite will be treated as having transparency (transparent png, etc.) * @return Created decal */ public static Decal newDecal (TextureRegion textureRegion, boolean hasTransparency) { return newDecal(textureRegion.getRegionWidth(), textureRegion.getRegionHeight(), textureRegion, hasTransparency ? GL20.GL_SRC_ALPHA : DecalMaterial.NO_BLEND, hasTransparency ? GL20.GL_ONE_MINUS_SRC_ALPHA : DecalMaterial.NO_BLEND); }
/** Creates a decal assuming the dimensions of the texture region * * @param textureRegion Texture region to use * @return Created decal */ public static Decal newDecal (TextureRegion textureRegion) { return newDecal(textureRegion.getRegionWidth(), textureRegion.getRegionHeight(), textureRegion, DecalMaterial.NO_BLEND, DecalMaterial.NO_BLEND); }
public AtlasRegion (TextureRegion region) { setRegion(region); packedWidth = region.getRegionWidth(); packedHeight = region.getRegionHeight(); originalWidth = packedWidth; originalHeight = packedHeight; }
/** Creates a decal assuming the dimensions of the texture region and adding transparency * * @param textureRegion Texture region to use * @param hasTransparency Whether or not this sprite will be treated as having transparency (transparent png, etc.) * @return Created decal */ public static Decal newDecal (TextureRegion textureRegion, boolean hasTransparency) { return newDecal(textureRegion.getRegionWidth(), textureRegion.getRegionHeight(), textureRegion, hasTransparency ? GL20.GL_SRC_ALPHA : DecalMaterial.NO_BLEND, hasTransparency ? GL20.GL_ONE_MINUS_SRC_ALPHA : DecalMaterial.NO_BLEND); }
/** Creates a decal assuming the dimensions of the texture region * * @param textureRegion Texture region to use * @return Created decal */ public static Decal newDecal (TextureRegion textureRegion) { return newDecal(textureRegion.getRegionWidth(), textureRegion.getRegionHeight(), textureRegion, DecalMaterial.NO_BLEND, DecalMaterial.NO_BLEND); }
@Override public void draw (TextureRegion region, float x, float y) { draw(region, x, y, region.getRegionWidth(), region.getRegionHeight()); }
@Override public void draw (TextureRegion region, float x, float y) { draw(region, x, y, region.getRegionWidth(), region.getRegionHeight()); }
/** Adds the specified region to the cache. */ public void add (TextureRegion region, float x, float y) { add(region, x, y, region.getRegionWidth(), region.getRegionHeight()); }
protected boolean isInsideRegion (TextureRegion region, float x, float y) { float rx = region.getRegionX(), ry = region.getRegionY(); return rx <= x && x <= rx +region.getRegionWidth() && ry <= y && y <= ry +region.getRegionHeight(); }
@Override public void draw (TextureRegion region, float x, float y) { if (!adjustNeeded) { super.draw(region, x, y); } else { drawAdjusted(region, x, y, 0, 0, region.getRegionWidth(), region.getRegionHeight(), 1, 1, 0); } }
protected boolean isInsideRegion (TextureRegion region, float x, float y) { float rx = region.getRegionX(), ry = region.getRegionY(); return rx <= x && x <= rx +region.getRegionWidth() && ry <= y && y <= ry +region.getRegionHeight(); }
public void setRegion (TextureRegion region) { this.region = region; if (region != null) { setMinWidth(region.getRegionWidth()); setMinHeight(region.getRegionHeight()); } }
public void setRegion (TextureRegion region) { this.region = region; if (region != null) { setMinWidth(region.getRegionWidth()); setMinHeight(region.getRegionHeight()); } }
@Override public void draw (TextureRegion region, float x, float y) { if (!adjustNeeded) { super.draw(region, x, y); } else { drawAdjusted(region, x, y, 0, 0, region.getRegionWidth(), region.getRegionHeight(), 1, 1, 0); } }
/** Creates a sprite based on a specific TextureRegion, the new sprite's region is a copy of the parameter region - altering one * does not affect the other */ public Sprite (TextureRegion region) { setRegion(region); setColor(1, 1, 1, 1); setSize(region.getRegionWidth(), region.getRegionHeight()); setOrigin(width / 2, height / 2); }
public void set (TextureRegion region) { this.u = region.getU(); this.v = region.getV(); this.u2 = region.getU2(); this.v2 = region.getV2(); this.halfInvAspectRatio = 0.5f * ((float)region.getRegionHeight() / region.getRegionWidth()); }
/** Creates a sprite based on a specific TextureRegion, the new sprite's region is a copy of the parameter region - altering one * does not affect the other */ public Sprite (TextureRegion region) { setRegion(region); setColor(1, 1, 1, 1); setSize(region.getRegionWidth(), region.getRegionHeight()); setOrigin(width / 2, height / 2); }
public void set (TextureRegion region) { this.u = region.getU(); this.v = region.getV(); this.u2 = region.getU2(); this.v2 = region.getV2(); this.halfInvAspectRatio = 0.5f * ((float)region.getRegionHeight() / region.getRegionWidth()); }
private void renderOclDebugImage () { TextureRegion oclDebugTexture = oclBuffer.drawDebugTexture(); spriteBatch.begin(); spriteBatch.draw(oclDebugTexture, 0, 0); spriteBatch.end(); shapeRenderer.begin(ShapeRenderer.ShapeType.Line); shapeRenderer.setColor(Color.DARK_GRAY); shapeRenderer.rect(0, 0, oclDebugTexture.getRegionWidth(), oclDebugTexture.getRegionHeight()); shapeRenderer.end(); }