=====================================
I was able to fix it by selecting the assets folder and choosing "use as source folder". It wasn't shown in the tutorial.
=====================================
I am trying to follow along a tutorial series on gdx java graphics programming.
But I am stuck trying to load a texture.
Error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: dataack.PNG
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:140)
at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64)
at com.badlogic.gdx.graphics.Texture.load(Texture.java:130)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:121)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92)
at com.myGame.Assets.load(Assets.java:17)
at com.myGame.MyGame.create(MyGame.java:11)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: dataack.PNG (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:220)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)
... 9 more
And this is the code:
public class Assets {
public static Sprite sprite_back;
public static Texture texture_back;
public static void load() {
texture_back = new Texture(Gdx.files.internal("data/back.png"));
texture_back.setFilter(TextureFilter.Linear, TextureFilter.Linear);
sprite_back = new Sprite(texture_back);
sprite_back.flip(false, true);
}
}
This is the folder strucure: Assets>data>back.png Gdx.files.internal should start in the folder assets and therefore this should work. The image is in both the desktop and android assets folder and i also refreshed the project ecplorer.
I also tried putting it directly into the assets folder and loading it like this:
texture_back = new Texture(Gdx.files.internal("back.png"));
but that didn't work either. I also don't know why the error log says "dataack.PNG" when the code says "data/back.png"