diff --git a/forge-m-base/src/forge/Forge.java b/forge-m-base/src/forge/Forge.java index f1ba1727db7..82833ea7cee 100644 --- a/forge-m-base/src/forge/Forge.java +++ b/forge-m-base/src/forge/Forge.java @@ -594,6 +594,19 @@ public class Forge implements ApplicationListener { batch.draw(image, adjustX(x), adjustY(y, h), w, h); } + public void drawRepeatingImage(Texture image, float x, float y, float w, float h) { + startClip(x, y, w, h); + + int tilesW = (int)(w / image.getWidth()) + 1; + int tilesH = (int)(h / image.getHeight()) + 1; + batch.draw(image, adjustX(x), adjustY(y, h), + image.getWidth() * tilesW, + image.getHeight() * tilesH, + 0, tilesH, tilesW, 0); + + endClip(); + } + public void drawRotatedImage(Texture image, float x, float y, float w, float h, float originX, float originY, float rotation) { batch.draw(image, adjustX(x), adjustY(y, h), originX - x, h - (originY - y), w, h, 1, 1, rotation, 0, 0, image.getWidth(), image.getHeight(), false, false); } diff --git a/forge-m-base/src/forge/assets/FSkinTexture.java b/forge-m-base/src/forge/assets/FSkinTexture.java index c791f851fb8..05b57d32809 100644 --- a/forge-m-base/src/forge/assets/FSkinTexture.java +++ b/forge-m-base/src/forge/assets/FSkinTexture.java @@ -3,17 +3,21 @@ package forge.assets; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.Texture.TextureWrap; + import forge.Forge.Graphics; public enum FSkinTexture implements FImage { - BG_TEXTURE("bg_texture.jpg"), - BG_MATCH("bg_match.jpg"); - - private final String filename; - private Texture texture; + BG_TEXTURE("bg_texture.jpg", true), + BG_MATCH("bg_match.jpg", false); - FSkinTexture(String filename0) { + private final String filename; + private final boolean repeat; + private Texture texture; + + FSkinTexture(String filename0, boolean repeat0) { filename = filename0; + repeat = repeat0; } public void load(String preferredDir, String defaultDir) { @@ -42,6 +46,9 @@ public enum FSkinTexture implements FImage { } } } + if (repeat) { + texture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); + } } @Override @@ -56,6 +63,11 @@ public enum FSkinTexture implements FImage { @Override public void draw(Graphics g, float x, float y, float w, float h) { - g.drawImage(texture, x, y, w, h); + if (repeat) { + g.drawRepeatingImage(texture, x, y, w, h); + } + else { + g.drawImage(texture, x, y, w, h); + } } } \ No newline at end of file