简体   繁体   English

Slick2D意外错误

[英]Slick2D Unexpected Error

I have been making a game with Slick2D and I recently started having to use the console for debugging, and I noticed that I have been getting these errors: 我一直在使用Slick2D制作游戏,最近我开始不得不使用控制台进行调试,并且我发现我一直在遇到以下错误:

Mon Jun 02 16:13:35 BST 2014 WARN:class org.newdawn.slick.opengl.PNGImageData failed to read the data
java.lang.UnsupportedOperationException: Unsupported format for this image
    at org.newdawn.slick.opengl.PNGDecoder.decode(PNGDecoder.java:272)
    at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:97)
    at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:62)
    at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:292)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:187)
    at org.newdawn.slick.Image.<init>(Image.java:192)
    at org.newdawn.slick.Image.<init>(Image.java:166)
    at org.newdawn.slick.Image.<init>(Image.java:154)
    at org.newdawn.slick.Image.<init>(Image.java:132)
    at luke_r.java.project_alpha.SplashScreenInitiator.init(SplashScreenInitiator.java:27)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at luke_r.java.project_alpha.Core.main(Core.java:21)
Mon Jun 02 16:13:35 BST 2014 INFO:Initialising sounds..
Mon Jun 02 16:13:35 BST 2014 INFO:- Sound works
Mon Jun 02 16:13:35 BST 2014 INFO:- 64 OpenAL source available
Mon Jun 02 16:13:35 BST 2014 INFO:- Sounds source generated
Mon Jun 02 16:13:35 BST 2014 WARN:class org.newdawn.slick.opengl.PNGImageData failed to read the data
java.lang.UnsupportedOperationException: Unsupported format for this image
    at org.newdawn.slick.opengl.PNGDecoder.decode(PNGDecoder.java:272)
    at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:97)
    at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:62)
    at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:292)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:187)
    at org.newdawn.slick.Image.<init>(Image.java:192)
    at org.newdawn.slick.Image.<init>(Image.java:166)
    at org.newdawn.slick.Image.<init>(Image.java:154)
    at org.newdawn.slick.Image.<init>(Image.java:132)
    at luke_r.java.project_alpha.ImageManager.load(ImageManager.java:14)
    at luke_r.java.project_alpha.SplashScreenInitiator.init(SplashScreenInitiator.java:30)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at luke_r.java.project_alpha.Core.main(Core.java:21)

I have absolutely no idea (after lots of research) what could be causing this. 经过大量研究,我绝对不知道是什么原因造成的。 Please could some explain? 请可以解释一下吗?

EDIT: Here is the line it doesn't like for the first error: splash = new Image("res/img/splash.png"); 编辑:这是它不喜欢的第一个错误的行: splash = new Image("res/img/splash.png"); Here is the line it doesn't like for the second error: sandMap = new Image("res/img/map/sandmap.png"); 这是第二行错误所不喜欢的行: sandMap = new Image("res/img/map/sandmap.png");

EDIT 2: Sandmap.png Splash.png 编辑2: Sandmap.png Splash.png

If you're still having trouble with this then I may have a solution. 如果您仍然遇到问题,那么我可能有解决方案。 I use paint.net and ran into the same problem. 我使用paint.net并遇到了同样的问题。 When you save your image from paint.net a save configuration window will pop up after you choose your save destination. 当您从paint.net保存图像时,选择保存目标后将弹出一个保存配置窗口。 For me I had to change the Bit-Depth from 8-bit to 32-bit. 对我来说,我必须将位深度从8位更改为32位。 Auto-detect will sometimes work but only if it auto detects it as 32-bit. 自动检测有时会起作用,但前提是自动检测为32位。 I have not tested 24-bit, it may work as well. 我还没有测试过24位,所以它也可以正常工作。 Hope this helps. 希望这可以帮助。

org.newdawn.slick.opengl.PNGImageData failed to read the data org.newdawn.slick.opengl.PNGImageData无法读取数据

Unsupported format for this image 此图片不支持的格式

The error message says what's wrong. 错误消息说明出了什么问题。 Either your image is corrupted, or not supported, or not saved properly. 您的图片已损坏,不被支持或未正确保存。 What kind of image are you using? 您正在使用哪种图像?

@Anubian is correct that your PNG must be corrupt. @Anubian是正确的,您的PNG必须已损坏。 Try remaking it or use another software to create it. 尝试重新制作它或使用其他软件来创建它。 See where Slick2D threw the exception here . 此处查看Slick2D在何处引发了异常。 I tried to use Wolfgang Fellger's PNG Analyzer and I couldn't even open your image. 我尝试使用Wolfgang Fellger的PNG分析器 ,但我什至无法打开您的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM