0
\$\begingroup\$

can someone tell me where i make a mistake? i want to use AssetLoader to load textures but.... always have the same error. I thought that problem is with my game so I made new project but I still have error.

Couldn't load dependencies of asset: assets/badlogic.jpg

Here is my code:

public class TestApp extends ApplicationAdapter {
   SpriteBatch batch;
   Texture img;

   @Override
   public void create () {
      Assets.load();
      batch = new SpriteBatch();
      img = Assets.manager.get(Assets.image, Texture.class);
   }

   @Override
   public void render () {
      Gdx.gl.glClearColor(1, 0, 0, 1);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      batch.begin();
      batch.draw(img, 0, 0);
      batch.end();
   }

   @Override
   public void dispose () {
      batch.dispose();
      img.dispose();
   }
}

public class Assets {

    public static final AssetManager manager = new AssetManager();

    public static final String image = "assets/badlogic.jpg";

    public static void load(){
        manager.load(image, Texture.class);
        manager.finishLoading();
    }

    public static void dispose(){
        manager.dispose();
    }
}
\$\endgroup\$
1
\$\begingroup\$

Read LibGDX's guide for plugging your assets folder to your IDE: https://github.com/libgdx/libgdx/wiki/Using-libgdx-with-intellij-idea

Especially Linking the asset directories part.

Everything in code seems ok.

\$\endgroup\$
  • \$\begingroup\$ I changed path from "assets/badlogic.jpg" to "badlogic.jpg" and everything works. But when I use manager.getProgress() console all thime show me that progress is 1.0 even if Im asking for Progress() before load() method. \$\endgroup\$ – Land93 Oct 10 '16 at 14:16
  • \$\begingroup\$ manager.finishLoading() finishes loading immediately and sets the progress to 1.0 :) \$\endgroup\$ – Jacob Oct 11 '16 at 12:17
1
\$\begingroup\$

There must be something wrong with the image's path. Try and find what might be wrong with it.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.