gpt4 book ai didi

java - Slick2D 意外错误

转载 作者:行者123 更新时间:2023-12-01 22:56:18 25 4
gpt4 key购买 nike

我一直在使用 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)

我完全不知道(经过大量研究)是什么原因造成的。请解释一下?

编辑:这是它不喜欢的第一个错误行:splash = new Image("res/img/splash.png");这是它不喜欢的第二个错误行: sandMap = new Image("res/img/map/sandmap.png");

编辑2: Sandmap.png Splash.png

最佳答案

如果您仍然遇到问题,那么我可能有一个解决方案。我使用paint.net并遇到了同样的问题。当您从 Paint.net 保存图像时,选择保存目的地后会弹出一个保存配置窗口。对我来说,我必须将位深度从 8 位更改为 32 位。自动检测有时会起作用,但前提是自动检测为 32 位。我没有测试过 24 位,它可能也可以工作。希望这会有所帮助。

关于java - Slick2D 意外错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23997911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com