public TiledDrawable tint (Color tint) { TiledDrawable drawable = new TiledDrawable(this); drawable.color.set(tint); drawable.setLeftWidth(getLeftWidth()); drawable.setRightWidth(getRightWidth()); drawable.setTopHeight(getTopHeight()); drawable.setBottomHeight(getBottomHeight()); return drawable; } }
/** Returns a registered tiled drawable. If no tiled drawable is found but a region exists with the name, a tiled drawable is * created from the region and stored in the skin. */ public TiledDrawable getTiledDrawable (String name) { TiledDrawable tiled = optional(name, TiledDrawable.class); if (tiled != null) return tiled; tiled = new TiledDrawable(getRegion(name)); tiled.setName(name); add(name, tiled, TiledDrawable.class); return tiled; }
/** Returns a copy of the specified drawable. */ public Drawable newDrawable (Drawable drawable) { if (drawable instanceof TiledDrawable) return new TiledDrawable((TiledDrawable)drawable); if (drawable instanceof TextureRegionDrawable) return new TextureRegionDrawable((TextureRegionDrawable)drawable); if (drawable instanceof NinePatchDrawable) return new NinePatchDrawable((NinePatchDrawable)drawable); if (drawable instanceof SpriteDrawable) return new SpriteDrawable((SpriteDrawable)drawable); throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass()); }
public void render () { // System.out.println(meow.getValue()); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); stage.getBatch().begin(); patch.draw(stage.getBatch(), 300, 100, 126, 126); stage.getBatch().end(); }
batch.setColor(batchColor.mul(color)); TextureRegion region = getRegion(); float regionWidth = region.getRegionWidth(), regionHeight = region.getRegionHeight(); int fullX = (int)(width / regionWidth), fullY = (int)(height / regionHeight);
/** Returns a copy of the specified drawable. */ public Drawable newDrawable (Drawable drawable) { if (drawable instanceof TiledDrawable) return new TiledDrawable((TiledDrawable)drawable); if (drawable instanceof TextureRegionDrawable) return new TextureRegionDrawable((TextureRegionDrawable)drawable); if (drawable instanceof NinePatchDrawable) return new NinePatchDrawable((NinePatchDrawable)drawable); if (drawable instanceof SpriteDrawable) return new SpriteDrawable((SpriteDrawable)drawable); throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass()); }
/** Returns a registered tiled drawable. If no tiled drawable is found but a region exists with the name, a tiled drawable is * created from the region and stored in the skin. */ public TiledDrawable getTiledDrawable (String name) { TiledDrawable tiled = optional(name, TiledDrawable.class); if (tiled != null) return tiled; tiled = new TiledDrawable(getRegion(name)); tiled.setName(name); add(name, tiled, TiledDrawable.class); return tiled; }
@Override public void drawTiledDrawable(TiledDrawable tiledDrawable, float x, float y, float width, float height) { beginRendering(); tiledDrawable.draw(spriteBatch, x, y, width, height); }
batch.setColor(batchColor.mul(color)); TextureRegion region = getRegion(); float regionWidth = region.getRegionWidth(), regionHeight = region.getRegionHeight(); int fullX = (int)(width / regionWidth), fullY = (int)(height / regionHeight);
public TiledDrawable tint (Color tint) { TiledDrawable drawable = new TiledDrawable(this); drawable.color.set(tint); drawable.setLeftWidth(getLeftWidth()); drawable.setRightWidth(getRightWidth()); drawable.setTopHeight(getTopHeight()); drawable.setBottomHeight(getBottomHeight()); return drawable; } }
public BusyBar(Style style) { this.style = style; patternDrawable = new TiledDrawable((TextureRegionDrawable) style.pattern); }
/** Returns a registered tiled drawable. If no tiled drawable is found but a region exists with the name, a tiled drawable is * created from the region and stored in the skin. */ public TiledDrawable getTiledDrawable (String name) { TiledDrawable tiled = optional(name, TiledDrawable.class); if (tiled != null) return tiled; tiled = new TiledDrawable(getRegion(name)); tiled.setName(name); add(name, tiled, TiledDrawable.class); return tiled; }
@Override public void draw(Batch batch, float parentAlpha) { super.draw(batch, parentAlpha); batch.flush(); if (clipBegin()) { Color c = getColor(); batch.setColor(c.r, c.g, c.b, c.a * parentAlpha); patternDrawable.draw(batch, getX() - shift, getY(), getWidth() + shift, getHeight()); if (isVisible()) Gdx.graphics.requestRendering(); batch.flush(); clipEnd(); } }
batch.setColor(batchColor.mul(color)); TextureRegion region = getRegion(); float regionWidth = region.getRegionWidth(), regionHeight = region.getRegionHeight(); int fullX = (int)(width / regionWidth), fullY = (int)(height / regionHeight);
public TiledDrawable tint (Color tint) { TiledDrawable drawable = new TiledDrawable(this); drawable.color.set(tint); drawable.setLeftWidth(getLeftWidth()); drawable.setRightWidth(getRightWidth()); drawable.setTopHeight(getTopHeight()); drawable.setBottomHeight(getBottomHeight()); return drawable; } }
patch = new TiledDrawable(skin.getRegion("default-round"));
patches[TOP_CENTER].flip(false, true); middleLeft.draw(batch, x, y + patches[TOP_LEFT].getRegionHeight(), leftWidth, totalMiddleHeight); middleCenter.draw(batch, x + leftWidth, y + patches[TOP_LEFT].getRegionHeight(), centerWidth, totalMiddleHeight); patches[MIDDLE_LEFT].flip(false, true); topCenter.draw(batch, x + patches[TOP_LEFT].getRegionWidth(), y, totalCenterWidth, topHeight); middleCenter.draw(batch, x + patches[MIDDLE_LEFT].getRegionWidth(), y + topHeight, totalCenterWidth, middleHeight); middleCenter.draw(batch, x + patches[TOP_LEFT].getRegionWidth(), y + patches[BOTTOM_LEFT].getRegionHeight(), totalCenterWidth, totalMiddleHeight); topCenter.draw(batch, x + patches[TOP_LEFT].getRegionWidth(), y + patches[BOTTOM_LEFT].getRegionHeight() + totalMiddleHeight, totalCenterWidth, patches[BOTTOM_CENTER].getRegionHeight()); bottomCenter.draw(batch, x + patches[TOP_LEFT].getRegionWidth(), y, totalCenterWidth, patches[TOP_CENTER].getRegionHeight()); middleLeft.draw(batch, x, y + patches[BOTTOM_LEFT].getRegionHeight(), patches[MIDDLE_LEFT].getRegionWidth(), totalMiddleHeight); middleRight.draw(batch, x + patches[MIDDLE_LEFT].getRegionWidth() + totalCenterWidth, y + patches[BOTTOM_LEFT].getRegionHeight(), patches[MIDDLE_LEFT].getRegionWidth(), totalMiddleHeight);
private void loadTiledDrawables() { if(patches[TOP_CENTER] != null) { topCenter = new TiledDrawable(patches[TOP_CENTER]); } if(patches[MIDDLE_LEFT] != null) { middleLeft = new TiledDrawable(patches[MIDDLE_LEFT]); } if(patches[MIDDLE_CENTER] != null) { middleCenter = new TiledDrawable(patches[MIDDLE_CENTER]); } if(patches[MIDDLE_RIGHT] != null) { middleRight = new TiledDrawable(patches[MIDDLE_RIGHT]); } if(patches[BOTTOM_CENTER] != null) { bottomCenter = new TiledDrawable(patches[BOTTOM_CENTER]); } }
tile.draw(batch, getX(), getY(), getWidth(), getHeight()); batch.enableBlending();
/** Returns a copy of the specified drawable. */ public Drawable newDrawable (Drawable drawable) { if (drawable instanceof TiledDrawable) return new TiledDrawable((TiledDrawable)drawable); if (drawable instanceof TextureRegionDrawable) return new TextureRegionDrawable((TextureRegionDrawable)drawable); if (drawable instanceof NinePatchDrawable) return new NinePatchDrawable((NinePatchDrawable)drawable); if (drawable instanceof SpriteDrawable) return new SpriteDrawable((SpriteDrawable)drawable); throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass()); }