Little problem loading libgdx

So, I'm trying to load the Particle effects file into libgdx and im get an exception not found in the file.

Here is my code:

particleEffect = new ParticleEffect(); particleEffect.load(Gdx.files.internal("bin/emiter.pahh"),Gdx.files.internal("bin/untitled.png")); 

This is what my folders look like

enter image description here :

And the error appears:

 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?

+4
source share
2 answers

You have a file path like: "assets / emiter.phh"

It should be: "assets / emiter.pahh" according to your image.

Edit:

I looked at your corrected 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 that the name changed in the middle of the stack trace is driving me crazy ...

 "File not found: assets\emiter.pahh (Internal)" "File not found: assets\emiter.aphh (Internal)" 

Are you sure you named it correctly because the error comes from the libGDX file descriptor. Also, is the file placed in the bin folder of the project you are running? You should see the file in 'my-gdx-game / bin / emitter.pahh'.

Also, do you need to try running ParticleEmitterTest in the libGDX test project?

Edit2:

You will need to change these two lines:

 particleEffect = new ParticleEffect(); particleEffect.load(Gdx.files.internal("bin/emiter.pahh"), Gdx.files.internal("bin/untitled.png")); 

in

 particleEffect = new ParticleEffect(); particleEffect.load(Gdx.files.internal("bin/emiter.pahh"), Gdx.files.internal("bin")); 

I believe the image path is defined inside the emiter :) file.

+2
source

The same thing can happen on OSX with paths like this level_bodies \ level6 \ in IntelliJ. On Windows, this works.

0
source

Source: https://habr.com/ru/post/1436187/


All Articles