Fixed texture scaling method in TextureUtil
This commit is contained in:
parent
f949a0132b
commit
0d654571a1
@ -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")));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user