I am having some issues with loading button.pack made in TexturePacker. I really can't find where is the problem. If someone can see it from my GameScreen class please let me know. Thank you very much.
public class GameScreen implements Screen {
Stage stage;
TextureAtlas buttonAtlas;
TextButtonStyle buttonStyle;
TextButton button;
Skin skin;
SpriteBatch batch;
private GameWorld world;
private GameRenderer renderer;
private float runTime;
// This is the constructor, not the class declaration
public GameScreen() {
float screenWidth = Gdx.graphics.getWidth();
float screenHeight = Gdx.graphics.getHeight();
float gameWidth = 544;
float gameHeight = screenHeight / (screenWidth / gameWidth);
world = new GameWorld();
renderer = new GameRenderer(world, (int) gameHeight, (int) gameWidth);
Gdx.input.setInputProcessor(new InputHandler(world));
}
@Override
public void render(float delta) {
runTime += delta;
world.update(delta);
renderer.render(runTime);
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
stage.act();
batch.begin();
stage.draw();
batch.end();
}
@Override
public void resize(int width, int height) {
System.out.println("GameScreen - resizing");
}
@Override
public void show() {
System.out.println("GameScreen - show called");
stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(),
true);
skin = new Skin();
buttonAtlas = new TextureAtlas("button.pack");
skin.addRegions(buttonAtlas);
}
@Override
public void hide() {
System.out.println("GameScreen - hide called");
}
@Override
public void pause() {
System.out.println("GameScreen - pause called");
}
@Override
public void resume() {
System.out.println("GameScreen - resume called");
}
@Override
public void dispose() {
// Leave blank
}
}
Every time, no matter what change I make, it says "Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: File not found: button.pack (Internal)" I checked in assets folder, button.pack and button.png are there :/