Friday 15 May 2015

loading - Textures don't work in jre using libgdx and java -


edit: It seems that the folders could not synchronize between eclipse projects, Had to clean up and refresh asset folders.


I am trying to use a libgdx game in Java. Everything works fine in the Eclipse debug, but when I export it in JRE, it can not load my texture (standard libgdx.png texture works great). I add text to the project by dragging and dropping data, I am selecting the "copy" option. In the code I am loading it using this code:

  texture = new texture (Gdx.files.internal ("data / player.png"));   

Debug assume it works in JRE texture (the texture jar file) shows the export project, those errors can not load:

  Exception in formula "LWJGL application" at com.badlogic.gdx.utils.GdxRuntimeExcepti: Com.badlogic.gdx.utils.GdxRuntimeException: File could not be loaded: data / player png com.badlogic.gdx.backends .lwjgl.LwjglApplication due to $ 1.run (LwjglApplicati on.java:113): com.badlogic.gdx.utils.GdxRuntimeException: data on com / player.png: could not load the file .badlogic.gdx.graphics .Pixmap & Lt; Init & gt; (Pixmap.java:140) at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare (FileTexture Data.java:64) at com.badlogic.gdx.graphics .Texture.load (Texture.java:175) com. Badlogic.gdx.graphics.Texture.create (Texture.java:159) is com.badlogic.gdx.graphics.Texture at & lt; Init & gt; (Texture.java .: 133) at com.badlogic.gdx.graphics.Texture. & Lt; Init & gt; (Com.me.mygdxgame.MyGdxGame.create (Texture.java:122 at MyGdxGame.java29)) at com.badlogic.gdx.backends. Because of lwjgl.LwjglApplication.mainLoop com.badlogic.gdx.backends.lwjgl.LwjglApplication at $ 1.run (LwjglApplic ation.java:127) (LwjglApplicati on.java:110): java.io.IOException: pixmaps loaded Could only copy 8bits at Com.badlogic.gdx.graphics.g2d.Gdx2DPixmap & lt; Init & gt; (Gdx2DPixmap.java:57) at com.badlogic.gdx.graphics.Pixma P. & Lt; Init & gt; (Pixmap.java.138) ... 8 more   

I launch configuration is like a normal configuration, but Maine is set as the main desktop project class.

close texture name is no such thing as . If you have done this only change the PNG image name. Again, your problem was that the eclipse and your property folder were not properly synchronized.

If you Edit , Delete or add take out your project folders (for example Windows Explorer), Eclipse does not know until you refresh it.

No comments:

Post a Comment