So I have been trying to load a Particle effect file to libgdx and im getting a file not found exception.
Heres my code:
particleEffect = new ParticleEffect();
particleEffect.load(Gdx.files.internal("bin/emiter.pahh"),Gdx.files.internal("bin/untitled.png"));
Heres how my folders look
:
And heres the error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: bin/untitled.png/Untitled.png
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:107)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: bin/untitled.png/Untitled.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:175)
at com.badlogic.gdx.graphics.Texture.create(Texture.java:159)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:133)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:126)
at com.badlogic.gdx.graphics.g2d.ParticleEffect.loadTexture(ParticleEffect.java:195)
at com.badlogic.gdx.graphics.g2d.ParticleEffect.loadEmitterImages(ParticleEffect.java:190)
at com.badlogic.gdx.graphics.g2d.ParticleEffect.load(ParticleEffect.java:138)
at com.me.mygdxgame.MyGdxGame.create(MyGdxGame.java:124)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:121)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:104)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: bin\untitled.png\Untitled.png (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:127)
at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:566)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:215)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)
... 11 more
What could be the problem?
You have the file path as: "assets/emiter.phh"
It should be: "assets/emiter.pahh" according to your picture.
Edit:
I looked at your revised error message:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: File not found: assets\emiter.pahh (Internal)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:107)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: assets\emiter.aphh (Internal)
The fact the name has changed in the middle of a stack trace baffles my mind...
"File not found: assets\emiter.pahh (Internal)"
"File not found: assets\emiter.aphh (Internal)"
Are you sure you have named it correctly because the error is originating from libGDX's filehandle. Also, is the file being placed into the 'bin' folder of the project you are running? You should be able to see the file in 'my-gdx-game/bin/emitter.pahh'.
Also, have to tried running the ParticleEmitterTest in the libGDX test project?
Edit2:
You'll need to change these two lines from:
particleEffect = new ParticleEffect();
particleEffect.load(Gdx.files.internal("bin/emiter.pahh"),
Gdx.files.internal("bin/untitled.png"));
to:
particleEffect = new ParticleEffect();
particleEffect.load(Gdx.files.internal("bin/emiter.pahh"),
Gdx.files.internal("bin"));
I believe the path for the image is defined inside the emiter file :).