Fixed texture scaling method in TextureUtil

This commit is contained in:
Kai S. K. Engelbart 2019-10-13 14:37:35 +02:00
parent f949a0132b
commit 0d654571a1

View File

@ -29,7 +29,7 @@ public class TextureUtil {
private 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 * @param piece The piece from which the texture properties are taken
* @return The fitting texture * @return The fitting texture
@ -39,13 +39,16 @@ public class TextureUtil {
return scaledTextures.get(key); 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(); scaledTextures.clear();
textures 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") "pawn_black")
.forEach(name -> textures.put(name, loadImage("/pieces/" + name + ".png"))); .forEach(name -> textures.put(name, loadImage("/pieces/" + name + ".png")));
} }
} }