简体   繁体   English

Slick2D音乐无法正常工作

[英]Slick2D Music not working

I am currently testing Slick2D and thats why i am writing a Pong Game, Also, in this PongGame you can select Music Files, which are in the ./music Folder 我目前正在测试Slick2D,这就是为什么我编写Pong Game的原因,此外,在此PongGame中,您可以选择./music文件夹中的Music Files。

When i run it through Eclipse, all works perfectly. 当我通过Eclipse运行它时,所有功能都可以完美运行。 When i export it, run it with all natives and Librarys in the Folder, it also starts, but the Music Menu does not work (It just crashes when i select a Music) 当我导出它时,使用文件夹中的所有本机和库运行它,它也会启动,但是音乐菜单不起作用(当我选择音乐时,它会崩溃)

The code you can see on: https://bitbucket.org/JohnnyCrazy/pingpong/src/f2fd635ccfef/src/me/Johnny/Slick2D?at=master 您可以在以下代码上看到的代码: https : //bitbucket.org/JohnnyCrazy/pingpong/src/f2fd635ccfef/src/me/Johnny/Slick2D?at=master

Error: Mon Feb 04 13:47:05 CET 2013 ERROR:OpenAL error: Invalid
Operation (40964) org.lwjgl.openal.OpenALException: OpenAL error:
Invalid Operation (40964)
        at org.lwjgl.openal.Util.checkALError(Util.java:64)
        at org.lwjgl.openal.AL10.alDeleteBuffers(AL10.java:1097)
        at org.newdawn.slick.openal.AudioImpl.release(AudioImpl.java:56)
        at org.newdawn.slick.Music.release(Music.java:424)
        at me.Johnny.Slick2D.Slick2D.setMusic(Slick2D.java:57)
        at me.Johnny.Slick2D.MusikState.update(MusikState.java:108)
        at org.newdawn.slick.state.StateBasedGame.update(StateBasedGame.java:278)
        at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:678)
        at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:456)
        at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:361)
        at me.Johnny.Slick2D.Slick2D.main(Slick2D.java:40) Mon Feb 04 13:47:05 CET 2013 ERROR:Game.update() failure - check the game code.
  org.newdawn.slick.SlickException: Game.update() failure - check the
  game code.
         at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:684)
         at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:456)
         at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:361)
         at me.Johnny.Slick2D.Slick2D.main(Slick2D.java:40)

I don't understand why it works in Eclipse and exported it doesn't. 我不明白为什么它可以在Eclipse中工作,而不能导出。

The JavaDocs for the constructor of Music(String) are not entirely clear on how it interprets the String . Music(String)的构造函数的JavaDoc尚不清楚其如何解释String J2SE methods that take a String typically presume it to represent the path to a File . 采用String J2SE方法通常将其假定为代表File的路径。 If that is the case, that is also the reason behind the failure. 如果是这样,那也是失败背后的原因。

Typically those types of resources become an when the app. 通常,这些类型的资源在应用程序时成为 is built. 建成。 An embedded resource must be accessed by URL . 嵌入式资源必须通过URL访问。 See the embedded resource info. 请参阅嵌入式资源信息。 page for tips on forming the URL . 有关形成URL技巧的页面

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

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