I’m trying to port my game to linux,
and it seems there is a problem loading the textures…
Here is the error:
java.lang.IllegalArgumentException: Width (-1) and height (-1) must be > 0
at java.awt.image.SampleModel.<init>(Unknown Source)
at java.awt.image.ComponentSampleModel.<init>(Unknown Source)
at java.awt.image.PixelInterleavedSampleModel.<init>(Unknown Source)
at java.awt.image.Raster.createInterleavedRaster(Unknown Source)
at java.awt.image.Raster.createInterleavedRaster(Unknown Source)
at java.awt.image.BufferedImage.<init>(Unknown Source)
at srw.TextureManager.loadTexture(TextureManager.java:75)
at srw.TextureManager.loadTextures(TextureManager.java:63)
at srw.FrameLauncher.init(FrameLauncher.java:320)
at srw.FrameLauncher.run(FrameLauncher.java:167)
at srw.FrameLauncher.main(FrameLauncher.java:89)
Here is the code which calls it…
public void loadTextures()
{
textures.put(T_FONT, loadTexture(T_FONT));
buildFont();
textures.put(T_BUTTON_1, loadTexture(T_BUTTON_1));
textures.put(T_GRASS, loadTexture(T_GRASS));
textures.put(T_GRASS2, loadTexture(T_GRASS2));
textures.put(T_STONE1, loadTexture(T_STONE1));
textures.put(T_STONE2, loadTexture(T_STONE2));
textures.put(T_METAL1, loadTexture(T_METAL1));
textures.put(T_METAL2, loadTexture(T_METAL2));
textures.put(T_GREY1, loadTexture(T_GREY1));
textures.put(T_GREY2, loadTexture(T_GREY2));
textures.put(T_PARTICLE, loadTexture(T_PARTICLE));
textures.put(T_MENU, loadTexture(T_MENU));
}
private final Integer loadTexture(String path)
{
Image image = (new javax.swing.ImageIcon(path)).getImage();
// Exctract The Image
BufferedImage tex = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_3BYTE_BGR);
The last line is the one that is crashes on…
and it seems to crash when it is trying to load Grey
its weird cause the other ones seems to load fine.