Reputation: 455
This code keeps throwing io.FileNotFoundException:
spriteBatch = new SpriteBatch();
spriteMap = new Texture(new Pixmap(new FileHandle("Sprites.png")));
spriteMap.setFilter(TextureFilter.MipMapLinearNearest, TextureFilter.MipMapLinearNearest);
spriteMap.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);
sprites = new TextureRegion(spriteMap).split(16, 16);
any ideas what's wrong? i have also tried spriteMap = new Texture(new Pixmap(Gdx.files.internal("Sprites.png")));
but no luck...Sprites.png is just right in the package this class is in
Upvotes: 2
Views: 649
Reputation: 10320
While using this:
spriteMap = new Texture(new Pixmap(Gdx.files.internal("Sprites.png")));
be totally sure you have a file called "Sprites.png" (with the capital 'S') inside your assets folder.
assets/Sprites.png
If you have a folder between, for example data (created with the Libgdx-setup-ui by default). then you would need to put it aswell.
assets/data/Sprites.png
If you are sure the file is there. Then:
Edit:
You edited your question :p
Sprites.png is just right in the package this class is in
thats your problem, Gdx.files.internal
looks into the Android assets folder. not the folder in which the class is in.
Upvotes: 3