From 0d654571a1e4f8bce5d77a39c3759756a03f1b79 Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Sun, 13 Oct 2019 14:37:35 +0200 Subject: [PATCH] Fixed texture scaling method in TextureUtil --- src/dev/kske/chess/ui/TextureUtil.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/dev/kske/chess/ui/TextureUtil.java b/src/dev/kske/chess/ui/TextureUtil.java index 03993f7..d7e6910 100644 --- a/src/dev/kske/chess/ui/TextureUtil.java +++ b/src/dev/kske/chess/ui/TextureUtil.java @@ -29,7 +29,7 @@ public class TextureUtil { private TextureUtil() {} /** - * Loads a piece texture fitting to a piece object + * Loads a piece texture fitting to a piece object. * * @param piece The piece from which the texture properties are taken * @return The fitting texture @@ -39,13 +39,16 @@ public class TextureUtil { return scaledTextures.get(key); } + /** - * Scales all piece textures to fit the current tile size + * Scales all piece textures to fit the current tile size. + * + * @param tileSize the new width and height of the piece textures */ - public static void scalePieceTextures(int scale) { + public static void scalePieceTextures(int tileSize) { scaledTextures.clear(); textures - .forEach((key, img) -> scaledTextures.put(key, img.getScaledInstance(scale, scale, Image.SCALE_SMOOTH))); + .forEach((key, img) -> scaledTextures.put(key, img.getScaledInstance(tileSize, tileSize, Image.SCALE_SMOOTH))); } /** @@ -84,5 +87,4 @@ public class TextureUtil { "pawn_black") .forEach(name -> textures.put(name, loadImage("/pieces/" + name + ".png"))); } - }